diff --git a/Core/GameEngine/Include/Common/ArchiveFileSystem.h b/Core/GameEngine/Include/Common/ArchiveFileSystem.h index a482e593b9..f323b0f829 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 5af9cbe130..c53fa59ee1 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 ff412fcb6f..55b6a5b320 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 c88b9303ac..8c9e3a06d8 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 1ea96161ce..7e426b4daa 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 nullptr")); \ 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 nullptr")); \ 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 5babbf4553..94b375a081 100644 --- a/Core/GameEngine/Include/Common/GameMemoryNull.h +++ b/Core/GameEngine/Include/Common/GameMemoryNull.h @@ -17,6 +17,7 @@ */ #pragma once +#include #define allocateBytes(ARGCOUNT,ARGLITERAL) allocateBytesImplementation(ARGCOUNT) #define allocateBytesDoNotZero(ARGCOUNT,ARGLITERAL) allocateBytesDoNotZeroImplementation(ARGCOUNT) @@ -64,11 +65,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 db9568ee0e..ce6b12a146 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 084aa8d857..4e37b260ca 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 431cfbf166..0e187c0c0b 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 bf481b1978..270f94a400 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 ff66edfe47..1a3295f892 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 80e6644591..45e0ee9bf1 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 8463ff83ab..d7ea15b5a5 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 98b98fe36e..2cd666045c 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 nullptr. Connections corresponding to slots that + // do not have a player will also be nullptr. 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 5178e7d36b..67744cf75c 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 b6dd903594..26976e9833 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 0b2651d248..dea7352a58 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 eecd1eedba..5bf80c899a 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 (nullptr 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 dbdeb0dfc6..1af8958bcd 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 (nullptr 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 f71e7b18a7..16201f4924 100644 --- a/Core/GameEngine/Include/GameNetwork/LANPlayer.h +++ b/Core/GameEngine/Include/GameNetwork/LANPlayer.h @@ -27,6 +27,7 @@ // Author: Matthew D. Campbell, October 2001 (Pulled out of LANAPI.h by CLH on 12/21/01 #pragma once +#include /** * LAN player class. This is for players sitting in the lobby. Players are @@ -35,7 +36,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 e87de2eb6c..dba20cdc11 100644 --- a/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h +++ b/Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h @@ -28,6 +28,7 @@ // #pragma once +#include #include extern CComModule _Module; @@ -51,15 +52,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 +82,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 eda40c71c7..5ad6869a8e 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; } //------------------------------------------------------------------------------------------------- @@ -759,7 +759,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 9917266a64..5d580d7e20 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 nullptr. 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 1f0bbe18c0..5e05c6ee4d 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 4af0d3a6a1..541220eff7 100644 --- a/Core/GameEngine/Source/Common/Audio/simpleplayer.cpp +++ b/Core/GameEngine/Source/Common/Audio/simpleplayer.cpp @@ -17,6 +17,7 @@ */ +#include #include "Common/simpleplayer.h" #include "Common/urllaunch.h" @@ -27,33 +28,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 +71,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 +165,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 +234,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 +250,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 +267,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 +284,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 +322,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 +332,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 +342,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 +384,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 +429,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 +463,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 +486,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 +582,7 @@ HRESULT STDMETHODCALLTYPE CSimplePlayer::OnStatus( case WMT_NO_RIGHTS: { - LPWSTR pwszEscapedURL = NULL; + LPWSTR pwszEscapedURL = nullptr; hr = MakeEscapedURL( m_pszUrl, &pwszEscapedURL ); @@ -599,7 +600,7 @@ HRESULT STDMETHODCALLTYPE CSimplePlayer::OnStatus( } delete [] pwszEscapedURL; - pwszEscapedURL = NULL ; + pwszEscapedURL = nullptr ; } } break; @@ -624,7 +625,7 @@ HRESULT CSimplePlayer::Close() { HRESULT hr = S_OK; - if( NULL != m_pReader ) + if( nullptr != m_pReader ) { hr = m_pReader->Close(); @@ -676,7 +677,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 +696,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 6ac481a89c..04ab4900ab 100644 --- a/Core/GameEngine/Source/Common/Audio/urllaunch.cpp +++ b/Core/GameEngine/Source/Common/Audio/urllaunch.cpp @@ -17,6 +17,7 @@ */ +#include #include "Common/urllaunch.h" #define FILE_PREFIX L"file://" @@ -25,7 +26,7 @@ /////////////////////////////////////////////////////////////////////////////// HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL ) { - if( ( NULL == pszInURL ) || ( NULL == ppszOutURL ) ) + if( ( nullptr == pszInURL ) || ( nullptr == ppszOutURL ) ) { return( E_INVALIDARG ); } @@ -45,7 +46,7 @@ HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL ) { LPWSTR pchToEscape = wcspbrk( pszTemp, L" #$%&\\+,;=@[]^{}" ); - if( NULL == pchToEscape ) + if( nullptr == pchToEscape ) { break; } @@ -67,7 +68,7 @@ HRESULT MakeEscapedURL( LPWSTR pszInURL, LPWSTR *ppszOutURL ) *ppszOutURL = new WCHAR[ cchNeeded ]; - if( NULL == *ppszOutURL ) + if( nullptr == *ppszOutURL ) { return( E_OUTOFMEMORY ); } @@ -89,7 +90,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 +128,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 +149,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 +172,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 +187,7 @@ HRESULT GetShellOpenCommand( LPTSTR ptszShellOpenCommand, DWORD cbShellOpenComma // if( !fFoundExtensionCommand ) { - if( NULL != hKey ) + if( nullptr != hKey ) { RegCloseKey( hKey ); } @@ -205,17 +206,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 +249,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 +270,7 @@ HRESULT LaunchURL( LPCWSTR pszURL ) // TCHAR szExe[ MAX_PATH * 2 ]; LPTSTR pchFirst = szShellOpenCommand; - LPTSTR pchNext = NULL; + LPTSTR pchNext = nullptr; while( _T( ' ' ) == *pchFirst ) { @@ -287,7 +288,7 @@ HRESULT LaunchURL( LPCWSTR pszURL ) pchNext = _tcschr( pchFirst + 1, _T( ' ' ) ); } - if( NULL == pchNext ) + if( nullptr == pchNext ) { pchNext = szShellOpenCommand + _tcslen( szShellOpenCommand ); } @@ -312,8 +313,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 +324,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 6b46e248bb..37ee13a87e 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 d538af0677..0ad42c944a 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 b62447291c..592660bd50 100644 --- a/Core/GameEngine/Source/Common/GameUtility.cpp +++ b/Core/GameEngine/Source/Common/GameUtility.cpp @@ -78,11 +78,11 @@ bool localPlayerHasRadar() Player* getObservedOrLocalPlayer() { - DEBUG_ASSERTCRASH(TheControlBar != NULL, ("TheControlBar is NULL")); + DEBUG_ASSERTCRASH(TheControlBar != nullptr, ("TheControlBar is nullptr")); Player* player = TheControlBar->getObservedPlayer(); - if (player == NULL) + if (player == nullptr) { - DEBUG_ASSERTCRASH(ThePlayerList != NULL, ("ThePlayerList is NULL")); + DEBUG_ASSERTCRASH(ThePlayerList != nullptr, ("ThePlayerList is nullptr")); player = ThePlayerList->getLocalPlayer(); } return player; @@ -90,13 +90,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; @@ -112,11 +112,11 @@ PlayerIndex getObservedOrLocalPlayerIndex_Safe() void changeLocalPlayer(Player* player) { - DEBUG_ASSERTCRASH(player != NULL, ("Player is NULL")); + DEBUG_ASSERTCRASH(player != nullptr, ("Player is nullptr")); ThePlayerList->setLocalPlayer(player); - TheControlBar->setObserverLookAtPlayer(NULL); - TheControlBar->setObservedPlayer(NULL); + TheControlBar->setObserverLookAtPlayer(nullptr); + TheControlBar->setObservedPlayer(nullptr); TheControlBar->setControlBarSchemeByPlayer(player); TheControlBar->initSpecialPowershortcutBar(player); @@ -128,14 +128,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 e729c0a40c..2420542bee 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 442f923504..92a19c0f41 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 f1c00982a8..c14816de3d 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 354925c8fc..7d18b5cb58 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 c10b42754c..6ec50609af 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 1d8223a014..827a20d568 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 31567ec533..7dc6dc207f 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 33ddbff460..a78085fcda 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 46d468d4a0..ac180b0a33 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 78a855c00d..80f0953841 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 nullptr 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 nullptr #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 d25872b98c..6bdd7e6570 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 8520a77de9..df96e9e77a 100644 --- a/Core/GameEngine/Source/Common/System/GameMemoryNull.cpp +++ b/Core/GameEngine/Source/Common/System/GameMemoryNull.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "PreRTS.h" #include @@ -28,8 +29,8 @@ static Bool theMainInitFlag = false; // PUBLIC DATA // ---------------------------------------------------------------------------- -MemoryPoolFactory *TheMemoryPoolFactory = NULL; -DynamicMemoryAllocator *TheDynamicMemoryAllocator = NULL; +MemoryPoolFactory *TheMemoryPoolFactory = nullptr; +DynamicMemoryAllocator *TheDynamicMemoryAllocator = nullptr; //----------------------------------------------------------------------------- // METHODS for DynamicMemoryAllocator @@ -45,7 +46,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 +108,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 +137,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 +162,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 +176,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 +191,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 +205,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 7ac8cd7a20..ffe95f0752 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 af6b19329b..81373dc558 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 21ab80e578..7f4802ef41 100644 --- a/Core/GameEngine/Source/Common/System/MiniDumper.cpp +++ b/Core/GameEngine/Source/Common/System/MiniDumper.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine #ifdef RTS_ENABLE_CRASHDUMP @@ -24,10 +25,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 +40,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 +54,8 @@ void MiniDumper::shutdownMiniDumper() { TheMiniDumper->ShutDown(); TheMiniDumper->~MiniDumper(); - ::HeapFree(::GetProcessHeap(), NULL, TheMiniDumper); - TheMiniDumper = NULL; + ::HeapFree(::GetProcessHeap(), 0, TheMiniDumper); + TheMiniDumper = nullptr; } } @@ -63,10 +64,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 +146,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 +159,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 +195,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 +212,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 +230,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 nullptr")); ::SetEvent(m_quitting); DWORD waitRet = ::WaitForSingleObject(m_dumpThread, 3000); @@ -256,29 +257,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 +321,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 nullptr, exiting thread.")); return MiniDumperExitCode_FailureParam; } @@ -350,16 +351,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 +387,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 ab689ad343..2a4f79b7da 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 93d5994b45..31c68bcd71 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 nullptr 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 86ac2046b8..449d1a09e8 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 nullptr 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 nullptr + 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 - nullptr 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 nullptr, 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 nullptr, 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 nullptr")); - 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 1fc9f43b2e..958ef2a3a2 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 af1a6317e3..64c509f7dd 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 4427a7dd0a..205504a19b 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 520cd2cc4f..443bfeb351 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 nullptr", 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 9b1f1981b3..e2e1ce40d2 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 nullptr", 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 nullptr", 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 nullptr", 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 292cb6c883..363e559810 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 nullptr!" )); // 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 nullptr", 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 nullptr", 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 nullptr", 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 nullptr", m_identifier.str()) ); // write data to file diff --git a/Core/GameEngine/Source/Common/WorkerProcess.cpp b/Core/GameEngine/Source/Common/WorkerProcess.cpp index 5970225a38..d5b3055ee2 100644 --- a/Core/GameEngine/Source/Common/WorkerProcess.cpp +++ b/Core/GameEngine/Source/Common/WorkerProcess.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine #include "Common/WorkerProcess.h" @@ -67,9 +68,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 +83,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 +94,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 +112,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 +126,7 @@ bool WorkerProcess::startProcess(UnicodeString command) bool WorkerProcess::isRunning() const { - return m_processHandle != NULL; + return m_processHandle != nullptr; } bool WorkerProcess::isDone() const @@ -149,8 +150,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 nullptr")); + BOOL success = PeekNamedPipe(m_readHandle, nullptr, 0, nullptr, &bytesAvailable, nullptr); if (!success) return true; if (bytesAvailable == 0) @@ -161,7 +162,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 +191,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 +207,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 0bbbfde983..a5417a790d 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 nullptr 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 a99f1cdc36..1aab455157 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 46615690a7..737ac56133 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 363cde812a..9eefbefe9a 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 62b40b491f..5c6cfc05fb 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 ceae1abd30..bcc12bc8c6 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 7b200f35d8..01966f9dd7 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 a756d3c456..4653cc4f95 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 9794560208..d529ff7255 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 ce17606d22..3382f11ce0 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 fe804e5ae8..eda3997112 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 7b3450a960..4ddb2ed1af 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 nullptr, 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-nullptr, 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 nullptr. 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 nullptr")); } } 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 nullptr")); } } 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 nullptr, 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) { @@ -1818,7 +1818,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()) { @@ -1829,19 +1829,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(); @@ -1856,7 +1856,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; @@ -1946,14 +1946,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) { @@ -1999,7 +1999,7 @@ void ConnectionManager::parseUserList(const GameInfo *game) } free(list); // from the strdup above. - list = NULL; + list = nullptr; */ } @@ -2167,7 +2167,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) @@ -2177,7 +2177,7 @@ void ConnectionManager::sendFile(AsciiString path, UnsignedByte playerMask, Unsi if (!compressedSize) { delete[] compressedBuf; - compressedBuf = NULL; + compressedBuf = nullptr; } #endif // COMPRESS_TARGAS @@ -2202,10 +2202,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)); @@ -2235,7 +2235,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); } } @@ -2321,7 +2321,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(); } @@ -2390,11 +2390,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 c64f3118ad..5d9cc7dfe6 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 320b672ee9..5c35263585 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 da5fef6e76..88b980f33f 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 0bc84f74be..1dfc334930 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 a9a9aca66e..00cd5836ef 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 8551069dae..eedc93150b 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], ("nullptr 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], ("nullptr 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], ("nullptr 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.getLength() > 0) { @@ -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.getLength() > 0) { @@ -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 9b289c450e..3c7d409242 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 e3089d6fb6..c992846118 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 bc2360883a..c4d593bbe1 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 c59f0613a2..7fad1cbb3d 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 7ac0d39b85..4abf1e25fc 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 c6585cef93..9cb427a987 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 4e64c1b167..a4409226e4 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 dc0aea8b3f..6af7c5687a 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 nullptr when it should be")); + DEBUG_ASSERTCRASH(TheNAT == nullptr, ("TheNAT is not nullptr 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 nullptr 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 da36009076..50e2180d83 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 6d8cc679b2..6c13e2561b 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, ("nullptr 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 10af680e1b..209e1d3bed 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 9336b82064..4bc2810946 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 86db49cbc7..4dae39a3ad 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; // nullptr 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; // nullptr 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; // nullptr 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 ee3c87e3bf..a43e3b5502 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 nullptr 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 d6dbba0823..1629a1df8b 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 nullptr")); 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 nullptr")); 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 a34b6ea0e7..638681e442 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 76428c7038..1867e9d930 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 nullptr 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 nullptr")); + DEBUG_ASSERTCRASH(targetSlot != nullptr, ("trying to negotiate with a nullptr 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 nullptr")); + if (targetSlot == nullptr) { + DEBUG_LOG(("NAT::sendMangledSourcePort - targetSlot is nullptr, 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 nullptr, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::sendMangledSourcePort - localSlot is nullptr, 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 nullptr")); + if (targetSlot == nullptr) { + DEBUG_LOG(("NAT::processManglerResponse - targetSlot is nullptr, 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 nullptr, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::probed - localSlot is nullptr, 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 nullptr")); + if (targetSlot == nullptr) { + DEBUG_LOG(("NAT::probed - targetSlot is nullptr, 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 nullptr")); + if (targetSlot == nullptr) { + DEBUG_LOG(("NAT::gotMangledPort - targetSlot is nullptr, 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 nullptr, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::gotMangledPort - localSlot is nullptr, 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 nullptr")); + 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 nullptr, 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 nullptr, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::notifyUsersOfConnectionDone - localSlot is nullptr, 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 nullptr, WTF?")); + if (localSlot == nullptr) { + DEBUG_LOG(("NAT::notifyUsersOfConnectionFailed - localSlot is nullptr, 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 9df51d77e9..35017cfdfc 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 nullptr")); + 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 ea6d56b728..19e349a71b 100644 --- a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -90,8 +90,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; } /** @@ -113,7 +113,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; @@ -125,19 +125,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; } @@ -145,7 +145,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++ ) @@ -170,7 +170,7 @@ GameMessage *NetGameCommandMsg::constructGameMessage() retval->friend_setPlayerIndex( ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name))->getPlayerIndex()); GameMessageArgument *arg = m_argList; - while (arg != NULL) { + while (arg != nullptr) { switch (arg->m_type) { @@ -820,7 +820,7 @@ void NetProgressCommandMsg::setPercentage( UnsignedByte percent ) 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; @@ -830,7 +830,7 @@ NetWrapperCommandMsg::NetWrapperCommandMsg() : NetCommandMsg() { NetWrapperCommandMsg::~NetWrapperCommandMsg() { delete m_data; - m_data = NULL; + m_data = nullptr; } UnsignedByte * NetWrapperCommandMsg::getData() { @@ -894,14 +894,14 @@ void NetWrapperCommandMsg::setWrappedCommandID(UnsignedShort wrappedCommandID) { //------------------------- 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 6e767e961a..470a387ff7 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 86333e9016..6ff3e142c2 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 43f5cd6da2..920e9d641c 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 8b9590124c..bfb3008183 100644 --- a/Core/GameEngine/Source/GameNetwork/NetPacket.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetPacket.cpp @@ -54,8 +54,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) { @@ -190,7 +190,7 @@ NetCommandRef * NetPacket::ConstructNetCommandMsgFromRawData(UnsignedByte *data, ref->setRelay(relay); msg->detach(); - msg = NULL; + msg = nullptr; return ref; @@ -213,7 +213,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; @@ -268,15 +268,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; } @@ -284,7 +284,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. } @@ -368,7 +368,7 @@ UnsignedInt NetPacket::GetGameCommandSize(NetCommandMsg *msg) { msglen += sizeof(UnsignedByte); // Int numTypes = parser->getNumTypes(); GameMessageParserArgumentType *arg = parser->getFirstArgumentType(); - while (arg != NULL) { + while (arg != nullptr) { msglen += 2 * sizeof(UnsignedByte); // for the type and number of args of that type declaration. GameMessageArgumentDataType type = arg->getType(); @@ -414,10 +414,10 @@ UnsignedInt NetPacket::GetGameCommandSize(NetCommandMsg *msg) { } deleteInstance(parser); - parser = NULL; + parser = nullptr; deleteInstance(gmsg); - gmsg = NULL; + gmsg = nullptr; return msglen; } @@ -944,7 +944,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); @@ -1012,12 +1012,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) { @@ -2013,7 +2013,7 @@ NetPacket::NetPacket(TransportMessage *msg) { */ NetPacket::~NetPacket() { deleteInstance(m_lastCommand); - m_lastCommand = NULL; + m_lastCommand = nullptr; } /** @@ -2032,12 +2032,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(); } @@ -2059,7 +2059,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. } @@ -4532,7 +4532,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) { @@ -4662,7 +4662,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()) { @@ -4810,7 +4810,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); @@ -4830,7 +4830,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)); @@ -4844,7 +4844,7 @@ Bool NetPacket::addGameCommand(NetCommandRef *msg) { } deleteInstance(gmsg); - gmsg = NULL; + gmsg = nullptr; return retval; } @@ -4936,7 +4936,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 += 2 * sizeof(UnsignedByte); // for the type and number of args of that type declaration. GameMessageArgumentDataType type = arg->getType(); @@ -4983,7 +4983,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)) { @@ -5006,7 +5006,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) { @@ -5041,7 +5041,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))); @@ -5156,7 +5156,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; } @@ -5176,7 +5176,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())); @@ -5187,8 +5187,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 nullptr. + msg = nullptr; break; } @@ -5196,11 +5196,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) { @@ -5252,7 +5252,7 @@ NetCommandList * NetPacket::getCommandList() { // add the message to the list. NetCommandRef *ref = retval->addMessage(msg); - if (ref != NULL) { + if (ref != nullptr) { ref->setRelay(relay); } @@ -5262,8 +5262,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 nullptr. + msg = nullptr; break; } @@ -5280,7 +5280,7 @@ NetCommandList * NetPacket::getCommandList() { } deleteInstance(lastCommand); - lastCommand = NULL; + lastCommand = nullptr; return retval; } @@ -5325,7 +5325,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(); } @@ -5334,14 +5334,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 nullptr 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 nullptr here + if (parserArgType != nullptr) { argsLeftForType = parserArgType->getArgCount(); lasttype = parserArgType->getType(); } @@ -5349,7 +5349,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 71d672cfed..a3126539a2 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 nullptr 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 4d04807d28..ee57e4a673 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.getLength() == 0) { - DEBUG_LOG(("ResolveIP(): Can't resolve NULL")); + DEBUG_LOG(("ResolveIP(): Can't resolve nullptr")); 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 26c459f161..3c7a4d9cdf 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 nullptr!")); 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 nullptr!")); return FALSE; } diff --git a/Core/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp b/Core/GameEngine/Source/GameNetwork/WOLBrowser/WebBrowser.cpp index d644725d48..2734d5f032 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 nullptr")); + 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 fd21c6e066..cc4c087d0b 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 314a8b8770..6306020cf0 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 86c15a96ef..9fd3d6150f 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 nullptr 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(); @@ -715,7 +715,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. @@ -730,7 +730,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) AIL_set_stream_volume_pan(stream, curVolume, 0.5f); playStream(event, stream); m_playingStreams.push_back(audio); - audio = NULL; + audio = nullptr; } break; } @@ -785,12 +785,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); @@ -808,7 +808,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) } else { - audio = NULL; + audio = nullptr; #ifdef INTENSIVE_AUDIO_DEBUG DEBUG_LOG((" Playing.")); #endif @@ -855,13 +855,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); @@ -876,7 +876,7 @@ void MilesAudioManager::playAudioEvent( AudioEventRTS *event ) #endif m_playingSounds.pop_back(); } else { - audio = NULL; + audio = nullptr; } #ifdef INTENSIVE_AUDIO_DEBUG @@ -887,8 +887,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 nullptr above. (And it will be freed + // later. However, if audio is non-nullptr at this point, then it must be freed. if (audio) { releasePlayingAudio(audio); } @@ -1076,7 +1076,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); } @@ -1085,7 +1085,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); } @@ -1094,7 +1094,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; @@ -1123,7 +1123,7 @@ void MilesAudioManager::releasePlayingAudio( PlayingAudio *release ) releaseAudioEventRTS(release->m_audioEventRTS); } delete release; - release = NULL; + release = nullptr; } //------------------------------------------------------------------------------------------------- @@ -1219,7 +1219,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; } //------------------------------------------------------------------------------------------------- @@ -1232,7 +1232,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; } //------------------------------------------------------------------------------------------------- @@ -1241,14 +1241,14 @@ 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_sample_volume_pan(audio->m_sample, nullptr, &pan); AIL_set_sample_volume_pan(audio->m_sample, m_soundVolume * desiredVolume, pan); } else if (audio->m_type == PAT_3DSample) { AIL_set_3D_sample_volume(audio->m_3DSample, m_sound3DVolume * desiredVolume); } 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, m_musicVolume * desiredVolume, pan); @@ -1454,7 +1454,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(); @@ -1512,7 +1512,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) { @@ -1621,7 +1621,7 @@ PlayingAudio *MilesAudioManager::findPlayingAudioFrom( UnsignedInt audioComplete } } - return NULL; + return nullptr; } @@ -1673,7 +1673,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 ) { @@ -1765,7 +1765,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; @@ -1858,7 +1858,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 ) @@ -1958,9 +1958,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; @@ -2101,14 +2101,14 @@ 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); Real desiredVolume = playing->m_audioEventRTS->getVolume() * playing->m_audioEventRTS->getVolumeShift(); - 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, desiredVolume, pan); } } @@ -2129,7 +2129,7 @@ void MilesAudioManager::adjustVolumeOfPlayingAudio(AsciiString eventName, Real n // 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_stream_volume_pan(playing->m_stream, nullptr, &pan); AIL_set_stream_volume_pan(playing->m_stream, desiredVolume, pan); } } @@ -2141,7 +2141,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; @@ -2190,7 +2190,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; @@ -2240,7 +2240,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; } @@ -2330,7 +2330,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); @@ -2347,7 +2347,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); @@ -2525,7 +2525,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 ); @@ -2601,7 +2601,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); @@ -2660,7 +2660,7 @@ void MilesAudioManager::setDeviceListenerPosition( void ) const Coord3D *MilesAudioManager::getCurrentPositionFromEvent( AudioEventRTS *event ) { if (!event->isPositionalAudio()) { - return NULL; + return nullptr; } return event->getCurrentPosition(); @@ -2739,7 +2739,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; @@ -2770,7 +2770,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; } @@ -2800,7 +2800,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); @@ -2845,7 +2845,7 @@ void *MilesAudioManager::playSample3D( AudioEventRTS *event, H3DSAMPLE sample3D return fileBuffer; } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -2877,7 +2877,7 @@ void MilesAudioManager::createListener( void ) //------------------------------------------------------------------------------------------------- void MilesAudioManager::initDelayFilter( void ) { - if (m_delayFilter != NULL) { + if (m_delayFilter != nullptr) { return; } @@ -2958,7 +2958,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); @@ -2967,14 +2967,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; } @@ -2983,7 +2983,7 @@ void MilesAudioManager::releaseHandleForBink( void ) { if (m_binkHandle) { releasePlayingAudio(m_binkHandle); - m_binkHandle = NULL; + m_binkHandle = nullptr; } } @@ -3067,7 +3067,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); } //------------------------------------------------------------------------------------------------- @@ -3093,7 +3093,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); } //------------------------------------------------------------------------------------------------- @@ -3137,7 +3137,7 @@ void *AudioFileCache::openFile( AudioEventRTS *eventToOpenFrom ) strToFind = eventToOpenFrom->getDecayFilename(); break; case PP_Done: - return NULL; + return nullptr; } OpenFilesHash::iterator it; @@ -3152,7 +3152,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(); @@ -3168,7 +3168,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; } } @@ -3191,7 +3191,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; @@ -3201,7 +3201,7 @@ void *AudioFileCache::openFile( AudioEventRTS *eventToOpenFrom ) if (!freeEnoughSpaceForSample(openedAudioFile)) { m_currentlyUsedSize -= openedAudioFile.m_fileSize; releaseOpenAudioFile(&openedAudioFile); - return NULL; + return nullptr; } } @@ -3253,8 +3253,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; } } @@ -3381,6 +3381,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 1c988d1298..1f4148a251 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 13f7045bb8..ffd0150f4c 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 b20aa0eda6..2e892a0296 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 09e9c85f22..b6860e520b 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 21aea05038..6c04bbc415 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 afb6045e68..1bcefb4c5d 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 71d7124a47..140e83450f 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 5fa25f6e27..f376ff843f 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 1347418903..d26b5e9b1f 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 81fff43877..7978ec8d17 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 7f4ebc785e..e3f3902c59 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 55f228a81d..44c4c951ec 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp @@ -97,7 +97,7 @@ const Bool HALF_RES_MESH = false; -HeightMapRenderObjClass *TheHeightMap = NULL; +HeightMapRenderObjClass *TheHeightMap = nullptr; //----------------------------------------------------------------------------- // Private Data //----------------------------------------------------------------------------- @@ -131,13 +131,13 @@ void HeightMapRenderObjClass::freeIndexVertexBuffers(void) for (int i=0; igetTerrainTexture()); REF_PTR_SET(m_stageOneTexture, pMap->getAlphaTerrainTexture()); } @@ -1071,7 +1071,7 @@ HeightMapRenderObjClass::~HeightMapRenderObjClass(void) freeMapResources(); delete [] m_extraBlendTilePositions; - m_extraBlendTilePositions = NULL; + m_extraBlendTilePositions = nullptr; } //============================================================================= @@ -1080,15 +1080,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), @@ -1160,12 +1160,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); @@ -1238,8 +1238,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; } @@ -1260,7 +1260,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(); } @@ -1312,10 +1312,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. @@ -1364,9 +1364,9 @@ Int HeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pMap, m_vertexBufferTiles = NEW DX8VertexBufferClass*[m_numVertexBufferTiles]; m_vertexBufferBackup = NEW char *[m_numVertexBufferTiles]; - Int numVertex = VERTEX_BUFFER_TILE_LENGTH*2*VERTEX_BUFFER_TILE_LENGTH*2; + Int numVertex = VERTEX_BUFFER_TILE_LENGTH*2*VERTEX_BUFFER_TILE_LENGTH*2; - for (i=0; igetDynamicLights()); - if (m_map == NULL) { + if (m_map == nullptr) { return; } @@ -1675,13 +1675,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); @@ -1954,8 +1954,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); @@ -2053,7 +2053,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); } @@ -2113,15 +2113,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(); @@ -2130,7 +2130,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); } } @@ -2139,8 +2139,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(); @@ -2148,13 +2148,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(); @@ -2178,11 +2178,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); } @@ -2399,7 +2399,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 9e923b1d6d..d9e0016bad 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 fe936811b8..1f607d54fd 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 6ae6394e28..69397ece6c 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 d11d305123..bc21f22e6d 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 bed66d1c65..f12a9c9733 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 d7691c6316..5741359047 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 83a391b5d7..6679998914 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 nullptr. 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 77935049c5..a8f9d89949 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 1b5ba20336..2d129921fd 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 6f190d0063..7f41e93e62 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 704f000e25..396cfcc1bb 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 nullptr 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 nullptr /// @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 nullptr 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, nullptr 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 nullptr 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 afc6ed9013..2551821d39 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 nullptr. 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 52384dfed5..45fb6531a7 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, Bool fullTile) { Short baseNdx = tileNdx>>2; - if (m_sourceTiles[baseNdx] == NULL) { + if (m_sourceTiles[baseNdx] == nullptr) { // Missing texture. *minU = *minV = *maxU = *maxV = 0.0f; return; @@ -2132,7 +2132,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; @@ -2179,7 +2179,7 @@ TextureClass *WorldHeightMap::getTerrainTexture(void) TextureClass *WorldHeightMap::getAlphaTerrainTexture(void) { - if (m_alphaTerrainTex == NULL) { + if (m_alphaTerrainTex == nullptr) { getTerrainTexture(); } return m_alphaTerrainTex; @@ -2187,7 +2187,7 @@ TextureClass *WorldHeightMap::getAlphaTerrainTexture(void) TextureClass *WorldHeightMap::getEdgeTerrainTexture(void) { - if (m_alphaEdgeTex == NULL) { + if (m_alphaEdgeTex == nullptr) { getTerrainTexture(); } return m_alphaEdgeTex; @@ -2379,12 +2379,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]; @@ -2413,7 +2413,7 @@ UnsignedByte * WorldHeightMap::getPointerToTileData(Int xIndex, Int yIndex, Int return(s_buffer); } - return(NULL); + return(nullptr); } #define K_HORIZ 0 @@ -2448,7 +2448,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 5aaedc2f1b..64401c47ef 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 7b63431cbe..b505a85550 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.getLength() > 0) && (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 550bdd5adf..23d386d468 100644 --- a/Core/Libraries/Include/Lib/BaseTypeCore.h +++ b/Core/Libraries/Include/Lib/BaseTypeCore.h @@ -90,7 +90,8 @@ #ifndef NULL //#define NULL ((void *)0) -#define NULL 0 // C++ doesn't like casting void *'s into other pointers +//#define NULL 0 // C++ doesn't like casting void *'s into other pointers +// NULL is now deprecated - use nullptr instead #endif // MSVC math.h defines overloaded functions with this name... diff --git a/Core/Libraries/Source/Compression/CompressionManager.cpp b/Core/Libraries/Source/Compression/CompressionManager.cpp index 0853a26745..ca3343d692 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 d01f8a9911..3ab634b166 100644 --- a/Core/Libraries/Source/Compression/EAC/huffencode.cpp +++ b/Core/Libraries/Source/Compression/EAC/huffencode.cpp @@ -21,6 +21,8 @@ #ifndef __HUFWRITE #define __HUFWRITE 1 +#include + #include #include "codex.h" #include "huffcodex.h" @@ -1181,8 +1183,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 224084152a..638ab493c1 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 0fb36d93ac..f5338c0ec2 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 0dc4fb8cc2..81a84aaf18 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp @@ -62,6 +62,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "aabtree.h" #include "aabtreebuilder.h" #include "wwdebug.h" @@ -88,10 +89,10 @@ *=============================================================================================*/ AABTreeClass::AABTreeClass(void) : NodeCount(0), - Nodes(NULL), + Nodes(nullptr), PolyCount(0), - PolyIndices(NULL), - Mesh(NULL) + PolyIndices(nullptr), + Mesh(nullptr) { } @@ -137,10 +138,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 +213,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 +268,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 d38dc9d6d0..e83ce59ac8 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.h @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "simplevec.h" @@ -224,7 +225,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 +242,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 +256,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 9353b28978..478ef07fd3 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/agg_def.cpp @@ -33,6 +33,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "agg_def.h" #include "htree.h" #include "w3derr.h" @@ -65,7 +66,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 +81,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 +99,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 +118,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 +140,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 +157,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 +201,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 +238,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 +251,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 +287,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 +318,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 +348,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 +386,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 +438,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 +449,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 +461,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 +520,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 +871,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 8202d5ce2f..56942d3475 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp @@ -37,6 +37,7 @@ // MBL Update for CNC3 INCURSION - 10.23.2002 - Expanded param handling, Added STOP command // +#include #include "animatedsoundmgr.h" #include "INI.h" #include "inisup.h" @@ -58,7 +59,7 @@ ////////////////////////////////////////////////////////////////////// HashTemplateClass AnimatedSoundMgrClass::AnimationNameHash; DynamicVectorClass AnimatedSoundMgrClass::AnimSoundLists; -SoundLibraryBridgeClass* AnimatedSoundMgrClass::SoundLibrary = NULL; +SoundLibraryBridgeClass* AnimatedSoundMgrClass::SoundLibrary = nullptr; ////////////////////////////////////////////////////////////////////// // Local inlines @@ -66,7 +67,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 +101,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 +115,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 +142,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 +158,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 +196,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 +206,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 +227,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 +258,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 +266,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 +333,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 +438,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 +492,7 @@ AnimatedSoundMgrClass::Trigger_Sound const Matrix3D & tm ) { - if ((SoundLibrary == NULL) || (anim == NULL)) { + if ((SoundLibrary == nullptr) || (anim == nullptr)) { return old_frame; } @@ -502,7 +503,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 980e259591..f74d0c9550 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.h @@ -38,6 +38,7 @@ // #pragma once +#include #include "simplevec.h" #include "Vector.h" @@ -68,7 +69,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 3b387a4a43..9bba18e5f3 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;x #include "collect.h" #include "chunkio.h" #include "camera.h" @@ -148,7 +149,7 @@ class CollectionPrototypeClass : public W3DMPO, public PrototypeClass * 23/8/00 GTH : Created. * *=============================================================================================*/ CollectionClass::CollectionClass(void) : - SnapPoints(NULL) + SnapPoints(nullptr) { Update_Obj_Space_Bounding_Volumes(); } @@ -168,7 +169,7 @@ CollectionClass::CollectionClass(void) : *=============================================================================================*/ CollectionClass::CollectionClass(const CollectionDefClass & def) : SubObjects(def.ObjectNames.Count()), - SnapPoints(NULL) + SnapPoints(nullptr) { // Set our name Set_Name (def.Get_Name ()); @@ -211,7 +212,7 @@ CollectionClass::CollectionClass(const CollectionDefClass & def) : CollectionClass::CollectionClass(const CollectionClass & src) : CompositeRenderObjClass(src), SubObjects(src.SubObjects.Count()), - SnapPoints(NULL) + SnapPoints(nullptr) { *this = src; } @@ -306,9 +307,9 @@ RenderObjClass * CollectionClass::Clone(void) const void CollectionClass::Free(void) { for (int i=0; iSet_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 +532,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 +544,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 +745,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 +930,7 @@ int CollectionClass::Get_Proxy_Count (void) const *=============================================================================================*/ CollectionDefClass::CollectionDefClass(void) { - SnapPoints = NULL; + SnapPoints = nullptr; } @@ -1088,15 +1089,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 0601a81947..3b0be181b6 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/coltest.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/coltest.h @@ -39,6 +39,7 @@ #pragma once +#include #include "always.h" #include "castres.h" #include "lineseg.h" @@ -98,7 +99,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 5924b3d815..58994b2883 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, + // nullptr 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 nullptr, 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 6ea694d29d..ad89521a4f 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/decalsys.cpp @@ -47,6 +47,7 @@ * DecalGeneratorClass::Set_Mesh_Transform -- sets the current mesh coordinate system * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "decalsys.h" #include "rendobj.h" #include "mesh.h" @@ -174,12 +175,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 +278,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 +296,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 +313,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 +331,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 +462,7 @@ void MultiFixedPoolDecalSystemClass::LogicalDecalClass::Clear(uint32 decal_id) */ MultiFixedPoolDecalSystemClass::LogicalDecalPoolClass::LogicalDecalPoolClass(void) : - Array(NULL), + Array(nullptr), Size(0) { } @@ -469,13 +470,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 6d7cbc1aa6..21ef49dbd5 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/decalsys.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/decalsys.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "matrix3d.h" @@ -162,7 +163,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 d64078d3f8..97eb3ff975 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/distlod.cpp @@ -77,6 +77,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "distlod.h" #include "nstrdup.h" #include "ww3d.h" @@ -104,7 +105,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 +113,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 +136,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 +170,9 @@ PrototypeClass *DistLODLoaderClass::Load_W3D( ChunkLoadClass &cload ) * HISTORY: * *=============================================================================================*/ DistLODDefClass::DistLODDefClass(void) : - Name(NULL), + Name(nullptr), LodCount(0), - Lods(NULL) + Lods(nullptr) { } @@ -193,11 +194,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 +244,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 +430,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 +473,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 +585,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 +627,7 @@ void DistLODClass::Set_Transform(const Matrix3D &m) { RenderObjClass::Set_Transform(m); for (int i=0; iSet_Transform(m); } } @@ -650,7 +651,7 @@ void DistLODClass::Set_Position(const Vector3 &v) { RenderObjClass::Set_Position(v); for (int i=0; iSet_Position(v); } } @@ -671,7 +672,7 @@ void DistLODClass::Set_Position(const Vector3 &v) void DistLODClass::Set_Animation( void ) { for (int i=0; iSet_Animation(); } } @@ -692,7 +693,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 +714,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 +735,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 +867,7 @@ const Matrix3D & DistLODClass::Get_Bone_Transform(int boneindex) void DistLODClass::Capture_Bone(int bindex) { for (int i=0; iCapture_Bone(bindex); } } @@ -887,7 +888,7 @@ void DistLODClass::Capture_Bone(int bindex) void DistLODClass::Release_Bone(int bindex) { for (int i=0; iRelease_Bone(bindex); } } @@ -927,7 +928,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 +1054,7 @@ void DistLODClass::Get_Snap_Point(int index,Vector3 * set) void DistLODClass::Scale(float scale) { for (int i=0; iScale(scale); } } @@ -1074,7 +1075,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 01e39339b1..8d54ad7af2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/distlod.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/distlod.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "proto.h" #include "rendobj.h" @@ -173,7 +174,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 378fdad9c2..1e828d8cb0 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dx8texman.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/dx8texman.h @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "texture.h" @@ -69,7 +70,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 +102,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 +139,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 b8bfc7fb6b..fb592a6d26 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp @@ -30,6 +30,8 @@ // $Header: $ //****************************************************************************************** +#include + #include "dx8webbrowser.h" #include "ww3d.h" #include "dx8wrapper.h" @@ -57,7 +59,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 +69,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 +128,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 38d7c9a678..441827de1c 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 814c3aec38..0294139ef1 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/dynamesh.h @@ -33,6 +33,7 @@ *-------------------------------------------------------------------------*/ #pragma once +#include #include "meshgeometry.h" #include "meshmatdesc.h" @@ -90,8 +91,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 +457,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 +465,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 cc78b9ba33..10524e509e 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 479b6d764a..c6b54a584c 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hanim.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hanim.cpp @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hanim.h" #include "assetmgr.h" #include "htree.h" @@ -62,7 +63,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 +76,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 +110,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 +133,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 +151,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 +183,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 +198,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 +285,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 +298,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 +308,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 +323,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 +333,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 +368,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 a01069917c..0076493686 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hanim.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/hanim.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "quat.h" @@ -149,7 +150,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 6813ca0785..d3facf0f1a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/hcanim.cpp @@ -49,6 +49,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hcanim.h" #include "assetmgr.h" #include "htree.h" @@ -108,12 +109,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 +175,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 +215,7 @@ HCompressedAnimClass::~HCompressedAnimClass(void) void HCompressedAnimClass::Free(void) { delete[] NodeMotion; - NodeMotion = NULL; + NodeMotion = nullptr; } @@ -261,14 +262,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 +282,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 +641,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 +668,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 +680,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 0a344c8e12..3d437456e1 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 63bc8f9acd..e3bbd03ed9 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/htree.cpp @@ -51,6 +51,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "htree.h" #include "hanim.h" #include "hcanim.h" @@ -77,7 +78,7 @@ *=============================================================================================*/ HTreeClass::HTreeClass(void) : NumPivots(0), - Pivot(NULL), + Pivot(nullptr), ScaleFactor(1.0f) { } @@ -90,7 +91,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 +139,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 +152,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 +270,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 +326,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 +359,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 +391,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 +401,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 +475,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 +484,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 +538,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 +572,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 +643,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 +654,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 +666,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 +676,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 +725,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 +798,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 +819,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 +829,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 +895,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 +977,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 +1010,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 +1026,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 +1046,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 +1081,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 38fe2c904d..1709f956bb 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 327075303c..2f4c3e74cf 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 d2ba6b4a04..e6ca062703 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 7a413efd89..3ab00a6547 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/matinfo.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "matinfo.h" #include "wwdebug.h" #include "meshmdl.h" @@ -73,7 +74,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 +134,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 +182,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; i #include "always.h" #include "wwdebug.h" @@ -219,7 +220,7 @@ class MaterialCollectorClass inline int MaterialInfoClass::Add_Vertex_Material(VertexMaterialClass * vmat) { - if (vmat != NULL) { + if (vmat != nullptr) { vmat->Add_Ref(); } int index = VertexMaterials.Count(); @@ -251,7 +252,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 +269,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 +309,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 f8cc3e348f..3146a4152b 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 #include "meshdam.h" #include "w3d_file.h" #include "w3derr.h" @@ -62,8 +63,8 @@ DamageClass::DamageClass(void): NumMaterials(0), NumVerts(0), NumColors(0), - Verts(NULL), - Colors(NULL) + Verts(nullptr), + Colors() { } @@ -83,10 +84,10 @@ DamageClass::DamageClass(void): DamageClass::~DamageClass(void) { delete [] Verts; - Verts = NULL; + Verts = nullptr; delete[] Colors; - Colors = NULL; + Colors = nullptr; } /*********************************************************************************************** diff --git a/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp b/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp index ead093ca60..022e441390 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/metalmap.cpp @@ -60,7 +60,7 @@ /* ** Class static members: */ -Vector3 * MetalMapManagerClass::_NormalTable = 0; +Vector3 * MetalMapManagerClass::_NormalTable = nullptr; /*********************************************************************************************** * MMMC::MetalMapManagerClass -- Create metal map manager from INI * @@ -77,8 +77,8 @@ Vector3 * MetalMapManagerClass::_NormalTable = 0; *=============================================================================================*/ MetalMapManagerClass::MetalMapManagerClass(INIClass &ini) : MapCount(0), - Textures(0), - MetalParameters(0), + Textures(nullptr), + MetalParameters(nullptr), CurrentAmbient(0.0f, 0.0f, 0.0f), CurrentMainLightColor(0.0f, 0.0f, 0.0f), CurrentMainLightDir(1.0f, 0.0f, 0.0f), @@ -174,11 +174,11 @@ MetalMapManagerClass::~MetalMapManagerClass(void) REF_PTR_RELEASE(Textures[i]); } delete [] Textures; - Textures = NULL; + Textures = nullptr; } delete [] MetalParameters; - MetalParameters = NULL; + MetalParameters = nullptr; } @@ -197,7 +197,7 @@ MetalMapManagerClass::~MetalMapManagerClass(void) *=============================================================================================*/ TextureClass * MetalMapManagerClass::Get_Metal_Map(int id) { - if (id < 0 || id >= 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 d2bfe954fa..e857b83139 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 b7f1c700e6..1ffd670fb2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pivot.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/pivot.cpp @@ -38,6 +38,7 @@ * PivotClass::Compute_Transform -- Update the pivot's transformation matrix * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "pivot.h" #include "wwmath.h" @@ -55,11 +56,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 +81,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 +96,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 +113,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 f8ab446df9..7e3b7fa632 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pivot.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/pivot.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector3.h" @@ -74,7 +75,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 34efa1c77d..2b40ab2526 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-nullptr * * 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-nullptr 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-nullptr 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 021c56e549..7df2d43b18 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "sharebuf.h" #include "shader.h" @@ -78,11 +79,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 +152,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; // (nullptr if not used) RGBA values + ShareBufferClass * APT; // (nullptr if not used) active point table + ShareBufferClass * PointSize; // (nullptr if not used) size override table + ShareBufferClass * PointOrientation; // (nullptr if not used) orientation indices + ShareBufferClass * PointFrame; // (nullptr 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 dfe2a89962..d612bed5ab 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 c19af3b205..d899803ce6 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 eb375602e2..92ec884188 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/proto.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/proto.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include @@ -81,7 +82,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 06fcbd4b51..e786ecc590 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rddesc.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/rddesc.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "Vector.h" #include "wwstring.h" @@ -61,9 +62,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 e307f2e41f..bfc3315d45 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "render2dsentence.h" #include "surfaceclass.h" #include "texture.h" @@ -54,18 +55,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 +134,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 +287,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 +347,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 +387,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 +423,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 +632,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 +698,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 +744,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 +927,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 +999,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 +1011,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 +1117,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 +1164,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 +1187,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 +1233,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 +1252,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 +1270,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 +1287,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 +1306,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 +1354,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 +1566,7 @@ FontCharsClass::Create_GDI_Font (const char *font_name) (const BITMAPINFO *)&bitmap_info, DIB_RGB_COLORS, (void **)&GDIBitmapBits, - NULL, + nullptr, 0L); // @@ -1598,7 +1599,7 @@ FontCharsClass::Create_GDI_Font (const char *font_name) CharOverhang = 0; } - return GDIFont != NULL && GDIBitmap != NULL; + return GDIFont != nullptr && GDIBitmap != nullptr; } @@ -1614,28 +1615,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 +1729,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 +1738,7 @@ FontCharsClass::Grow_Unicode_Array (WCHAR ch) // Delete the old array // delete [] UnicodeCharArray; - UnicodeCharArray = NULL; + UnicodeCharArray = nullptr; } FirstUnicodeChar = first_index; @@ -1755,7 +1756,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 +1765,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 +1780,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 f6d787fc13..a79041c124 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/renderobjectrecycler.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/renderobjectrecycler.cpp @@ -41,6 +41,7 @@ * RenderObjectRecyclerClass::Reset_Model -- resets a render object so it can be re-used * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "renderobjectrecycler.h" #include "rendobj.h" #include "assetmgr.h" @@ -82,7 +83,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 +92,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 +102,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 +144,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 +182,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 b5d0671fc1..2eeb07609f 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp @@ -72,6 +72,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "rendobj.h" #include "assetmgr.h" #include "win.h" @@ -103,7 +104,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 +115,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 +166,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 +195,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 +355,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 +378,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 +464,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 +541,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 +557,7 @@ RenderObjClass * RenderObjClass::Get_Sub_Object_By_Name(const char * name, int * } } - return NULL; + return nullptr; } @@ -789,7 +790,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 +811,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 nullptr. #if 1 - if (Container == NULL) { - if (Scene != NULL) { + if (Container == nullptr) { + if (Scene != nullptr) { Scene->Remove_Render_Object(this); return true; } @@ -826,7 +827,7 @@ bool RenderObjClass::Remove(void) if (!Scene) return false; Scene->Remove_Render_Object(this); - Scene = NULL; + Scene = nullptr; return true; #endif } @@ -880,7 +881,7 @@ void RenderObjClass::Notify_Added(SceneClass * scene) *=============================================================================================*/ void RenderObjClass::Notify_Removed(SceneClass * scene) { - Scene = NULL; + Scene = nullptr; } @@ -1056,7 +1057,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 +1102,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 +1151,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 +1166,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 +1217,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 +1249,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 nullptr 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 nullptr 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 fe1005ff48..7d9251cc1c 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/rendobj.h @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "sphere.h" @@ -228,7 +229,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 +287,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 +330,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 +342,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 +423,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 +466,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 +644,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 5108aa7152..3c9f15d79a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp @@ -71,6 +71,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "ringobj.h" #include "w3d_util.h" #include "wwdebug.h" @@ -171,8 +172,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 +215,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 +266,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 +374,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 nullptr 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 +502,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 +521,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 nullptr LOD if (CurrentLOD == 0) { WWASSERT(0); return; @@ -670,7 +671,7 @@ int RingRenderObjClass::Class_ID(void) const *=============================================================================================*/ void RingRenderObjClass::Render(RenderInfoClass & rinfo) { - // NULL LOD + // nullptr LOD if (CurrentLOD == 0) return; if (Is_Not_Hidden_At_All() == false) { @@ -707,7 +708,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 +860,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 +1229,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 +1409,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 +1438,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 +1636,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 b4ab20f494..048fe74958 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 nullptr 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 be885b61fd..9ab535062e 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 07245f2035..8ef81bcfed 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-nullptr 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 6a42f6586a..6d1ae9548a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp @@ -36,6 +36,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "shattersystem.h" #include "assetmgr.h" #include "mesh.h" @@ -687,8 +688,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 +731,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 +760,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 +773,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 +810,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 +996,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 +1093,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 +1133,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 +1151,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 +1193,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 +1203,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 +1219,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 4bd67a6eda..f8285b6085 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 c5ce0b6815..b226136b7a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/soundrobj.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include // TheSuperHackers @build xezon 05/04/2025 Compile in WWAUDIO for Renegade's w3dview tool. #define noWWAUDIO 1 @@ -231,7 +232,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 3b24f5e09d..6f191b622e 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp @@ -68,6 +68,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "sphereobj.h" #include "w3d_util.h" #include "wwdebug.h" @@ -119,8 +120,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 +162,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 +212,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 +301,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 nullptr 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 +437,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 +458,7 @@ void SphereRenderObjClass::Set_Name(const char * name) *=============================================================================================*/ void SphereRenderObjClass::render_sphere() { - // Should never get here with NULL LOD + // Should never get here with nullptr LOD if (CurrentLOD == 0) { WWASSERT(0); return; @@ -600,7 +601,7 @@ int SphereRenderObjClass::Class_ID(void) const *=============================================================================================*/ void SphereRenderObjClass::Render(RenderInfoClass & rinfo) { - // NULL LOD + // nullptr LOD if (CurrentLOD == 0) return; if (Is_Not_Hidden_At_All() == false) { @@ -702,7 +703,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 +1182,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 +1361,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 +1398,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 +1737,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 5b854cf4fb..c40cb1eb3c 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 nullptr 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 09b0ce0fe0..e703c89e67 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 2c045a083e..3eb75ae29f 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 f0eb918425..435b9983f7 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/streak.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/streak.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "rendobj.h" #include "shader.h" @@ -163,9 +164,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 2fe4daf94b..f0c1790e95 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-nullptr 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 fdec676476..6d05a5ccf7 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-nullptr) * *****************************************************************************/ @@ -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-nullptr) * *****************************************************************************/ @@ -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 ae112b257b..059900aabf 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 38b5ceee3e..2f411e3955 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp @@ -74,6 +74,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "texproject.h" #include "vertmaterial.h" #include "shader.h" @@ -186,10 +187,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 +206,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 +214,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 +595,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 +621,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 +710,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 +732,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 +872,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 nullptr model")); return false; } @@ -998,8 +999,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 nullptr model")); return false; } @@ -1118,19 +1119,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 +1154,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 +1164,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 +1177,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 +1244,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 0489220f64..b9579bf370 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texproject.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/texproject.h @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "matrix3d.h" @@ -158,8 +159,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 +171,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 a87382f647..fe2128c24c 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texture.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/texture.cpp @@ -39,6 +39,7 @@ * FileListTextureClass::Load_Frame_Surface -- Load source texture * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "texture.h" #include @@ -84,7 +85,7 @@ TextureBaseClass::TextureBaseClass bool reducible ) : MipLevelCount(mip_level_count), - D3DTexture(NULL), + D3DTexture(nullptr), Initialized(false), Name(""), FullPath(""), @@ -101,8 +102,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 +116,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 +205,7 @@ void TextureBaseClass::Invalidate() if (D3DTexture) { D3DTexture->Release(); - D3DTexture = NULL; + D3DTexture = nullptr; } Initialized=false; @@ -239,7 +240,7 @@ void TextureBaseClass::Invalidate() if (D3DTexture) { D3DTexture->Release(); - D3DTexture = NULL; + D3DTexture = nullptr; } Initialized=false; @@ -267,11 +268,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 +286,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 +333,7 @@ unsigned int TextureBaseClass::Get_Priority(void) { if (!D3DTexture) { - WWASSERT_PRINT(0, "Get_Priority: D3DTexture is NULL!"); + WWASSERT_PRINT(0, "Get_Priority: D3DTexture is nullptr!"); return 0; } @@ -352,7 +353,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 nullptr!"); return 0; } @@ -390,13 +391,13 @@ unsigned TextureBaseClass::Get_Reduction() const //********************************************************************************************** -//! Apply NULL texture state +//! Apply nullptr 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 "nullptr" texture + DX8Wrapper::Set_DX8_Texture(stage, nullptr); } // ---------------------------------------------------------------------------- @@ -709,7 +710,7 @@ TextureClass::TextureClass default: break; } - WWASSERT_PRINT(name && name[0], "TextureClass CTor: NULL or empty texture name"); + WWASSERT_PRINT(name && name[0], "TextureClass CTor: nullptr 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 +1003,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 +1017,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 nullptr!"); + return nullptr; } - IDirect3DSurface8 *d3d_surface = NULL; + IDirect3DSurface8 *d3d_surface = nullptr; DX8_ErrorCode(Peek_D3D_Texture()->GetSurfaceLevel(level, &d3d_surface)); return d3d_surface; } @@ -1047,7 +1048,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 +1309,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 nullptr!"); + return nullptr; } - IDirect3DSurface8 *d3d_surface = NULL; + IDirect3DSurface8 *d3d_surface = nullptr; DX8_ErrorCode(Peek_D3D_Texture()->GetSurfaceLevel(level, &d3d_surface)); return d3d_surface; } @@ -1454,7 +1455,7 @@ CubeTextureClass::CubeTextureClass default: break; } - WWASSERT_PRINT(name && name[0], "TextureClass CTor: NULL or empty texture name"); + WWASSERT_PRINT(name && name[0], "TextureClass CTor: nullptr or empty texture name"); int len=strlen(name); for (int i=0;i #include "always.h" #include "chunkio.h" @@ -191,9 +192,9 @@ class TextureBaseClass : public RefCountClass // Apply a Null texture's settings into D3D static void Apply_Null(unsigned int stage); - virtual TextureClass* As_TextureClass() { return NULL; } - virtual CubeTextureClass* As_CubeTextureClass() { return NULL; } - virtual VolumeTextureClass* As_VolumeTextureClass() { return NULL; } + virtual TextureClass* As_TextureClass() { return nullptr; } + virtual CubeTextureClass* As_CubeTextureClass() { return nullptr; } + virtual VolumeTextureClass* As_VolumeTextureClass() { return nullptr; } IDirect3DTexture8* Peek_D3D_Texture() const { return (IDirect3DTexture8*)Peek_D3D_Base_Texture(); } IDirect3DVolumeTexture8* Peek_D3D_VolumeTexture() const { return (IDirect3DVolumeTexture8*)Peek_D3D_Base_Texture(); } @@ -285,7 +286,7 @@ class TextureClass : public TextureBaseClass TextureClass ( const char *name, - const char *full_path=NULL, + const char *full_path=nullptr, MipCountType mip_level_count=MIP_LEVELS_ALL, WW3DFormat texture_format=WW3D_FORMAT_UNKNOWN, bool allow_compression=true, @@ -397,7 +398,7 @@ class CubeTextureClass : public TextureClass CubeTextureClass ( const char *name, - const char *full_path=NULL, + const char *full_path=nullptr, MipCountType mip_level_count=MIP_LEVELS_ALL, WW3DFormat texture_format=WW3D_FORMAT_UNKNOWN, bool allow_compression=true, @@ -443,7 +444,7 @@ class VolumeTextureClass : public TextureClass VolumeTextureClass ( const char *name, - const char *full_path=NULL, + const char *full_path=nullptr, MipCountType mip_level_count=MIP_LEVELS_ALL, WW3DFormat texture_format=WW3D_FORMAT_UNKNOWN, bool allow_compression=true, diff --git a/Core/Libraries/Source/WWVegas/WW3D2/textureloader.cpp b/Core/Libraries/Source/WWVegas/WW3D2/textureloader.cpp index 3b1fcfa61d..a3ecdfec31 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/textureloader.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/textureloader.cpp @@ -38,6 +38,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "textureloader.h" #include "mutex.h" #include "thread.h" @@ -80,7 +81,7 @@ TextureLoadTaskListClass::TextureLoadTaskListClass(void) void TextureLoadTaskListClass::Push_Front (TextureLoadTaskClass *task) { // task should 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.Next; @@ -95,7 +96,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 +112,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 +126,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 +147,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 +181,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 +193,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 +250,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 +270,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 +416,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 +457,7 @@ IDirect3DTexture8* TextureLoader::Load_Thumbnail(const StringClass& filename, co sysmem_texture->LockRect( level, &locked_rects[level], - NULL, + nullptr, 0)); } @@ -529,7 +530,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 +567,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 +601,7 @@ IDirect3DSurface8* TextureLoader::Load_Surface_Immediate( DX8_ErrorCode( d3d_surface->LockRect( &locked_rect, - NULL, + nullptr, 0)); BitmapHandlerClass::Copy_Image( @@ -963,7 +964,7 @@ void TextureLoader::Load_Thumbnail(TextureBaseClass *tc) // release our reference to thumbnail texture d3d_texture->Release(); - d3d_texture = 0; + d3d_texture = nullptr; } @@ -1003,8 +1004,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 +1021,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 +1039,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 +1102,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 +1124,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 +1146,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 +1288,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 +1787,7 @@ void TextureLoadTaskClass::Lock_Surfaces(void) ( i, &locked_rect, - NULL, + nullptr, 0 ) ); @@ -1805,7 +1806,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 +1900,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 +1957,7 @@ bool TextureLoadTaskClass::Load_Uncompressed_Mipmap(void) src_height, src_pitch, src_format, - NULL, + nullptr, 0, true, hsv_shift); @@ -1982,7 +1983,7 @@ bool TextureLoadTaskClass::Load_Uncompressed_Mipmap(void) src_height, src_pitch, src_format, - NULL, + nullptr, 0, true, hsv_shift); @@ -2042,7 +2043,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 +2072,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 +2096,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 +2104,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 +2119,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 +2138,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 +2167,7 @@ void CubeTextureLoadTaskClass::Lock_Surfaces(void) (D3DCUBEMAP_FACES)f, i, &locked_rect, - NULL, + nullptr, 0 ) ); @@ -2190,7 +2191,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 +2455,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 +2483,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 +2506,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 +2514,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 +2536,7 @@ void VolumeTextureLoadTaskClass::Lock_Surfaces() ( i, &locked_box, - NULL, + nullptr, 0 ) ); @@ -2558,7 +2559,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 38104d6495..6709515d88 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h +++ b/Core/Libraries/Source/WWVegas/WW3D2/textureloader.h @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "texture.h" @@ -78,7 +79,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 +135,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 nullptr 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 nullptr 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 9c7a124863..9a65bcb81d 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "texturethumbnail.h" #include "hashtemplate.h" #include "missingtexture.h" @@ -102,7 +103,7 @@ ThumbnailClass::ThumbnailClass( ThumbnailClass::ThumbnailClass(ThumbnailManagerClass* manager, const StringClass& filename) : Manager(manager), - Bitmap(0), + Bitmap(nullptr), Name(filename), Allocated(false), Width(0), @@ -259,7 +260,7 @@ ThumbnailClass::~ThumbnailClass() // ---------------------------------------------------------------------------- ThumbnailManagerClass::ThumbnailManagerClass(const char* thumbnail_filename) : - ThumbnailMemory(NULL), + ThumbnailMemory(nullptr), ThumbnailFileName(thumbnail_filename), PerTextureTimeStampUsed(false), Changed(false), @@ -279,7 +280,7 @@ ThumbnailManagerClass::~ThumbnailManagerClass() } delete[] ThumbnailMemory; - ThumbnailMemory=NULL; + ThumbnailMemory=nullptr; } // ---------------------------------------------------------------------------- @@ -292,7 +293,7 @@ ThumbnailManagerClass* ThumbnailManagerClass::Peek_Thumbnail_Manager(const char* } if (GlobalThumbnailManager && GlobalThumbnailManager->ThumbnailFileName==thumbnail_filename) return GlobalThumbnailManager; - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -326,7 +327,7 @@ void ThumbnailManagerClass::Remove_Thumbnail_Manager(const char* thumbnail_filen if (GlobalThumbnailManager && GlobalThumbnailManager->ThumbnailFileName==thumbnail_filename) { delete GlobalThumbnailManager; - GlobalThumbnailManager=NULL; + GlobalThumbnailManager=nullptr; } } // ---------------------------------------------------------------------------- @@ -359,13 +360,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 +395,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 +407,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 5c4bf51f9e..652b448599 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/visrasterizer.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/visrasterizer.cpp @@ -36,6 +36,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "visrasterizer.h" #include "camera.h" #include "plane.h" @@ -145,7 +146,7 @@ static VisPolyClass _VisPoly1; VisRasterizerClass::VisRasterizerClass(void) : ModelTransform(1), - Camera(NULL), + Camera(nullptr), MVTransform(1) { } @@ -179,7 +180,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 +229,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 +376,8 @@ IDBufferClass::IDBufferClass(void) : PixelCounter(0), ResWidth(0), ResHeight(0), - IDBuffer(NULL), - ZBuffer(NULL) + IDBuffer(nullptr), + ZBuffer(nullptr) { } @@ -399,17 +400,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 +432,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 +512,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 +594,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 415b9fb8c5..5999cef031 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 eb9a537f99..b6d268ad94 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 800158e945..68da606cdc 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 e5e4182652..af3cf19b17 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AABTreeSoundCullClass.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/AABTreeSoundCullClass.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "aabtreecull.h" @@ -53,7 +54,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 370b4537f0..ee682236eb 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.Get_Length () > 0) { - 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 0a268f93f4..fda7a59086 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/AudioEvents.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "simplevec.h" #include "bittype.h" @@ -129,7 +130,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 +183,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 3915556f3c..af93ac2c62 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 4228bb65b0..12be84b2cf 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 9797e5e898..1a3cdf4a2e 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 d9227a7578..8e2b3c1558 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 593e407de8..55a7c18a2a 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 a7e4fa54e3..e7cdcd5cd2 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/PriorityVector.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/PriorityVector.h @@ -31,6 +31,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "Vector.h" @@ -67,7 +68,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 d887071808..18be023ab3 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 3896d68c5a..0173a9e335 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundBuffer.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundBuffer.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "SoundBuffer.h" #include "RAWFILE.h" #include "wwdebug.h" @@ -67,9 +68,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 +102,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 +127,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 +152,7 @@ void SoundBufferClass::Set_Filename (const char *name) { SAFE_FREE (m_Filename); - if (name != NULL) { + if (name != nullptr) { m_Filename = ::strdup (name); } @@ -170,8 +171,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 +180,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 +258,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 299a37aac9..758b41ba2e 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundCullObj.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundCullObj.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "SoundSceneObj.h" @@ -58,7 +59,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 +107,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 +122,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 +137,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 +150,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 bbb8385f58..c9c602a6d1 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 9a8796b29d..27f84a4815 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "SoundScene.h" #include "SoundCullObj.h" #include "LogicalSound.h" @@ -78,8 +79,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 +153,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 +180,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 +263,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 +298,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 +348,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 +437,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 +481,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 +528,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 +599,7 @@ SoundSceneClass::Remove_Sound { WWPROFILE ("Remove_Sound"); - if (sound_obj == NULL) { + if (sound_obj == nullptr) { return ; } @@ -613,7 +614,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 +626,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 +658,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 +739,7 @@ SoundSceneClass::Remove_Static_Sound { WWPROFILE ("Remove_Static_Sound"); - if (sound_obj == NULL) { + if (sound_obj == nullptr) { return ; } @@ -753,7 +754,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 +766,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 +798,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 +861,7 @@ SoundSceneClass::Remove_Logical_Sound { WWPROFILE ("Remove_Logical_Sound"); - if (sound_obj == NULL) { + if (sound_obj == nullptr) { return ; } @@ -887,7 +888,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 +920,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 +944,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 +971,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 +995,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 +1032,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 +1113,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 +1142,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 +1259,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 +1272,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 +1289,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 ef2620e4da..3477ad3150 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundScene.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "aabtreecull.h" #include "gridcull.h" @@ -177,7 +178,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 e9aceda67e..0e568dde2f 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.cpp @@ -33,6 +33,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "SoundSceneObj.h" #include "camera.h" #include "rendobj.h" @@ -75,7 +76,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 +90,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 +112,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 +176,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 +226,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 +337,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 f0580edfb6..c60a3b329e 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/SoundSceneObj.h @@ -33,6 +33,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "WWAudio.h" @@ -103,11 +104,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 +146,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 +164,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 +230,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 65d62e83a8..cba09f9cb6 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Threads.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/Threads.cpp @@ -30,6 +30,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "always.h" #include "Threads.h" #include "Utils.h" @@ -39,7 +40,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 +80,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 +175,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 +187,7 @@ WWAudioThreadsClass::Flush_Delayed_Release_Objects (void) SAFE_DELETE (info); } - m_ReleaseListHead = NULL; + m_ReleaseListHead = nullptr; return ; } @@ -215,10 +216,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 +230,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 +272,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 +292,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 17af4841b5..7e7bbb16ec 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Threads.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/Threads.h @@ -31,6 +31,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "windows.h" #include "Vector.h" @@ -65,7 +66,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 ffff71bff5..153fd1a904 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/Utils.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/Utils.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #pragma warning (push, 3) #include "mss.h" @@ -44,11 +45,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 +77,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 6590cbe88c..8b3394f0ed 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "always.h" #include #include "WWAudio.h" @@ -65,8 +66,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////// // Static member initialization //////////////////////////////////////////////////////////////////////////////////////////////// -WWAudioClass *WWAudioClass::_theInstance = NULL; -HANDLE WWAudioClass::_TimerSyncEvent = NULL; +WWAudioClass *WWAudioClass::_theInstance = nullptr; +HANDLE WWAudioClass::_TimerSyncEvent = nullptr; //////////////////////////////////////////////////////////////////////////////////////////////// @@ -104,14 +105,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 +121,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 +135,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 +163,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 +239,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 +259,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 +338,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 +367,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 +398,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 +414,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 +472,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 +513,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 +566,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 +592,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 nullptr. + if (success && (string_id != nullptr)) { Cache_Buffer (sound_buffer, string_id); } else if (success == false) { REF_PTR_RELEASE (sound_buffer); @@ -629,8 +630,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 nullptr. + if (success && (string_id != nullptr)) { Cache_Buffer (sound_buffer, string_id); } else if (success == false) { REF_PTR_RELEASE (sound_buffer); @@ -675,12 +676,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 +719,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 +741,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 +756,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 +784,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 +803,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 +836,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 +856,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 +883,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 +902,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 +926,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 +945,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 +973,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 +1005,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 +1039,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 +1072,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 +1125,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 +1159,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 +1184,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 +1216,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 +1237,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 +1282,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 +1290,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 +1302,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 +1323,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 +1357,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 +1380,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 +1415,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 +1425,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 +1457,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 +1483,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 +1494,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 +1526,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 +1560,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 +1617,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 +1657,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 +1682,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 +1693,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 +1712,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 +1803,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 +1830,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 +1861,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 +1884,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 +2103,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 +2142,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 +2173,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 +2276,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 +2376,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 +2405,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 +2427,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 +2447,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 +2535,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 +2674,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 +2745,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 +2769,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 +2798,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 +2843,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 cc2f6a0c9e..3f4b753bd9 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h +++ b/Core/Libraries/Source/WWVegas/WWAudio/WWAudio.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #pragma warning (push, 3) @@ -195,7 +196,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 +357,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 +503,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 9ff5f7ecbb..169b73fdcb 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 2e28131523..66a655bb05 100644 --- a/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp +++ b/Core/Libraries/Source/WWVegas/WWAudio/sound3dhandle.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "sound3dhandle.h" #include "AudibleSound.h" @@ -71,7 +72,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 +261,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 +282,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 +325,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 550d4445de..15080f5d78 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 297a9ba2a3..ea5bf8a8c9 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 5bc7ed4e86..f66b9f1073 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 e072d8a011..b0a2fe8729 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwdebug.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwdebug.cpp @@ -42,6 +42,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "wwdebug.h" //#include "win.h" can use this if allowed to see wwlib #include @@ -57,11 +58,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 +72,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 +205,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 +235,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 +265,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 +295,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 +313,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 +375,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 +404,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 +426,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 +446,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 +478,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 +486,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 +503,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 31bd9b3cf5..776d7c7298 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp @@ -38,6 +38,7 @@ * WWMemoryLogClass::Release_Memory -- frees memory * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "always.h" #include "wwmemlog.h" #include "wwdebug.h" @@ -248,11 +249,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 +273,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 +292,7 @@ WWINLINE void * Get_Mem_Log_Mutex(void) #endif #if DISABLE_MEMLOG - return NULL; + return nullptr; #endif } @@ -531,7 +532,7 @@ void WWMemoryLogClass::Register_Memory_Released(int category,int size) static void _MemLogCleanup(void) { delete _TheMemLog; - _TheMemLog = NULL; + _TheMemLog = nullptr; } @@ -539,7 +540,7 @@ MemLogClass * WWMemoryLogClass::Get_Log(void) { MemLogMutexLockClass lock; - if (_TheMemLog == NULL) { + if (_TheMemLog == nullptr) { //assert(!_MemLogAllocated); _TheMemLog = W3DNEW MemLogClass; @@ -581,7 +582,7 @@ void WWMemoryLogClass::Release_Log(void) MemLogMutexLockClass lock; delete _TheMemLog; - _TheMemLog = NULL; + _TheMemLog = nullptr; } @@ -663,7 +664,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 c02c4e5dd5..6336d3be48 100644 --- a/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp +++ b/Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp @@ -49,6 +49,7 @@ * WWProfileManager::Release_In_Order_Iterator -- Return an "in-order" iterator * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "always.h" #include "wwprofile.h" #include "FastAllocator.h" @@ -129,8 +130,8 @@ WWProfileHierachyNodeClass::WWProfileHierachyNodeClass( const char * name, WWPro StartTime( 0 ), RecursionCounter( 0 ), Parent( parent ), - Child( NULL ), - Sibling( NULL ) + Child( nullptr ), + Sibling( nullptr ) { Reset(); @@ -141,14 +142,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 +347,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 +483,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 +565,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 +723,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 +766,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 +788,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 +820,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 +903,7 @@ void WWProfileIterator::Next(void) bool WWProfileIterator::Is_Done(void) { - return CurrentChild == NULL; + return CurrentChild == nullptr; } void WWProfileIterator::Enter_Child( void ) @@ -914,12 +915,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 +928,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 +959,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 +975,7 @@ void WWProfileInOrderIterator::Next(void) bool WWProfileInOrderIterator::Is_Done(void) { - return CurrentNode == NULL; + return CurrentNode == nullptr; } /* @@ -1003,7 +1004,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 +1014,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 +1099,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 30cf21c44f..00262fd2cd 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 01e67957ea..0e53f4764c 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/FTP.cpp @@ -23,6 +23,7 @@ /*************************************************************************/ +#include #include #include #include @@ -133,7 +134,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 +199,7 @@ Cftp::~Cftp() if (m_pfLocalFile) { fclose(m_pfLocalFile); - m_pfLocalFile = NULL; + m_pfLocalFile = nullptr; } } @@ -235,7 +236,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 +270,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 +427,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 +666,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 +676,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 +831,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 +950,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 +1029,7 @@ unsigned long MyIPAddress( int sockfd ) pHE = gethostbyname( pBuffer ); - if( pHE == NULL ) + if( pHE == nullptr ) { return( FTP_FAILED ); } @@ -1039,7 +1040,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 +1228,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 +1405,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 +1564,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 +1600,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 +1692,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 +1712,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 +1761,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 +1833,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 494e09ecb2..24b4f1ce74 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp @@ -20,6 +20,8 @@ // Simple interface for storing/retreiving registry values // Author: Matthew D. Campbell, December 2001 +#include + #include #define WIN32_LEAN_AND_MEAN @@ -37,7 +39,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 +62,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 +83,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 +102,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 aed9a03a44..b99d9c857e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/BSEARCH.h +++ b/Core/Libraries/Source/WWVegas/WWLib/BSEARCH.h @@ -17,6 +17,7 @@ */ #pragma once +#include /* ** Binary searching template. It can be faster than the built in C library @@ -64,5 +65,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 368bcd03ca..55c8f78efe 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/DbgHelpLoader.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/DbgHelpLoader.cpp @@ -16,27 +16,28 @@ ** along with this program. If not, see . */ +#include #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 +52,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 +66,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 +97,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 +126,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 +140,7 @@ void DbgHelpLoader::unload() { CriticalSectionClass::LockClass lock(CriticalSection); - if (Inst == NULL) + if (Inst == nullptr) return; if (--Inst->m_referenceCount != 0) @@ -149,7 +150,7 @@ void DbgHelpLoader::unload() Inst->~DbgHelpLoader(); GlobalFree(Inst); - Inst = NULL; + Inst = nullptr; } void DbgHelpLoader::freeResources() @@ -161,24 +162,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 +192,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 +219,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 +243,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 +255,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 +267,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 +281,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 +295,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 +306,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 +318,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 +337,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 +355,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 e49d6ffb0e..db36bf2f4d 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Except.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/Except.cpp @@ -49,6 +49,7 @@ #ifdef _MSC_VER +#include #include "always.h" #include #include "assert.h" @@ -85,8 +86,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 +128,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 +149,7 @@ static char const *const ImagehelpFunctionNames[] = "StackWalk", "SymFunctionTableAccess", "SymGetModuleBaseType", - NULL + nullptr }; @@ -201,7 +202,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 +353,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 +375,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 +390,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 +469,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 +508,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 +694,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 +713,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 +811,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 +1065,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 +1084,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 +1152,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 +1197,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. nullptr means use current * * * * OUTPUT: Number of return addresses found * * * @@ -1220,7 +1221,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 +1263,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 e67a4b1f64..d26bb15048 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Except.h +++ b/Core/Libraries/Source/WWVegas/WWLib/Except.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #ifdef _MSC_VER @@ -46,7 +47,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 bf45cf9bc5..a0ccebfcc4 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h +++ b/Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h @@ -28,6 +28,7 @@ /////////////////////////////////////////////////////////////////////////////// #pragma once +#include //#define MEMORY_OVERWRITE_TEST @@ -129,7 +130,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 +160,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/nullptr. We don't want that. new(pTArray)T; ++pTArray; } @@ -187,7 +188,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 +197,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 nullptr, but gets used of the allocation request is too high. char mTArray[nStackCount*sizeof(T)]; //This is our stack memory. }; /////////////////////////////////////////////////////////////////////////////// @@ -492,8 +493,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 +508,7 @@ WWINLINE void* FastAllocatorGeneral::Realloc(void* pAlloc, unsigned int n){ return pNewAlloc; } Free(pAlloc); - return NULL; + return nullptr; } @@ -544,7 +545,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 +587,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 f0758d7227..f05f11517f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/HASHLIST.h +++ b/Core/Libraries/Source/WWVegas/WWLib/HASHLIST.h @@ -43,6 +43,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #pragma warning (push) #pragma warning (disable: 4786) @@ -51,7 +52,8 @@ #include #ifndef NULL -#define NULL (0L) +//#define NULL (0L) +// NULL is now deprecated - use nullptr instead #endif #define A_LARGE_PRIME_NUMBER 257 @@ -156,14 +158,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 +498,7 @@ HashNodeClass *HashListClass::Find(unsigned key) assert(cur); assert(cur->Is_Valid()); } - return(NULL); + return(nullptr); } @@ -534,7 +536,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 8356c1762b..05bf3ad58b 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/INDEX.h +++ b/Core/Libraries/Source/WWVegas/WWLib/INDEX.h @@ -50,6 +50,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "BSEARCH.h" @@ -293,7 +294,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 +681,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 dcfa6a631c..bb75a10559 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/INI.h +++ b/Core/Libraries/Source/WWVegas/WWLib/INI.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include @@ -64,7 +65,8 @@ template class List; template class IndexClass; #ifndef NULL -#define NULL 0L +//#define NULL 0L +// NULL is now deprecated - use nullptr instead #endif /* @@ -107,19 +109,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 159552c1e1..ea68872fa7 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/LISTNODE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/LISTNODE.h @@ -40,6 +40,7 @@ ** Includes */ #include "assert.h" +#include #ifdef __BORLANDC__ @@ -55,7 +56,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 +74,8 @@ class GenericNode { if (Is_Valid()) { PrevNode->NextNode = NextNode; NextNode->PrevNode = PrevNode; - PrevNode = 0; - NextNode = 0; + PrevNode = nullptr; + NextNode = nullptr; } } @@ -96,13 +97,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 +132,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 969c5c7bfe..bd2d9c6ca8 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/RAMFILE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/RAMFILE.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "WWFILE.h" @@ -60,7 +61,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 a770ca7cee..04d4217f92 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/RAWFILE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/RAWFILE.h @@ -39,12 +39,13 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include //#include // #include "win.h" -#define NULL_HANDLE NULL +#define NULL_HANDLE nullptr #define HANDLE_TYPE FILE* #include "WWFILE.h" #include "wwstring.h" @@ -98,7 +99,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 f93695811a..e78c8127a0 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/SLIST.h +++ b/Core/Libraries/Source/WWVegas/WWLib/SLIST.h @@ -52,11 +52,13 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "SLNODE.h" #ifndef NULL -#define NULL 0L +//#define NULL 0L +// NULL is now deprecated - use nullptr instead #endif template @@ -73,8 +75,8 @@ class SList { // SList(void) { - HeadNode = NULL; - TailNode = NULL; + HeadNode = nullptr; + TailNode = nullptr; }; virtual ~SList(void) { Remove_All(); }; @@ -97,13 +99,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 nullptr 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 nullptr 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 +133,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 +150,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 +179,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 +191,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 +223,7 @@ void SList::Remove_All(void) next = cur->Next(); delete cur; } - HeadNode = TailNode = NULL; + HeadNode = TailNode = nullptr; } /************************************************************************** @@ -240,12 +242,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 +259,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 +284,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 +322,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 +403,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 +448,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 +482,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 +510,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 c49ce72101..52c53b1af4 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/SLNODE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/SLNODE.h @@ -38,7 +38,8 @@ #include "mempool.h" #ifndef NULL -#define NULL 0 +//#define NULL 0 +// NULL is now deprecated - use nullptr instead #endif // Forward references for friend classes @@ -64,7 +65,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 073d032498..558fe9d7ea 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Signaler.h +++ b/Core/Libraries/Source/WWVegas/WWLib/Signaler.h @@ -38,6 +38,7 @@ ******************************************************************************/ #pragma once +#include template class Signaler { @@ -55,11 +56,11 @@ template class Signaler {} virtual void SignalDropped(Signaler& signaler) - {mConnection = NULL;} + {mConnection = nullptr;} protected: Signaler() : - mConnection(NULL) + mConnection() {} virtual ~Signaler() @@ -69,7 +70,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 de3d8773d1..640cc5067c 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 f0e082a3f2..603087b52c 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 09c4b8b1c3..0109fd5877 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/Vector.h +++ b/Core/Libraries/Source/WWVegas/WWLib/Vector.h @@ -52,6 +52,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include @@ -136,7 +137,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 +154,7 @@ class VectorClass *=============================================================================================*/ template VectorClass::VectorClass(int size, T const * array) : - Vector(0), + Vector(nullptr), VectorMax(size), IsValid(true), IsAllocated(false) @@ -367,7 +368,7 @@ void VectorClass::Clear(void) { if (IsAllocated) { delete[] Vector; - Vector = 0; + Vector = nullptr; } IsAllocated = false; VectorMax = 0; @@ -426,7 +427,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 +447,7 @@ bool VectorClass::Resize(int newsize, T const * array) */ if (IsAllocated) { delete[] Vector; - Vector = 0; + Vector = nullptr; } } @@ -489,14 +490,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 +542,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. (nullptr 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 +912,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 +931,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 +939,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 +970,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 +1084,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 +1094,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 +1107,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 dc94b82bc9..f44a46e278 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWCOMUtil.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/WWCOMUtil.cpp @@ -35,6 +35,7 @@ ******************************************************************************/ #include "WWCOMUtil.h" +#include /****************************************************************************** * @@ -67,10 +68,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 +108,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 +116,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 +154,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 +183,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 +222,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 16b1bbfa0a..c1c00a8a76 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/WWFILE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/WWFILE.h @@ -50,7 +50,8 @@ #endif #ifndef NULL - #define NULL 0 + //#define NULL 0 + // NULL is now deprecated - use nullptr instead #endif @@ -82,7 +83,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 2e68e3c044..ee27dc33a1 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/XPIPE.h +++ b/Core/Libraries/Source/WWVegas/WWLib/XPIPE.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "BUFF.h" #include "PIPE.h" @@ -81,7 +82,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 f21e78f275..e3aca1fd3f 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/XSTRAW.h +++ b/Core/Libraries/Source/WWVegas/WWLib/XSTRAW.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "BUFF.h" #include "STRAW.h" @@ -79,7 +80,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 c58e6dd8e4..0465276a18 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 @@ -256,7 +256,8 @@ template T max(T a,T b) #ifndef NULL - #define NULL 0 + //#define NULL 0 + // NULL is now deprecated - use nullptr instead #endif diff --git a/Core/Libraries/Source/WWVegas/WWLib/argv.cpp b/Core/Libraries/Source/WWVegas/WWLib/argv.cpp index db7829e5d5..df067156c1 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 a512b61861..79c116df29 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/argv.h +++ b/Core/Libraries/Source/WWVegas/WWLib/argv.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" @@ -68,7 +69,7 @@ class ArgvClass CurrentPos = -1; return(Find_Again(arg)); } - // If NULL passed, original string will be used. + // If nullptr passed, original string will be used. const char *Find_Again(const char *arg = 0L); // Return pointer to data after 'arg'. @@ -87,7 +88,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 fe6c313ec5..7381331796 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 09fc0ce021..3cc8ae9d68 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 8b144568ea..278c81f09c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/bfiofile.h +++ b/Core/Libraries/Source/WWVegas/WWLib/bfiofile.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "RAWFILE.h" @@ -53,7 +54,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 fa4aa9447a..1b837115a0 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/binheap.h +++ b/Core/Libraries/Source/WWVegas/WWLib/binheap.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include /*=============================================================================================*/ // Includes. @@ -65,7 +66,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 nullptr. // Keeps track of pointers to objects. template class BinaryHeapClass @@ -88,7 +89,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 +101,10 @@ class BinaryHeapClass Release_Array (); } - // Reset all entries in the array to NULL + // Reset all entries in the array to nullptr 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 +120,8 @@ class BinaryHeapClass Number_Of_Elements = 0; Own_Array = true; - // Initialize to NULL - ::memset (Elements, NULL, sizeof (HeapNodeClass *) * new_size); + // Initialize to nullptr + ::memset (Elements, nullptr, sizeof (HeapNodeClass *) * new_size); return ; } @@ -128,7 +129,7 @@ class BinaryHeapClass { if (Own_Array) { delete [] Elements; - Elements = NULL; + Elements = nullptr; Number_Of_Elements = 0; Max_Number_Of_Elements = 0; } @@ -206,7 +207,7 @@ class BinaryHeapClass HeapNodeClass* min_element; if (Number_Of_Elements == 0) { - return NULL; + return nullptr; } assert(Number_Of_Elements > 0); @@ -214,7 +215,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 ae14b73bc0..071b8768ba 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 6c16b1d31c..090639514d 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 6c8bbbdbc8..1a79fd5885 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/chunkio.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/chunkio.cpp @@ -62,6 +62,7 @@ * ChunkLoadClass::Read -- read an IOQuaternionStruct * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "chunkio.h" #include @@ -732,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)); } @@ -751,7 +752,7 @@ uint32 ChunkLoadClass::Read(IOVector2Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector3Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -770,7 +771,7 @@ uint32 ChunkLoadClass::Read(IOVector3Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector4Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -789,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/Libraries/Source/WWVegas/WWLib/cpudetect.cpp b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp index e08182ff2a..d832013df6 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "cpudetect.h" #include "wwstring.h" #include "wwdebug.h" @@ -942,7 +943,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 +1105,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 455af0d083..8577f284d0 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 ba173de5f5..aeddbe9bf4 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 c65cd46c26..af3b041741 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 02ea652aea..c4dde4dfd7 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 nullptr. */ 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 441fe6bfe7..ce9a6cfaa5 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hash.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/hash.cpp @@ -35,6 +35,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hash.h" #include "wwdebug.h" #include "realcrc.h" @@ -57,35 +58,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 +96,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 +112,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 +140,7 @@ void HashTableIteratorClass::First(void) void HashTableIteratorClass::Next(void) { CurrentEntry = NextEntry; - if ( NextEntry != NULL ) { + if ( NextEntry != nullptr ) { NextEntry = NextEntry->NextHash; Advance_Next(); } @@ -147,7 +148,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 c91e48c511..cddb6ece8c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/hash.h +++ b/Core/Libraries/Source/WWVegas/WWLib/hash.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" @@ -48,7 +49,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 +99,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 7a66ce6bbc..c888725121 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 79de6a2cad..46d5701402 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 nullptr link }; HashTemplateClass(void); diff --git a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp index fa264d0782..a6cd18ea33 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)) { 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 1ed5b8477d..f9675fc7df 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/inisup.h +++ b/Core/Libraries/Source/WWVegas/WWLib/inisup.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include /* ** This header defines generally unused member structures used by the INI class. @@ -52,9 +53,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 cca880a9f3..a5e48acfa3 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/lzo.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/lzo.cpp @@ -36,6 +36,7 @@ * LZOCompressor::Decompress -- decompress a buffer using LZO * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "lzo.h" #include "mutex.h" #include "wwdebug.h" @@ -111,5 +112,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 cae5f0e368..e880d47b73 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 d1e3e2b84f..597c4e2b50 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 543aa56e25..04634bcdfb 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/lzopipe.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/lzopipe.cpp @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "always.h" #include "BUFF.h" #include "lzo.h" @@ -67,8 +68,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 +96,10 @@ LZOPipe::LZOPipe(CompControl control, int blocksize) : LZOPipe::~LZOPipe(void) { delete [] Buffer; - Buffer = NULL; + Buffer = nullptr; delete [] Buffer2; - Buffer2 = NULL; + Buffer2 = nullptr; } @@ -123,11 +124,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 +178,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 +265,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 f618454749..0150da9b7d 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/lzostraw.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/lzostraw.cpp @@ -37,6 +37,7 @@ * LZOStraw::~LZOStraw -- Destructor for the LZO straw. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "always.h" #include "lzo.h" #include "lzostraw.h" @@ -66,8 +67,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 +96,10 @@ LZOStraw::LZOStraw(CompControl control, int blocksize) : LZOStraw::~LZOStraw(void) { delete [] Buffer; - Buffer = NULL; + Buffer = nullptr; delete [] Buffer2; - Buffer2 = NULL; + Buffer2 = nullptr; } @@ -125,14 +126,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 +165,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 3eae0cf003..73f0c4ea8e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/mempool.h +++ b/Core/Libraries/Source/WWVegas/WWLib/mempool.h @@ -43,6 +43,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "bittype.h" #include "wwdebug.h" @@ -176,8 +177,8 @@ ObjectPoolClass AutoPoolClass::Allocator = {} *=============================================================================================*/ template ObjectPoolClass::ObjectPoolClass(void) : - FreeListHead(NULL), - BlockListHead(NULL), + FreeListHead(nullptr), + BlockListHead(nullptr), FreeObjectCount(0), TotalObjectCount(0) { @@ -204,7 +205,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 +279,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 +292,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 +323,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 +365,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 8689e5bbca..49461c67b8 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 f99c5613e5..4877f28244 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/multilist.h +++ b/Core/Libraries/Source/WWVegas/WWLib/multilist.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "mempool.h" @@ -72,7 +73,7 @@ class MultiListObjectClass { public: - MultiListObjectClass(void) : ListNode(NULL) { } + MultiListObjectClass(void) : ListNode(nullptr) { } virtual ~MultiListObjectClass(void); MultiListNodeClass * Get_List_Node() const { return ListNode; } @@ -262,7 +263,7 @@ class MultiListClass : public GenericMultiListClass void Reset_List() { - while (Get_Head() != NULL) { + while (Get_Head() != nullptr) { Remove_Head(); } } @@ -310,7 +311,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 +426,7 @@ class RefMultiListClass : public GenericMultiListClass void Reset_List() { - while (Peek_Head() != NULL) { + while (Peek_Head() != nullptr) { Release_Head(); } } @@ -451,7 +452,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 +466,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 +495,7 @@ class PriorityMultiListIterator : public MultiListIterator public: PriorityMultiListIterator(MultiListClass *list) - : OriginalHead (NULL), + : OriginalHead (nullptr), MultiListIterator(list) { First (); } bool @@ -504,8 +505,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 946090a282..765b185708 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 cce5055f47..2c0c8cfbbe 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 97aaca0831..4e2084864a 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: nullptr 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 82aee8ade4..81b1d29802 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 075bfd9e0b..f3d5aa7f7d 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ntree.h +++ b/Core/Libraries/Source/WWVegas/WWLib/ntree.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwstring.h" @@ -61,7 +62,7 @@ class NTreeClass // Public constructors/destructors ////////////////////////////////////////////////////////////// NTreeClass (void) - : m_Root (NULL) { } + : m_Root (nullptr) { } virtual ~NTreeClass (void) { Reset (); } ////////////////////////////////////////////////////////////// @@ -92,9 +93,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 +122,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 +138,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 +190,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 +214,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 +237,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 +320,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 +367,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 +455,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 +485,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 +498,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 +524,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 +539,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 cbd752ee09..0a2845b756 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 98de513cf4..005830d109 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 f282d3ee30..25fad56938 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/rawfile.cpp @@ -168,7 +168,7 @@ RawFileClass::RawFileClass(void) : *=============================================================================================*/ bool RawFileClass::Is_Open(void) const { - return(Handle != NULL_HANDLE); + return(Handle != nullptr); } /*********************************************************************************************** @@ -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 nullptr. * * * * 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 * @@ -442,7 +442,7 @@ int RawFileClass::Open(int rights) // First try to open an existing file in read/write mode. Handle = fopen(Filename, "rb+"); // If that fails, try to create a new file in read/write mode. - if(Handle == NULL_HANDLE) { + if(Handle == nullptr) { Handle = fopen(Filename, "wb+"); } break; @@ -460,7 +460,7 @@ int RawFileClass::Open(int rights) ** For the case of the file cannot be found, then allow a retry. All other cases ** are fatal. */ - if (Handle == NULL_HANDLE) { + if (Handle == nullptr) { return(false); // Error(errno, false, Filename); @@ -519,7 +519,7 @@ bool RawFileClass::Is_Available(int forced) Handle=fopen(Filename,"r"); - if (Handle == NULL_HANDLE) { + if (Handle == nullptr) { return(false); } break; @@ -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 5462b80398..543dddfdfe 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 6217f09062..8804a4ba32 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/rcfile.h +++ b/Core/Libraries/Source/WWVegas/WWLib/rcfile.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "WWFILE.h" @@ -60,7 +61,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 +71,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 25112a4745..199fe30bcd 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 9e7708c386..d4ff35607f 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 b7063138d0..6401e53af1 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 01f16cc45c..59dd32ea85 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/refcount.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/refcount.cpp @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "refcount.h" // TheSuperHackers @build feliwir 17/04/2025 include __debugbreak macros @@ -71,7 +72,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 15ec71602f..5fb9e62ac2 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/registry.cpp @@ -33,6 +33,7 @@ *---------------------------------------------------------------------------------------------* * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "registry.h" #include "RAWFILE.h" #include "INI.h" @@ -71,8 +72,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 +97,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 +133,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 +157,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 +165,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 +189,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 +215,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 +233,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 +252,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 +299,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 +377,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 +464,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 +480,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 +559,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 +638,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 +687,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 +703,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 0e83f40f89..8f0a255d04 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/registry.h +++ b/Core/Libraries/Source/WWVegas/WWLib/registry.h @@ -34,6 +34,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "Vector.h" @@ -69,12 +70,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 35a7d9032e..96911f5bc8 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/search.h +++ b/Core/Libraries/Source/WWVegas/WWLib/search.h @@ -50,6 +50,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include /* ** The "bool" integral type was defined by the C++ comittee in @@ -291,7 +292,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 +654,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 05f75027b6..71e307d30c 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h +++ b/Core/Libraries/Source/WWVegas/WWLib/sharebuf.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" @@ -113,7 +114,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 ae2c6bc5a7..0e3db1332e 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/simplevec.h +++ b/Core/Libraries/Source/WWVegas/WWLib/simplevec.h @@ -48,6 +48,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include @@ -77,7 +78,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 +102,7 @@ template class SimpleVecClass *=============================================================================================*/ template inline SimpleVecClass::SimpleVecClass(int size) : - Vector(NULL), + Vector(nullptr), VectorMax(0) { if (size > 0) { @@ -125,7 +126,7 @@ template inline SimpleVecClass::~SimpleVecClass(void) { delete[] Vector; - Vector = NULL; + Vector = nullptr; VectorMax = 0; } @@ -160,7 +161,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 +173,7 @@ inline bool SimpleVecClass::Resize(int newsize) ** Delete the old vector. */ delete[] Vector; - Vector = NULL; + Vector = nullptr; } /* @@ -187,7 +188,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 +322,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 a18068ad8e..84ed8bf9f2 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 e9c9faec05..febdd06431 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/strtok_r.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/strtok_r.cpp @@ -37,6 +37,7 @@ #include "strtok_r.h" #include "stringex.h" +#include // // Replacement for strtok() that doesn't use a static to @@ -55,7 +56,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 +69,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 56db4c64b2..57ca4386c1 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/systimer.h +++ b/Core/Libraries/Source/WWVegas/WWLib/systimer.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #ifndef _SYSTIMER_H @@ -51,7 +52,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 d1db1743cf..6e916ca7a6 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/tgatodxt.cpp @@ -37,6 +37,7 @@ #pragma message ("(gth) disabling TGAtoDXTClass temporarily so I can test the WW libs merge...") #if 0 +#include #include "always.h" #include "nvdxtlib.h" #include "TARGA.h" @@ -55,12 +56,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 +208,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 +254,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 aaad589d7f..6bafc3314a 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 0f526274c6..2aae9fb4fe 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 b302888f5f..c3139357b2 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/trect.h +++ b/Core/Libraries/Source/WWVegas/WWLib/trect.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "Point.h" @@ -59,7 +60,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 +164,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 ba63093824..527687e6b8 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/uarray.h +++ b/Core/Libraries/Source/WWVegas/WWLib/uarray.h @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "hashcalc.h" #include "Vector.h" @@ -146,7 +147,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 f9333e0677..0d6b4800bd 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 6aa6cc4af8..b555c48bbc 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 41cbb495ea..6fc6d12643 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 f4da1100c4..3793688c44 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 3a5745163b..4782b20271 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/wwstring.h +++ b/Core/Libraries/Source/WWVegas/WWLib/wwstring.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "mutex.h" @@ -497,7 +498,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 15e310c9e6..cceb4400f7 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 d567c0421c..9e520096ac 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 eb0b29669f..070274ac11 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/aabox.h +++ b/Core/Libraries/Source/WWVegas/WWMath/aabox.h @@ -53,6 +53,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "matrix3d.h" @@ -518,7 +519,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; i #include "aabtreecull.h" #include "chunkio.h" #include "iostruct.h" @@ -114,7 +115,7 @@ static inline CullableClass * get_next_object(CullableClass * obj) AABTreeCullSystemClass::AABTreeCullSystemClass(void) : ObjectCount(0), NodeCount(0), - IndexedNodes(NULL) + IndexedNodes(nullptr) { RootNode = new AABTreeNodeClass; Re_Index_Nodes(); @@ -133,7 +134,7 @@ AABTreeCullSystemClass::~AABTreeCullSystemClass(void) // Delete indexed node pointer array delete[] IndexedNodes; - IndexedNodes = NULL; + IndexedNodes = nullptr; } @@ -141,7 +142,7 @@ void AABTreeCullSystemClass::Add_Object_Internal(CullableClass * obj,int node_in { WWASSERT_PRINT ( - (obj->Get_Culling_System() == NULL), + (obj->Get_Culling_System() == nullptr), "AABTreeCullSystemClass::Add -- Object is already in another culling system!\n" ); @@ -172,9 +173,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 +305,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 +382,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 +782,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 +790,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 +883,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 +919,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 +930,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 +1001,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 +1014,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 +1030,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 +1077,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 +1108,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 +1145,7 @@ void AABTreeNodeClass::Partition(void) Front->Partition(); } else { delete front; - front = NULL; + front = nullptr; } /* @@ -1156,7 +1157,7 @@ void AABTreeNodeClass::Partition(void) Back->Partition(); } else { delete back; - back = NULL; + back = nullptr; } } @@ -1165,8 +1166,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 +1256,7 @@ void AABTreeNodeClass::Partition(const AABoxClass & bounds,SimpleDynVecClassParent = this; Front->Partition(sc.FrontBox,frontboxes); } else { - Front = NULL; + Front = nullptr; } /* @@ -1266,7 +1267,7 @@ void AABTreeNodeClass::Partition(const AABoxClass & bounds,SimpleDynVecClassParent = this; Back->Partition(sc.BackBox,backboxes); } else { - Back = NULL; + Back = nullptr; } } @@ -1473,7 +1474,7 @@ AABTreeIterator::AABTreeIterator(AABTreeCullSystemClass * tree) : Tree(tree), CurNodeIndex(0) { - WWASSERT(Tree != NULL); + WWASSERT(Tree != nullptr); } void AABTreeIterator::Reset(void) @@ -1507,7 +1508,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 +1534,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 +1550,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 7d0928bc5a..fc916bbffc 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h +++ b/Core/Libraries/Source/WWVegas/WWMath/aabtreecull.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "cullsys.h" #include "aaplane.h" @@ -326,7 +327,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 66e63353cd..3a94671a51 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 ad0a835479..effbb78a53 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/cullsys.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/cullsys.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "cullsys.h" #include "wwdebug.h" #include "wwprofile.h" @@ -45,8 +46,8 @@ ** *************************************************************************/ CullableClass::CullableClass(void) : - CullLink(NULL), - NextCollected(NULL) + CullLink(nullptr), + NextCollected(nullptr) { CullBox.Init(Vector3(0,0,0),Vector3(1,1,1)); } @@ -56,7 +57,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 +71,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 +89,7 @@ CullSystemClass * CullableClass::Get_Culling_System(void) const if (CullLink) { return CullLink->Get_Culling_System(); } - return NULL; + return nullptr; } @@ -101,7 +102,7 @@ CullSystemClass * CullableClass::Get_Culling_System(void) const ** *************************************************************************/ CullSystemClass::CullSystemClass(void) : - CollectionHead(NULL) + CollectionHead(nullptr) { } @@ -118,10 +119,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 +132,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 38a201d8ba..7af64a1248 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/cullsys.h +++ b/Core/Libraries/Source/WWVegas/WWMath/cullsys.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "stdlib.h" @@ -55,7 +56,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 +107,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 353fa6d22f..1ad94705ae 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 6fdad67be3..faa804aa58 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/curve.h +++ b/Core/Libraries/Source/WWVegas/WWMath/curve.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "Vector.h" @@ -116,7 +117,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 b4289656c6..ec61e58c20 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/gridcull.cpp @@ -54,6 +54,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "gridcull.h" #include "chunkio.h" #include "iostruct.h" @@ -116,8 +117,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 +154,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 +180,7 @@ GridCullSystemClass::GridCullSystemClass(void) : GridCullSystemClass::~GridCullSystemClass(void) { delete Cells; - Cells = NULL; + Cells = nullptr; } @@ -477,7 +478,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 +640,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 +750,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 +780,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 +817,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 +887,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 +953,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 +966,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 +979,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 +992,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 +1005,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 18d9d9f886..a24f353255 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/gridcull.h +++ b/Core/Libraries/Source/WWVegas/WWMath/gridcull.h @@ -52,6 +52,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "cullsys.h" #include "mempool.h" @@ -270,7 +271,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 +413,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 +445,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 e5f4150d6e..13ad6c35e1 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 139c782cfd..dd47897bd0 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/lookuptable.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/lookuptable.cpp @@ -36,6 +36,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "lookuptable.h" #include "curve.h" #include "WWFILE.h" @@ -83,8 +84,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 +126,7 @@ void LookupTableMgrClass::Shutdown(void) void LookupTableMgrClass::Reset(void) { - while (Tables.Peek_Head() != NULL) { + while (Tables.Peek_Head() != nullptr) { Tables.Release_Head(); } } @@ -151,7 +152,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 +160,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 +207,7 @@ void LookupTableMgrClass::Load_Table_Desc Vector2 * set_max_corner ) { - *curve_ptr = NULL; + *curve_ptr = nullptr; PersistFactoryClass * factory; float xmin,xmax; @@ -218,8 +219,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 +239,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 c37923f4d7..509f2c6030 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/lookuptable.h +++ b/Core/Libraries/Source/WWVegas/WWMath/lookuptable.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "simplevec.h" @@ -143,8 +144,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 e3c3c46c10..3d15fa3ae7 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp @@ -55,6 +55,7 @@ * Matrix3D::Solve_Linear_System -- 3x3 Gauss-Jordan elimination * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "matrix3d.h" #include @@ -638,7 +639,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 +696,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 4e3f7f141c..2d9332bd1e 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/obbox.h +++ b/Core/Libraries/Source/WWVegas/WWMath/obbox.h @@ -42,6 +42,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector3.h" @@ -211,7 +212,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 4889b11c55..ed6d4be15d 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/ode.cpp +++ b/Core/Libraries/Source/WWVegas/WWMath/ode.cpp @@ -39,6 +39,7 @@ * Runge_Kutta5_Integrate -- 5th order Runge-Kutta * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "ode.h" #include @@ -71,7 +72,7 @@ static StateVectorClass _WorkVector7; *=============================================================================================*/ void IntegrationSystem::Euler_Integrate(ODESystemClass * sys, float dt) { - WWASSERT(sys != NULL); + WWASSERT(sys != nullptr); /* ** Get the current state @@ -90,7 +91,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 +140,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 +209,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;i #include "quat.h" #include "matrix3d.h" #include "matrix4.h" @@ -545,7 +546,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/Libraries/Source/WWVegas/WWMath/quat.h b/Core/Libraries/Source/WWVegas/WWMath/quat.h index 7a7f28e9d1..4c7d2547ca 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/quat.h +++ b/Core/Libraries/Source/WWVegas/WWMath/quat.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwmath.h" @@ -255,7 +256,7 @@ WWINLINE Vector3 Quaternion::Rotate_Vector(const Vector3 & v) const WWINLINE 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/Libraries/Source/WWVegas/WWMath/vector2.h b/Core/Libraries/Source/WWVegas/WWMath/vector2.h index 9ba45fe4d4..442b0c2941 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/vector2.h +++ b/Core/Libraries/Source/WWVegas/WWMath/vector2.h @@ -50,6 +50,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwmath.h" @@ -656,7 +657,7 @@ WWINLINE float Distance(float x1, float y1, float x2, float y2) *=============================================================================================*/ WWINLINE 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/Libraries/Source/WWVegas/WWMath/vector3.h b/Core/Libraries/Source/WWVegas/WWMath/vector3.h index efd75af2fd..806037f083 100644 --- a/Core/Libraries/Source/WWVegas/WWMath/vector3.h +++ b/Core/Libraries/Source/WWVegas/WWMath/vector3.h @@ -64,6 +64,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwmath.h" @@ -534,7 +535,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 +565,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 +586,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 eb0def8925..9d55687771 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 bf883471fc..8cc6313026 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 056180c003..6f43297a3a 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "definitionmgr.h" #include "definition.h" #include "definitionfactory.h" @@ -73,7 +74,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 +109,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 +122,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 +163,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 +181,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 +193,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 +204,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 +226,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 nullptr 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 +239,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 +267,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 +300,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 +324,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 +345,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 +365,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 +408,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 +446,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 +476,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 +490,7 @@ DefinitionMgrClass::Free_Definitions (void) delete _SortedDefinitionArray[index]; } delete [] _SortedDefinitionArray; - _SortedDefinitionArray = NULL; + _SortedDefinitionArray = nullptr; _MaxDefinitionCount = 0; _DefinitionCount = 0; } @@ -538,8 +539,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 +560,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 +635,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 +645,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 +742,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 +790,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 +869,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 +889,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 +924,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 ade932edbd..a1b365e4da 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/definitionmgr.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "saveload.h" @@ -168,7 +169,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 059b5dcf9a..446d9ee488 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 534e0ada3b..e8adf404bc 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 686bf88c29..f7b3c18679 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameter.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include @@ -115,7 +116,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 +160,7 @@ class ParameterClass ////////////////////////////////////////////////////////////////////////////////// inline ParameterClass::ParameterClass (void) - : m_Name (NULL), + : m_Name (nullptr), IsModified (false) { return ; @@ -170,7 +171,7 @@ ParameterClass::ParameterClass (void) ////////////////////////////////////////////////////////////////////////////////// inline ParameterClass::ParameterClass (const ParameterClass &src) - : m_Name (NULL), + : m_Name (nullptr), IsModified (false) { (*this) = src; @@ -183,7 +184,7 @@ ParameterClass::ParameterClass (const ParameterClass &src) inline ParameterClass::~ParameterClass (void) { - Set_Name (NULL); + Set_Name (nullptr); return ; } @@ -213,12 +214,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 +469,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 80ba4a737f..12fd560eaa 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/parameterlist.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "Vector.h" @@ -103,8 +104,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 +121,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 ca81e905c5..9dc1283f98 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 0599936a17..d45822f80d 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 21dc60f1bf..27396eb04d 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 nullptr, 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 004d09544c..f9ec9aa974 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.cpp +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "saveload.h" #include "saveloadsubsystem.h" #include "persist.h" @@ -50,8 +51,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 +83,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 +100,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 +135,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 +151,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 +161,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 +175,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 +188,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 +201,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 +241,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 +251,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 +282,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 05ac8b6e08..fc3049d76d 100644 --- a/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h +++ b/Core/Libraries/Source/WWVegas/WWSaveLoad/saveload.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "pointerremap.h" @@ -160,8 +161,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 d45322be8a..831ef841d7 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 8e782eb186..87a5807cfe 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 d250ae52f1..eb4ea7ec38 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 3103aff21c..903b170c45 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 09bc9b67d9..1a7bcb778c 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")) { diff --git a/Core/Libraries/Source/debug/debug_debug.cpp b/Core/Libraries/Source/debug/debug_debug.cpp index 5bc38c7c5b..7e80be30b5 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="[nullptr]"; 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) << "nullptr"; 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 956fa6f229..66bc1e434b 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 nullptr) 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 c1e7c16457..d3489edbe0 100644 --- a/Core/Libraries/Source/debug/debug_dlg/debug_dlg.cpp +++ b/Core/Libraries/Source/debug/debug_dlg/debug_dlg.cpp @@ -28,6 +28,7 @@ ////////////////////////////////////////////////////////////////////////////// #define STRICT #define WIN32_LEAN_AND_MEAN +#include #include #include #include @@ -138,7 +139,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 +181,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 098e1b9bf8..3875c3322d 100644 --- a/Core/Libraries/Source/debug/debug_except.cpp +++ b/Core/Libraries/Source/debug/debug_except.cpp @@ -26,6 +26,8 @@ // // Unhandled exception handler ////////////////////////////////////////////////////////////////////////////// +#include + #include "debug.h" #include "internal_except.h" #include @@ -235,7 +237,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 +326,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 +352,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 +413,7 @@ LONG __stdcall DebugExceptionhandler::ExceptionFilter(struct _EXCEPTION_POINTERS // Show a dialog box InitCommonControls(); exPtrs=pExPtrs; - DialogBoxIndirect(NULL,(LPDLGTEMPLATE)rcException,NULL,ExceptionDlgProc); + DialogBoxIndirect(nullptr,(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 0f61056232..dd3bbaa379 100644 --- a/Core/Libraries/Source/debug/debug_internal.cpp +++ b/Core/Libraries/Source/debug/debug_internal.cpp @@ -26,6 +26,8 @@ // // Implementation of internal code ////////////////////////////////////////////////////////////////////////////// + +#include #include "debug.h" #include @@ -35,7 +37,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 +54,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 nullptr 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 f1d14a7ec5..47a0681008 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 3319496c0e..f8cbd2a286 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 eec7cd31f6..8bfed49b0d 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")) { // 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 ebb8bdba6a..09ff0b6f94 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 b4b0f07400..5e32bd5f10 100644 --- a/Core/Libraries/Source/debug/debug_macro.h +++ b/Core/Libraries/Source/debug/debug_macro.h @@ -28,6 +28,7 @@ ////////////////////////////////////////////////////////////////////////////// #pragma once +#include // I'm putting the documentation for the following macros // here because Doxygen otherwise includes the values of each macro @@ -153,7 +154,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 nullptr") return; \endcode \param cond condition which is checked for failure @@ -328,7 +329,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 +350,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 5864566133..cff8de842a 100644 --- a/Core/Libraries/Source/debug/debug_stack.cpp +++ b/Core/Libraries/Source/debug/debug_stack.cpp @@ -26,6 +26,8 @@ // // Stack walker ////////////////////////////////////////////////////////////////////////////// + +#include #include "debug.h" #include "debug_stack.h" #include @@ -53,7 +55,7 @@ static union static char const *const DebughelpFunctionNames[] = { #include "debug_stack.inl" - NULL + nullptr }; #undef DBGHELP @@ -71,7 +73,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 +102,7 @@ static void InitDbghelp(void) { // not all functions found -> clear them all while (funcptr!=gDbg.funcPtr) - *--funcptr=NULL; + *--funcptr=0; } else { @@ -108,7 +110,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 +382,7 @@ int DebugStackwalk::StackWalk(Signature &sig, struct _CONTEXT *ctx) bool skipFirst=!ctx; while (sig.m_numAddr + // make sure we're not omitting the frame pointer #pragma optimize("y",off) @@ -66,7 +68,7 @@ void *DebugAllocMemory(unsigned numBytes); given size. This function performs a controlled crash on failure. - \param oldPtr pointer to old memory block, may be NULL + \param oldPtr pointer to old memory block, may be nullptr \param newSize new size of block \return pointer to reallocated memory */ diff --git a/Core/Libraries/Source/debug/internal_io.h b/Core/Libraries/Source/debug/internal_io.h index ddb0b18693..3b2f9621ec 100644 --- a/Core/Libraries/Source/debug/internal_io.h +++ b/Core/Libraries/Source/debug/internal_io.h @@ -28,6 +28,7 @@ ////////////////////////////////////////////////////////////////////////////// #pragma once +#include #include @@ -130,7 +131,7 @@ class DebugIOFlat: public DebugIOInterface \param path optional path to a destination directory */ - void Delete(const char *path=NULL); + void Delete(const char *path=nullptr); /** \brief Determines name of output stream. @@ -203,7 +204,7 @@ class DebugIOFlat: public DebugIOInterface \brief Expands a magic filename into a real filename. \param src magic filename or real filename - \param splitName split name, NULL for default stream + \param splitName split name, nullptr for default stream \param buf output buffer, must have a size of at least 256 char's */ static void ExpandMagic(const char *src, const char *splitName, char *buf); diff --git a/Core/Libraries/Source/debug/netserv/netserv.cpp b/Core/Libraries/Source/debug/netserv/netserv.cpp index 63c1d806f4..88983b5ae1 100644 --- a/Core/Libraries/Source/debug/netserv/netserv.cpp +++ b/Core/Libraries/Source/debug/netserv/netserv.cpp @@ -28,6 +28,7 @@ ////////////////////////////////////////////////////////////////////////////// #define STRICT #define WIN32_LEAN_AND_MEAN +#include #include #include @@ -159,7 +160,7 @@ class Pipe public: Pipe(void): m_pipe(INVALID_HANDLE_VALUE), - m_src(NULL), m_str(NULL), m_stringType(0) + m_src(nullptr), m_str(nullptr), m_stringType(0) { } @@ -179,7 +180,7 @@ class Pipe m_pipe=CreateNamedPipe(name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE|PIPE_READMODE_MESSAGE|PIPE_NOWAIT, - PIPE_UNLIMITED_INSTANCES,1024,1024,0,NULL); + PIPE_UNLIMITED_INSTANCES,1024,1024,0,nullptr); m_connected=false; return m_pipe!=INVALID_HANDLE_VALUE; } @@ -188,11 +189,11 @@ class Pipe { if (!m_connected) { - ConnectNamedPipe(m_pipe,NULL); + ConnectNamedPipe(m_pipe,nullptr); if (GetLastError()==ERROR_PIPE_CONNECTED) { DWORD dwDummy; - WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),"\n\n",11,&dwDummy,NULL); + WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),"\n\n",11,&dwDummy,nullptr); m_connected=true; m_state=0; } @@ -203,13 +204,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 +220,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 +237,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 +256,7 @@ class Pipe m_state=0; return m_str; } - return NULL; + return nullptr; } if (GetLastError()==ERROR_BROKEN_PIPE) @@ -263,11 +264,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 +281,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 +289,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 +311,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 b8352794da..f06c716958 100644 --- a/Core/Libraries/Source/debug/test2/test2.cpp +++ b/Core/Libraries/Source/debug/test2/test2.cpp @@ -27,6 +27,7 @@ // Debug module - Test 2 (Checking commands, CON I/O, cmddbg file) ////////////////////////////////////////////////////////////////////////////// +#include #include "StdAfx.h" #include "resource.h" #include "../debug.h" @@ -54,7 +55,7 @@ class TestCmdInterface: public DebugCmdInterface if (strcmp(cmd,"box")) return false; - MessageBox(NULL,"Hello world!","Command",MB_OK); + MessageBox(nullptr,"Hello world!","Command",MB_OK); return true; } @@ -89,7 +90,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 +129,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 +155,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 +163,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 e9229dbf22..3b48bdd304 100644 --- a/Core/Libraries/Source/profile/internal_funclevel.h +++ b/Core/Libraries/Source/profile/internal_funclevel.h @@ -28,6 +28,7 @@ ////////////////////////////////////////////////////////////////////////////// #pragma once +#include #include @@ -176,7 +177,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 2d9c572755..f6f098ad14 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 a62f082a39..960db4a3de 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 (nullptr 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 b7fb9ad86c..4935d828f6 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 nullptr 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 92dde861b8..b087c8a6fa 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 69fa7c5e93..4810cc0c88 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 3c7110ca2f..fe5129fe6a 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 afe2227b0f..b36d583cf9 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 bc418d6fdd..96642f0d59 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 dea386181b..4102484762 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 cec326936a..5174831adc 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 ce3ec5c4ee..37fa9f9238 100644 --- a/Core/Tools/Autorun/ARGS.cpp +++ b/Core/Tools/Autorun/ARGS.cpp @@ -34,6 +34,7 @@ // INCLUDES //----------------------------------------------------------------------------- #define STRICT +#include #include #include #include @@ -46,7 +47,7 @@ // GLOBALS //----------------------------------------------------------------------------- -Command_Line_Arguments *Args = NULL; +Command_Line_Arguments *Args = nullptr; //***************************************************************************** // COMMAND_LINE_ARGUMENTS::COMMAND_LINE_ARGUMENTS -- Constructor. @@ -69,7 +70,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 +173,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 +330,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 7d9f981a97..bfff45cb97 100644 --- a/Core/Tools/Autorun/CDCNTRL.cpp +++ b/Core/Tools/Autorun/CDCNTRL.cpp @@ -60,6 +60,7 @@ * CDControlClass::~CDControlClass -- Class destructor * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "assert.h" #include "CDCNTRL.h" #include "WinFix.h" @@ -220,7 +221,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 +274,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 +309,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 +336,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 +368,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 +394,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 +912,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 +1087,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 +1096,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 1bbaac4a92..5920c3a364 100644 --- a/Core/Tools/Autorun/CallbackHook.h +++ b/Core/Tools/Autorun/CallbackHook.h @@ -34,6 +34,7 @@ ******************************************************************************/ #pragma once +#include class CallbackHook { @@ -68,7 +69,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 edd7009682..23dbc5ca2f 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 444b9ad9fd..0c00ac410f 100644 --- a/Core/Tools/Autorun/EZGIMEX.cpp +++ b/Core/Tools/Autorun/EZGIMEX.cpp @@ -49,10 +49,11 @@ /* And increase stream buffer */ /* - setvbuf(f, NULL, _IOFBF, FILE_BUFFER_SIZE); + setvbuf(f, nullptr, _IOFBF, FILE_BUFFER_SIZE); */ #define __NOINLINE__ 1 +#include #include #include #include @@ -151,13 +152,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 f0d56b1775..5ab3188199 100644 --- a/Core/Tools/Autorun/GETCD.cpp +++ b/Core/Tools/Autorun/GETCD.cpp @@ -30,6 +30,7 @@ * CD_Volume_Verification -- Check label of the CDRom. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#include #include #include //#include "always.h" @@ -184,10 +185,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 +213,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 +271,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 +282,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 +297,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 +362,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 +382,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 f961646d97..d6502b4f72 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 7ea522b054..b6f81d20b5 100644 --- a/Core/Tools/Autorun/IGR.cpp +++ b/Core/Tools/Autorun/IGR.cpp @@ -22,6 +22,7 @@ // JeffB 7/5/00 // +#include #include #include #include @@ -29,7 +30,7 @@ #include "IGR.h" -IGROptionsClass *OnlineOptions = NULL; +IGROptionsClass *OnlineOptions = nullptr; /********************************************************************************************* @@ -66,7 +67,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 +162,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 acfbeceef2..5d5e06ac30 100644 --- a/Core/Tools/Autorun/Jsupport.cpp +++ b/Core/Tools/Autorun/Jsupport.cpp @@ -22,12 +22,12 @@ #include #include "JSUPPORT.h" -// ‘O’u‹Ö‘¥•¶Žš +// �O�u�֑����� // Can't set these characters on top of line static BOOL IsDBCSInvalidAtTop(unsigned int c) { - static BYTE * dtbl = (BYTE *)"‘‹fhñŒŽABXrtvxzl‚Ÿ‚¡‚£‚¥‚§‚Á‚á‚ã‚å‚ìJKTUƒ@ƒBƒDƒFƒHƒbƒƒƒ…ƒ‡ƒŽƒ•ƒ–E[RSI“jCDFGHnp"; - static BYTE * stbl = (BYTE *)"!%),.:;?]}¡£¤¥Þß"; + static BYTE * dtbl = (BYTE *)"�����f�h�ñŒï¿½ï¿½ï¿½ï¿½A�B�X�r�t�v�x�z�l�����������������J�K�T�U�@�B�D�F�H�b�������������E�[�R�S�I���j�C�D�F�G�H�n�p"; + static BYTE * stbl = (BYTE *)"!%),.:;?]}������"; if(c<0x100) { @@ -50,12 +50,12 @@ static BOOL IsDBCSInvalidAtTop(unsigned int c) return FALSE; } -// Œã’u‹Ö‘¥•¶Žš +// ��u�֑����� // Can't set these characters on end of line static BOOL IsDBCSInvalidAtEnd( unsigned int c ) { - static BYTE * dtbl = (BYTE *)"egqsuwykimo’"; - static BYTE * stbl = (BYTE *)"¢({["; + static BYTE * dtbl = (BYTE *)"�e�g�q�s�u�w�y�k�i�m�o������"; + static BYTE * stbl = (BYTE *)"�({["; if(c<0x100) { @@ -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 73aa3aafbf..487e3efa30 100644 --- a/Core/Tools/Autorun/Locale_API.cpp +++ b/Core/Tools/Autorun/Locale_API.cpp @@ -34,6 +34,7 @@ * *****************************************************************************/ +#include #include "locale.h" #include "Locale_API.h" #include "Utils.h" @@ -94,7 +95,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 +145,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 +177,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 +226,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 +248,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 +292,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 +322,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 +357,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 +374,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 +393,7 @@ wchar_t *Remove_Quotes_Around_String ( wchar_t *old_string ) int length; //---------------------------------------------------------------------- - // If string is not NULL... + // If string is not nullptr... //---------------------------------------------------------------------- if ( *letter == '"' ) { diff --git a/Core/Tools/Autorun/Locale_API.h b/Core/Tools/Autorun/Locale_API.h index 73cd605453..920d6a4873 100644 --- a/Core/Tools/Autorun/Locale_API.h +++ b/Core/Tools/Autorun/Locale_API.h @@ -35,6 +35,7 @@ *************************************************************************************************/ #pragma once +#include #include @@ -53,10 +54,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 0bd028d7cb..2262d78b01 100644 --- a/Core/Tools/Autorun/RECT.h +++ b/Core/Tools/Autorun/RECT.h @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include "POINT.h" @@ -257,10 +258,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 +291,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 0c3652ec9a..73c804adb8 100644 --- a/Core/Tools/Autorun/TTFont.cpp +++ b/Core/Tools/Autorun/TTFont.cpp @@ -47,6 +47,7 @@ #define STRICT +#include #include #include #include @@ -68,14 +69,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 +143,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 +152,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 +181,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 +197,7 @@ TTFontClass::TTFontClass( SelectObject( hdc, old_object ); DeleteObject( Font ); - Font = NULL; + Font = nullptr; Font = CreateFont( height, // height of font @@ -335,14 +336,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 +379,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 +393,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 +433,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 +502,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 +537,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 +678,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 +704,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 +730,7 @@ Point2D TTFontClass::Print( //-------------------------------------------------------------------------- if ( hdc ) { - assert( Font != NULL ); + assert( Font != nullptr ); old_object = SelectObject( hdc, Font ); @@ -747,7 +748,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 +818,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 +849,7 @@ Point2D TTFontClass::Print( //-------------------------------------------------------------------------- if ( hdc ) { - assert( Font != NULL ); + assert( Font != nullptr ); old_object = SelectObject( hdc, Font ); @@ -1047,14 +1048,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 +1224,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 +1352,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 +1400,10 @@ FontManagerClass::FontManagerClass ( HDC hdc ) FontManagerClass::~FontManagerClass ( void ) { delete TTButtonFontPtr; - TTButtonFontPtr = NULL; + TTButtonFontPtr = nullptr; delete TTTextFontPtr; - TTTextFontPtr = NULL; + TTTextFontPtr = nullptr; } @@ -1423,7 +1424,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 56138857bf..b074b5bcb9 100644 --- a/Core/Tools/Autorun/TTFont.h +++ b/Core/Tools/Autorun/TTFont.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ #pragma once +#include #include #include "POINT.h" @@ -204,15 +205,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 +223,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 e40fb229d7..554e4d8a1a 100644 --- a/Core/Tools/Autorun/Utils.cpp +++ b/Core/Tools/Autorun/Utils.cpp @@ -68,6 +68,7 @@ * Remove_Spaces -- Remove spaces from string passed in. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#include #include #include "ARGS.h" #include "assert.h" @@ -89,7 +90,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 +193,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 +255,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 +263,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 +272,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 +288,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 +313,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 +348,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 +366,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 +393,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 +403,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 +427,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 +437,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 +461,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 +481,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 +534,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 +556,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 +609,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 +629,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 dd0bc246c5..009bcf009e 100644 --- a/Core/Tools/Autorun/ViewHTML.cpp +++ b/Core/Tools/Autorun/ViewHTML.cpp @@ -33,6 +33,7 @@ ******************************************************************************/ #pragma warning(disable : 4201 4310) +#include #include #include "ViewHTML.h" @@ -53,7 +54,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 +71,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 +112,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 +127,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 +158,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 d98795e10d..69b2574d17 100644 --- a/Core/Tools/Autorun/WSYS_FileSystem.cpp +++ b/Core/Tools/Autorun/WSYS_FileSystem.cpp @@ -39,6 +39,7 @@ // Includes //---------------------------------------------------------------------------- +#include #include "WSYS_FileSystem.h" #include "WSYS_StdFileSystem.h" @@ -86,7 +87,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 7906b70da7..03ba5cde1f 100644 --- a/Core/Tools/Autorun/WSYS_FileSystem.h +++ b/Core/Tools/Autorun/WSYS_FileSystem.h @@ -36,6 +36,7 @@ //---------------------------------------------------------------------------- #pragma once +#include //---------------------------------------------------------------------------- // Includes @@ -73,7 +74,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 804fafc41b..b1d7031abb 100644 --- a/Core/Tools/Autorun/WSYS_RAMFile.cpp +++ b/Core/Tools/Autorun/WSYS_RAMFile.cpp @@ -39,6 +39,7 @@ // Includes //---------------------------------------------------------------------------- +#include #include #include #include @@ -95,7 +96,7 @@ RAMFile::RAMFile() : m_size(0), - m_data(NULL) + m_data() { } @@ -132,7 +133,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 +153,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 +169,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 +179,7 @@ Bool RAMFile::open( File *file ) if ( m_size < 0 ) { delete [] m_data; - m_data = NULL; + m_data = nullptr; return FALSE; } @@ -199,7 +200,7 @@ Bool RAMFile::open( File *file ) void RAMFile::close( void ) { delete [] m_data; - m_data = NULL; + m_data = nullptr; File::close(); } @@ -210,7 +211,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 15698cd1c0..e3f50073ef 100644 --- a/Core/Tools/Autorun/WSYS_StdFileSystem.cpp +++ b/Core/Tools/Autorun/WSYS_StdFileSystem.cpp @@ -39,6 +39,7 @@ // Includes //---------------------------------------------------------------------------- +#include #include "WSYS_StdFileSystem.h" #include "WSYS_StdFile.h" @@ -115,7 +116,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 34cd965d82..c9d91fc0f9 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 85e093aaa0..f696e2f994 100644 --- a/Core/Tools/Autorun/WinFix.cpp +++ b/Core/Tools/Autorun/WinFix.cpp @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #define STRICT +#include #include #include #pragma hdrstop @@ -93,9 +94,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 +192,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 0db0ade184..623c376ad6 100644 --- a/Core/Tools/Autorun/Wnd_file.cpp +++ b/Core/Tools/Autorun/Wnd_file.cpp @@ -41,6 +41,7 @@ //----------------------------------------------------------------------------- // include files... //----------------------------------------------------------------------------- +#include #include "windows.h" #include #include @@ -132,7 +133,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 +204,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 +215,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 +241,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 +307,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 +348,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 +371,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 +419,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 +476,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 +489,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 +570,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 +592,7 @@ bool StandardFileClass::Close( void ) // // reset file data // - File_Stream_Ptr = NULL; + File_Stream_Ptr = nullptr; Currently_Open = FALSE; // @@ -619,7 +620,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 +645,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 +691,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 +725,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 +789,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 +854,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 +907,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 +975,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 +989,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 +1000,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 +1032,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 +1083,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 +1132,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 +1150,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 +1181,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 +1191,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 +1200,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 +1227,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 +1237,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 +1246,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 +1278,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 +1295,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 +1303,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 +1325,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 +1337,7 @@ int Tell_File( HANDLE handle ) // pos = SetFilePointer( handle, 0, // distance to move - NULL, + nullptr, move_method ); if ( pos == 0xFFFFFFFF ) { @@ -1357,9 +1358,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 +1387,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 +1425,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 +1464,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 +1518,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 +1527,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 +1554,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 +1573,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 +1598,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 fefdd6ed6e..95edaf2b8c 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 nullptr. 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 nullptr. 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) + strcpy( szUninstallPath, aName ); + sp = strchr(szUninstallPath,'/'); + 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 65a10e1124..4370dd5528 100644 --- a/Core/Tools/Autorun/autorun.h +++ b/Core/Tools/Autorun/autorun.h @@ -35,6 +35,7 @@ *************************************************************************************************/ #pragma once +#include #include #include @@ -165,7 +166,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 +229,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 1abc9cf103..92ed05d014 100644 --- a/Core/Tools/Autorun/locale.cpp +++ b/Core/Tools/Autorun/locale.cpp @@ -18,6 +18,7 @@ /* Copyright (C) Electronic Arts Canada Inc. 1998-1999. All rights reserved. */ +#include #include #include #include "gimex.h" /* for file and memory IO only */ @@ -91,7 +92,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 +101,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 +149,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 +199,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 +214,7 @@ void LOCALE_restore(void) /* free instance */ gfree(lx); - lx = NULL; + lx = nullptr; } } @@ -508,7 +509,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 +568,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 +638,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 +715,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 +732,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 +767,7 @@ const char* LOCALE_getstring( int StringID ) } else { - p = NULL; + p = nullptr; } Msg( __LINE__, __FILE__, L"%s", 1252, (wchar_t *)p ); @@ -823,12 +824,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 +857,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 fede71fa44..48e278e726 100644 --- a/Core/Tools/Babylon/Babylon.cpp +++ b/Core/Tools/Babylon/Babylon.cpp @@ -19,6 +19,7 @@ // Babylon.cpp : Defines the class behaviors for the application. // +#include #include "StdAfx.h" #include "Babylon.h" #include "BabylonDlg.h" @@ -35,11 +36,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 +63,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 +209,7 @@ BOOL CALLBACK EnumAllWindowsProc(HWND hWnd, LPARAM lParam) return FALSE; } - FoundWindow = NULL; + FoundWindow = nullptr; return TRUE; } @@ -227,7 +228,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 0b40dbc28b..1c27f6fdcd 100644 --- a/Core/Tools/Babylon/BabylonDlg.cpp +++ b/Core/Tools/Babylon/BabylonDlg.cpp @@ -20,6 +20,7 @@ // BabylonDlg.cpp : implementation file // +#include #include "StdAfx.h" #include "Babylon.h" #include "BabylonDlg.h" @@ -196,7 +197,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 +205,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 +267,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 +428,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 +452,7 @@ BOOL CBabylonDlg::CanExit() //DEL } //DEL else //DEL { -//DEL SelectFile ( NULL ); +//DEL SelectFile ( nullptr ); //DEL } //DEL delete dlg; //DEL } @@ -684,7 +685,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 +760,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 +836,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 +1038,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 +1129,7 @@ int CBabylonDlg::LoadStrFile ( TransDB *db, const char *filename, void (*cb) ( v { cb (); } - label = NULL; + label = nullptr; } status = TRUE; @@ -1555,7 +1556,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 +2077,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 +2129,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 +2160,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 +2176,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 +2497,7 @@ void CBabylonDlg::OnTranslations() void CBabylonDlg::OnSelchangeCombolang() { - LANGINFO *info = NULL; + LANGINFO *info = nullptr; int index; index = combo->GetCurSel (); @@ -2557,7 +2557,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 677e782611..2a2d823cd5 100644 --- a/Core/Tools/Babylon/BabylonDlg.h +++ b/Core/Tools/Babylon/BabylonDlg.h @@ -20,6 +20,7 @@ // #pragma once +#include #include "resource.h" #include "TransDB.h" @@ -90,9 +91,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/CMakeLists.txt b/Core/Tools/Babylon/CMakeLists.txt index a85ee41a72..d72bdecf46 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 + core_utility ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/Core/Tools/Babylon/DlgProxy.cpp b/Core/Tools/Babylon/DlgProxy.cpp index 6442aa5c77..55cbb4e2a6 100644 --- a/Core/Tools/Babylon/DlgProxy.cpp +++ b/Core/Tools/Babylon/DlgProxy.cpp @@ -19,6 +19,7 @@ // DlgProxy.cpp : implementation file // +#include #include "StdAfx.h" #include "Babylon.h" #include "DlgProxy.h" @@ -47,7 +48,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 +60,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 991bc7a803..f6d44ee59e 100644 --- a/Core/Tools/Babylon/ExportDlg.cpp +++ b/Core/Tools/Babylon/ExportDlg.cpp @@ -19,6 +19,7 @@ // ExportDlg.cpp : implementation file // +#include #include "StdAfx.h" #include "Babylon.h" #include "ExportDlg.h" @@ -36,7 +37,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 +150,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 +199,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 af799753f6..48584984e3 100644 --- a/Core/Tools/Babylon/ExportDlg.h +++ b/Core/Tools/Babylon/ExportDlg.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ExportDlg.h : header file // @@ -40,7 +41,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 aa7adfa2f4..b54905f3cf 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 1be84d2b50..4e5f7cc85e 100644 --- a/Core/Tools/Babylon/GenerateDlg.h +++ b/Core/Tools/Babylon/GenerateDlg.h @@ -17,6 +17,7 @@ */ #pragma once +#include // GenerateDlg.h : header file // @@ -43,7 +44,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 a01c513aeb..615444ec3a 100644 --- a/Core/Tools/Babylon/MatchDlg.cpp +++ b/Core/Tools/Babylon/MatchDlg.cpp @@ -19,6 +19,7 @@ // MatchDlg.cpp : implementation file // +#include #include "StdAfx.h" #include "Babylon.h" #include "MatchDlg.h" @@ -29,18 +30,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 +75,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 +113,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 +150,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 +174,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 56fa8dacc0..dcb7b7d208 100644 --- a/Core/Tools/Babylon/MatchDlg.h +++ b/Core/Tools/Babylon/MatchDlg.h @@ -17,6 +17,7 @@ */ #pragma once +#include // MatchDlg.h : header file // @@ -31,7 +32,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 46bf943fd7..30ceb05a44 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 ee42c7809b..a1e5e1b4dc 100644 --- a/Core/Tools/Babylon/ProceedDlg.h +++ b/Core/Tools/Babylon/ProceedDlg.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ProceedDlg.h : header file // @@ -30,7 +31,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 5fe3a77047..02e25213c5 100644 --- a/Core/Tools/Babylon/Report.cpp +++ b/Core/Tools/Babylon/Report.cpp @@ -19,6 +19,7 @@ // Report.cpp : implementation file // +#include #include "StdAfx.h" #include "Babylon.h" #include "Report.h" @@ -34,7 +35,7 @@ static char THIS_FILE[] = __FILE__; // CReport dialog -CReport::CReport(CWnd* pParent /*=NULL*/) +CReport::CReport(CWnd* pParent /*=nullptr*/) : CDialog(CReport::IDD, pParent) { @@ -170,7 +171,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 93a66d12cd..53e02cfd9b 100644 --- a/Core/Tools/Babylon/Report.h +++ b/Core/Tools/Babylon/Report.h @@ -17,6 +17,7 @@ */ #pragma once +#include // Report.h : header file // @@ -44,7 +45,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 d586c668a8..5b1506e1eb 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 4c7354ff65..94b3036408 100644 --- a/Core/Tools/Babylon/RetranslateDlg.h +++ b/Core/Tools/Babylon/RetranslateDlg.h @@ -17,6 +17,7 @@ */ #pragma once +#include // RetranslateDlg.h : header file // @@ -34,7 +35,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 ac462c927c..f5f207e4d5 100644 --- a/Core/Tools/Babylon/TransDB.cpp +++ b/Core/Tools/Babylon/TransDB.cpp @@ -20,6 +20,7 @@ // TransDB.cpp // +#include #include "StdAfx.h" #include "TransDB.h" #include "BabylonDlg.h" @@ -44,7 +45,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 +56,7 @@ LANGINFO *GetLangInfo ( int index ) return &langinfo[index]; } - return NULL; + return nullptr; } LANGINFO *GetLangInfo ( LangID langid ) @@ -73,7 +74,7 @@ LANGINFO *GetLangInfo ( LangID langid ) item++; } - return NULL; + return nullptr; } const char *GetLangName ( LangID langid ) @@ -103,7 +104,7 @@ LANGINFO *GetLangInfo ( char *language ) item++; } - return NULL; + return nullptr; } TransDB* FirstTransDB ( void ) @@ -115,7 +116,7 @@ TransDB* FirstTransDB ( void ) { return (TransDB *) first->Item (); } - return NULL; + return nullptr; } TransDB::TransDB ( const char *cname ) @@ -199,7 +200,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 +264,7 @@ BabylonLabel* TransDB::FirstLabel ( ListSearch& sh ) return (BabylonLabel *) node->Item (); } - return NULL; + return nullptr; } BabylonLabel* TransDB::NextLabel ( ListSearch& sh) @@ -275,7 +276,7 @@ BabylonLabel* TransDB::NextLabel ( ListSearch& sh) return (BabylonLabel *) node->Item (); } - return NULL; + return nullptr; } BabylonText* TransDB::FirstObsolete ( ListSearch& sh ) @@ -287,7 +288,7 @@ BabylonText* TransDB::FirstObsolete ( ListSearch& sh ) return (BabylonText *) node->Item (); } - return NULL; + return nullptr; } BabylonText* TransDB::NextObsolete ( ListSearch& sh) @@ -299,7 +300,7 @@ BabylonText* TransDB::NextObsolete ( ListSearch& sh) return (BabylonText *) node->Item (); } - return NULL; + return nullptr; } BabylonLabel* TransDB::FindLabel ( OLECHAR *name ) @@ -346,7 +347,7 @@ BabylonText* TransDB::FindSubText ( OLECHAR *pattern, int item ) label = NextLabel ( sh ); } - return NULL; + return nullptr; } @@ -537,17 +538,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 +588,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 +668,7 @@ BabylonText* BabylonLabel::FirstText ( ListSearch& sh ) return (BabylonText *) node->Item (); } - return NULL; + return nullptr; } BabylonText* BabylonLabel::NextText ( ListSearch& sh) @@ -679,7 +680,7 @@ BabylonText* BabylonLabel::NextText ( ListSearch& sh) return (BabylonText *) node->Item (); } - return NULL; + return nullptr; } @@ -699,7 +700,7 @@ BabylonText* BabylonLabel::FindText ( OLECHAR *find_text ) txt = NextText ( sh ); } - return NULL; + return nullptr; } @@ -876,12 +877,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 +1088,7 @@ Translation* BabylonText::FirstTranslation ( ListSearch& sh ) return (Translation *) node->Item (); } - return NULL; + return nullptr; } Translation* BabylonText::NextTranslation ( ListSearch& sh) @@ -1099,7 +1100,7 @@ Translation* BabylonText::NextTranslation ( ListSearch& sh) return (Translation *) node->Item (); } - return NULL; + return nullptr; } Translation* BabylonText::GetTranslation ( LangID langid ) @@ -1471,7 +1472,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 nullptr", text->LineNumber()); dlg->Log ( buffer ); } diff --git a/Core/Tools/Babylon/TransDB.h b/Core/Tools/Babylon/TransDB.h index fd508f9e18..3989ef92ee 100644 --- a/Core/Tools/Babylon/TransDB.h +++ b/Core/Tools/Babylon/TransDB.h @@ -22,6 +22,7 @@ // #pragma once +#include #include "olestring.h" #include "list.h" @@ -123,7 +124,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 +136,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 +361,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 +393,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 98c051408d..bebb55de96 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 a9ea386653..23583788bb 100644 --- a/Core/Tools/Babylon/VIEWDBSII.h +++ b/Core/Tools/Babylon/VIEWDBSII.h @@ -17,6 +17,7 @@ */ #pragma once +#include // VIEWDBSII.h : header file // @@ -28,7 +29,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 b339d9ce5d..a1e0b87f88 100644 --- a/Core/Tools/Babylon/VerifyDlg.cpp +++ b/Core/Tools/Babylon/VerifyDlg.cpp @@ -19,6 +19,7 @@ // VerifyDlg.cpp : implementation file // +#include #include "StdAfx.h" #include "Babylon.h" #include "VerifyDlg.h" @@ -35,7 +36,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 +122,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 +212,7 @@ void VerifyDlg::CloseAudio ( void ) if ( stream ) { AIL_close_stream ( stream ); - stream = NULL; + stream = nullptr; } #endif } @@ -225,7 +226,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 04964b6f3f..38b8db5f49 100644 --- a/Core/Tools/Babylon/VerifyDlg.h +++ b/Core/Tools/Babylon/VerifyDlg.h @@ -17,6 +17,7 @@ */ #pragma once +#include // VerifyDlg.h : header file // @@ -41,7 +42,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 9725ad58ff..3df24bf744 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 fca1dda0fd..d25be45385 100644 --- a/Core/Tools/Babylon/VerifyTextDlg.h +++ b/Core/Tools/Babylon/VerifyTextDlg.h @@ -17,6 +17,7 @@ */ #pragma once +#include // VerifyTextDlg.h : header file // @@ -30,7 +31,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 2fd32722cc..fdc7d614f1 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 59be38979c..7df8f1a2f8 100644 --- a/Core/Tools/Babylon/XLStuff.cpp +++ b/Core/Tools/Babylon/XLStuff.cpp @@ -20,6 +20,7 @@ // XLStuff.cpp // // +#include #include "StdAfx.h" #include "Babylon.h" #include "resource.h" @@ -32,11 +33,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 +166,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 +238,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 +294,7 @@ int PutSection ( int row, OLECHAR *title ) border->SetWeight ( thin ); delete border; - border = NULL; + border = nullptr; dispatch = borders->GetItem ( xlEdgeTop ); @@ -309,7 +310,7 @@ int PutSection ( int row, OLECHAR *title ) border->SetWeight ( medium ); delete border; - border = NULL; + border = nullptr; dispatch = borders->GetItem ( xlEdgeRight ); @@ -323,7 +324,7 @@ int PutSection ( int row, OLECHAR *title ) border->SetLineStyle ( none ); delete border; - border = NULL; + border = nullptr; dispatch = borders->GetItem ( xlEdgeLeft ); @@ -462,16 +463,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 +480,7 @@ void CloseExcel ( void ) xl->Quit(); xl->ReleaseDispatch (); delete xl; - xl = NULL; + xl = nullptr; } VariantClear ( &nullstring ); @@ -599,7 +600,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 0116060b16..8d565dc88e 100644 --- a/Core/Tools/Babylon/bin.cpp +++ b/Core/Tools/Babylon/bin.cpp @@ -20,6 +20,7 @@ // Bin.cpp // +#include #include "StdAfx.h" #include "bin.h" #include "assert.h" @@ -29,7 +30,7 @@ Bin::Bin ( int size ) { assert ( size > 0 ); num_buckets = size; - sh_item = NULL; + sh_item = nullptr; bucket = new List[size]; @@ -48,7 +49,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 +72,7 @@ void* Bin::Get ( OLECHAR *text1, OLECHAR *text2 ) return item->Item(); } - return NULL; + return nullptr; } void* Bin::GetNext ( void ) @@ -83,7 +84,7 @@ void* Bin::GetNext ( void ) return item->Item(); } - return NULL; + return nullptr; } void Bin::Add ( void *data, OLECHAR *text1, OLECHAR *text2 ) @@ -92,7 +93,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 +150,7 @@ BinItem* Bin::GetNextBinItem ( void ) BinItem* Bin::GetBinItem ( void *item ) { - BinItem *bitem = NULL; + BinItem *bitem = nullptr; int i; @@ -191,7 +192,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 +304,7 @@ void* BinID::Get ( int id) return item->Item(); } - return NULL; + return nullptr; } void BinID::Add ( void *data, int id ) @@ -342,7 +343,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 f928b15033..473f9bfad4 100644 --- a/Core/Tools/Babylon/bin.h +++ b/Core/Tools/Babylon/bin.h @@ -21,6 +21,7 @@ // #pragma once +#include #include "list.h" #include "olestring.h" @@ -56,14 +57,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 18bb32cb76..a2e00ba658 100644 --- a/Core/Tools/Babylon/excel8.cpp +++ b/Core/Tools/Babylon/excel8.cpp @@ -18,6 +18,7 @@ // Machine generated IDispatch wrapper class(es) created with ClassWizard +#include #include "StdAfx.h" #ifdef RTS_DEBUG @@ -37,21 +38,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 +68,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 +91,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 +111,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 +135,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 +178,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 +261,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 +279,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 +297,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 +347,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 +364,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 +399,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 +407,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 +441,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 +484,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 +492,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 +500,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 +515,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 +530,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 +545,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 +560,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 +589,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 +604,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 +621,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 +643,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 +658,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 +695,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 +703,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 +718,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 +733,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 +750,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 +758,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 +773,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 +795,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 +810,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 +832,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 +840,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 +848,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 +870,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 +885,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 +900,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 +915,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 +930,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 +945,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 +960,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 +975,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 +990,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 +1010,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 +1025,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 +1040,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 +1055,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 +1072,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 +1099,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 +1114,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 +1162,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 +1177,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 +1185,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 +1200,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 +1227,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 +1235,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 +1252,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 +1260,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 +1275,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 +1291,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 +1340,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 +1355,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 +1398,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 +1413,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 +1463,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 +1471,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 +1479,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 +1487,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 +1495,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 +1510,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 +1555,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 +1563,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 +1578,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 +1613,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 +1639,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 +1653,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 +1661,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 +1676,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 +1684,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 +1699,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 +1714,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 +1729,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 +1744,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 +1759,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 +1781,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 +1803,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 +1818,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 +1833,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 +1848,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 +1863,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 +1878,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 +1912,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 +1927,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 +1963,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 +1971,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 +1979,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 +1994,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 +2016,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 +2031,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 +2046,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 +2061,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 +2076,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 +2091,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 +2105,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 +2134,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 +2168,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 +2183,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 +2198,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 +2213,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 +2221,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 +2236,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 +2258,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 +2276,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 +2298,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 +2334,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 +2342,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 +2357,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 +2405,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 +2420,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 +2447,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 +2455,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 +2491,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 +2513,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 +2528,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 +2543,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 +2558,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 +2566,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 +2574,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 +2582,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 +2590,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 +2675,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 +2689,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 +2697,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 +2712,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 +2727,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 +2735,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 +2743,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 +2751,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 +2773,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 +2788,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 +2796,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 +2824,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 +2895,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 +2903,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 +2918,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 +2933,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 +2948,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 +2956,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 +2964,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 +2972,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 +2992,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 +3018,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 +3072,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 +3087,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 +3102,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 +3131,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 +3139,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 +3147,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 +3184,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 +3192,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 +3200,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 +3215,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 +3237,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 +3252,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 +3260,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 +3280,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 +3305,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 +3360,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 +3375,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 +3390,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 +3405,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 +3432,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 +3461,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 +3469,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 +3477,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 +3516,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 +3533,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 +3541,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 +3573,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 +3588,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 +3638,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 +3683,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 +3717,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 +3745,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 +3753,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 +3783,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 +3791,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 +3854,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 +3903,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 +3918,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 +3926,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 +3934,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 +3952,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 +3967,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 +3975,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 +3997,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 +4005,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 +4023,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 +4031,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 +4086,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 +4151,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 +4166,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 +4181,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 +4196,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 +4211,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 +4226,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 +4241,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 +4256,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 +4288,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 +4317,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 +4332,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 +4347,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 +4355,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 +4363,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 +4388,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 +4434,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 +4442,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 +4469,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 +4484,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 +4492,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 +4523,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 +4531,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 +4546,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 +4563,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 +4571,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 +4586,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 +4601,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 +4609,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 +4617,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 +4667,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 +4675,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 +4698,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 +4725,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 +4742,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 +4750,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 +4776,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 +4803,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 +4831,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 +4840,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 +4848,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 +4872,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 +4880,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 +4888,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 +4896,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 +4911,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 +4927,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 +4954,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 +4969,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 +4991,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 +5006,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 +5021,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 +5050,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 +5067,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 +5101,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 +5122,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 +5151,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 +5166,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 +5181,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 +5196,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 +5210,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 +5239,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 +5254,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 +5278,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 +5286,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 +5308,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 +5323,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 +5347,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 +5376,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 +5391,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 +5406,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 +5421,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 +5436,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 +5451,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 1b933889d3..dd4a142ac1 100644 --- a/Core/Tools/Babylon/expimp.cpp +++ b/Core/Tools/Babylon/expimp.cpp @@ -20,6 +20,7 @@ // expimp.cpp // +#include #include "StdAfx.h" #include "TransDB.h" #include "XLStuff.h" @@ -102,7 +103,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 +119,7 @@ static void translateCopy( OLECHAR *outbuf, OLECHAR *inbuf ) lastLetter = b-1; reverseWord ( firstLetter, lastLetter ); } - firstLetter = NULL; + firstLetter = nullptr; formatWord = FALSE; } *b++ = ch; @@ -200,7 +201,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 +395,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 +406,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 +564,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 +758,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 +1409,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 +1484,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 b15d0252dc..c301f15536 100644 --- a/Core/Tools/Babylon/expimp.h +++ b/Core/Tools/Babylon/expimp.h @@ -21,6 +21,7 @@ // #pragma once +#include #include "TransDB.h" #include "BabylonDlg.h" @@ -100,9 +101,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 d8fc596717..9a72ee266c 100644 --- a/Core/Tools/Babylon/iff.cpp +++ b/Core/Tools/Babylon/iff.cpp @@ -17,6 +17,7 @@ */ +#include #include "StdAfx.h" #include "sys/stat.h" #include "iff.h" @@ -92,7 +93,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 +119,7 @@ IFF_FILE *IFF_Open ( const char *name ) IFF_Close ( iff ); } - return NULL; + return nullptr; } /******************************************************************/ @@ -128,7 +129,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 +165,7 @@ IFF_FILE *IFF_Load ( const char *name ) IFF_Close ( iff ); } - return NULL; + return nullptr; } /******************************************************************/ @@ -359,7 +360,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 +385,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 738a78f3d4..2af1b4f6cf 100644 --- a/Core/Tools/Babylon/list.cpp +++ b/Core/Tools/Babylon/list.cpp @@ -21,6 +21,7 @@ // +#include #include "StdAfx.h" #include #include "list.h" @@ -29,7 +30,7 @@ ListNode::ListNode ( void ) { prev = next = this; pri = NORMAL_PRIORITY; - item = NULL; + item = nullptr; } void ListNode::Append ( ListNode *new_node ) @@ -71,7 +72,7 @@ ListNode* ListNode::Next ( void ) { if ( next->IsHead ( ) ) { - return NULL; + return nullptr; } return next; @@ -81,7 +82,7 @@ ListNode* ListNode::Prev ( void ) { if ( prev->IsHead () ) { - return NULL; + return nullptr; } return prev; @@ -97,7 +98,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 +116,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 +266,7 @@ void* List::Item ( int list_index ) return node->Item(); } - return NULL; + return nullptr; } ListNode* List::FirstNode ( void ) @@ -312,5 +313,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 e3a7c30ebb..26e05d0041 100644 --- a/Core/Tools/Babylon/loadsave.cpp +++ b/Core/Tools/Babylon/loadsave.cpp @@ -20,6 +20,7 @@ // loadsave.cpp // +#include #include "StdAfx.h" #include "iff.h" #include "TransDB.h" @@ -216,7 +217,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 +340,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 +394,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 +460,7 @@ int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) db->AddObsolete ( text ); } - text = NULL; + text = nullptr; } if ( ! (text = new BabylonText ())) @@ -547,7 +548,7 @@ int LoadMainDB(TransDB *db, const char *filename, void (*cb) (void) ) { delete trans; } - trans = NULL; + trans = nullptr; break; } @@ -565,14 +566,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 +606,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 cde180af92..313a3e2846 100644 --- a/Core/Tools/Babylon/loadsave.h +++ b/Core/Tools/Babylon/loadsave.h @@ -21,7 +21,8 @@ // #pragma once +#include 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 1d5cd26a75..3c1a41205a 100644 --- a/Core/Tools/Babylon/olestring.cpp +++ b/Core/Tools/Babylon/olestring.cpp @@ -21,6 +21,7 @@ // +#include #include "StdAfx.h" #include #include "olestring.h" @@ -62,8 +63,8 @@ template int IsFormatTypeChar ( text ch ) OLEString::OLEString ( void ) { - ole = NULL; - sb = NULL; + ole = nullptr; + sb = nullptr; len = 0; Unlock (); @@ -75,8 +76,8 @@ OLEString::~OLEString ( ) { delete [] ole; delete [] sb; - ole = NULL; - sb = NULL; + ole = nullptr; + sb = nullptr; len = 0; } @@ -88,8 +89,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 +110,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 +208,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 62d57e993c..5aa071bf7f 100644 --- a/Core/Tools/CRCDiff/CRCDiff.cpp +++ b/Core/Tools/CRCDiff/CRCDiff.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "debug.h" #include "expander.h" #include "KVPair.h" @@ -45,7 +46,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 +71,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 +82,7 @@ static std::string readInFile(const char *fname) { //============================================================================= -static FILE *ofp = NULL; +static FILE *ofp = nullptr; void dumpQueued(void); @@ -190,7 +191,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 +265,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 +279,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 +330,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 +343,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/CMakeLists.txt b/Core/Tools/DebugWindow/CMakeLists.txt index d6514ca8ad..f2a82bab49 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 + core_utility ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") diff --git a/Core/Tools/DebugWindow/DebugWindow.cpp b/Core/Tools/DebugWindow/DebugWindow.cpp index bc15074c03..031c2a1e5e 100644 --- a/Core/Tools/DebugWindow/DebugWindow.cpp +++ b/Core/Tools/DebugWindow/DebugWindow.cpp @@ -19,6 +19,8 @@ // DebugWindow.cpp : Defines the initialization routines for the DLL. // +#include + #include "StdAfx.h" #include "DebugWindow.h" #include "DebugWindowDialog.h" @@ -73,7 +75,7 @@ CDebugWindowApp::CDebugWindowApp() { AfxInitialize(true); AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - m_DialogWindow = NULL; + m_DialogWindow = nullptr; } DebugWindowDialog* CDebugWindowApp::GetDialogWindow(void) @@ -103,7 +105,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 +122,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 202f6e8758..c79bfeb48c 100644 --- a/Core/Tools/DebugWindow/DebugWindowDialog.cpp +++ b/Core/Tools/DebugWindow/DebugWindowDialog.cpp @@ -16,6 +16,8 @@ ** along with this program. If not, see . */ +#include + #include "StdAfx.h" #include "DebugWindowDialog.h" @@ -25,7 +27,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 5fb09d0c01..6a5ab53391 100644 --- a/Core/Tools/DebugWindow/DebugWindowDialog.h +++ b/Core/Tools/DebugWindow/DebugWindowDialog.h @@ -17,6 +17,7 @@ */ +#include #include "Resource.h" #include // for std::pair #include // for std::string @@ -34,7 +35,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 d2b64c33ef..8249e37f0b 100644 --- a/Core/Tools/ImagePacker/Include/ImageDirectory.h +++ b/Core/Tools/ImagePacker/Include/ImageDirectory.h @@ -39,6 +39,7 @@ /////////////////////////////////////////////////////////////////////////////// #pragma once +#include // SYSTEM INCLUDES //////////////////////////////////////////////////////////// @@ -72,9 +73,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 ab0cd5142b..cc5e9d781a 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 46d483ac0c..8ec96e214d 100644 --- a/Core/Tools/ImagePacker/Source/ImageInfo.cpp +++ b/Core/Tools/ImagePacker/Source/ImageInfo.cpp @@ -39,6 +39,8 @@ /////////////////////////////////////////////////////////////////////////////// // SYSTEM INCLUDES //////////////////////////////////////////////////////////// +#include + #include // USER INCLUDES ////////////////////////////////////////////////////////////// @@ -70,14 +72,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 4ed5229945..794c4508e8 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 nullptr") ); 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 ) TheImagePacker->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 e463a558f4..25d8e64f09 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: nullptr 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 nullptr before generating texture") ); + DEBUG_ASSERTCRASH( m_targa == nullptr, ("The targa must be nullptr 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 e31f28f457..5abd36edb0 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 190f3fd8a3..2d299b44d1 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 93b08ff214..061104f1e0 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/ImageErrorProc.cpp @@ -40,6 +40,8 @@ /////////////////////////////////////////////////////////////////////////////// // SYSTEM INCLUDES //////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// +#include + #include #include @@ -83,7 +85,7 @@ BOOL CALLBACK ImageErrorProc( HWND hWndDialog, UINT message, // // sanity - if( TheImagePacker == NULL ) + if( TheImagePacker == nullptr ) return TRUE; // go through all images @@ -101,7 +103,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 333f4e11c3..5b6c920586 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/ImagePackerProc.cpp @@ -38,6 +38,8 @@ /////////////////////////////////////////////////////////////////////////////// // SYSTEM INCLUDES //////////////////////////////////////////////////////////// +#include + #include #include @@ -78,10 +80,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 +247,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 +290,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 +299,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 e96cd278ec..8eea8fd4dd 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/PageErrorProc.cpp @@ -40,6 +40,8 @@ /////////////////////////////////////////////////////////////////////////////// // SYSTEM INCLUDES //////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// +#include + #include #include @@ -83,7 +85,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 24729b0f5e..fef99cf1af 100644 --- a/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp +++ b/Core/Tools/ImagePacker/Source/WindowProcedures/PreviewProc.cpp @@ -38,6 +38,8 @@ /////////////////////////////////////////////////////////////////////////////// // SYSTEM INCLUDES //////////////////////////////////////////////////////////// +#include + #include #include @@ -118,7 +120,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 +184,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 +202,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 +225,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 +264,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 a1cea42277..38a215f670 100644 --- a/Core/Tools/Launcher/BFISH.cpp +++ b/Core/Tools/Launcher/BFISH.cpp @@ -41,6 +41,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma warning(disable : 4514) +#include #include "BFISH.h" #include #include @@ -81,7 +82,7 @@ typedef union { BlowfishEngine::~BlowfishEngine(void) { if (IsKeyed) { - Submit_Key(NULL, 0); + Submit_Key(nullptr, 0); } } @@ -95,7 +96,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 nullptr, 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 f584e9468c..91c38423fc 100644 --- a/Core/Tools/Launcher/DatGen/DatGen.cpp +++ b/Core/Tools/Launcher/DatGen/DatGen.cpp @@ -19,6 +19,7 @@ // DatGen.cpp : Defines the entry point for the application. // +#include #include #include #include @@ -61,7 +62,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 +70,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 +114,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 +138,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 ac0c17cd67..c1ebab4beb 100644 --- a/Core/Tools/Launcher/Toolkit/Debug/DebugPrint.cpp +++ b/Core/Tools/Launcher/Toolkit/Debug/DebugPrint.cpp @@ -36,6 +36,7 @@ #ifdef RTS_DEBUG +#include #include "DebugPrint.h" #include #include @@ -66,7 +67,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 +84,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 +132,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 +163,7 @@ void __cdecl PrintWin32Error(const char* string, ...) { static char _buffer[1024]; - if (string != NULL) + if (string != nullptr) { // Format string va_list va; @@ -172,8 +173,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 cc497bcc35..15ce48a07b 100644 --- a/Core/Tools/Launcher/Toolkit/Storage/File.cpp +++ b/Core/Tools/Launcher/Toolkit/Storage/File.cpp @@ -34,6 +34,7 @@ * ******************************************************************************/ +#include #include "File.h" #include #include @@ -272,7 +273,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 +352,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 +549,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 +578,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 +594,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 +602,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 +686,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 +780,7 @@ UInt32 File::GetLength(void) openedHere = true; } - UInt32 length = GetFileSize(mHandle, NULL); + UInt32 length = GetFileSize(mHandle, nullptr); if (length == 0xFFFFFFFF) { @@ -816,15 +816,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 +846,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 +894,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 +946,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 +972,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 +1015,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 +1041,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 +1076,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 0e4e5c255d..0421fc823c 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 @@ -66,6 +66,7 @@ ******************************************************************************/ #pragma once +#include #include "Visualc.h" #include "RefCounted.h" @@ -85,26 +86,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() {} RefPtrBase(RefCounted* object) : mRefObject(object) { - assert((mRefObject == NULL) || (mRefObject->mRefCount == 0)); + assert((mRefObject == nullptr) || (mRefObject->mRefCount == 0)); if (IsValid()) { @@ -140,7 +141,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 fecee38b55..1b32a34030 100644 --- a/Core/Tools/Launcher/Toolkit/Support/StringConvert.cpp +++ b/Core/Tools/Launcher/Toolkit/Support/StringConvert.cpp @@ -34,6 +34,7 @@ * ******************************************************************************/ +#include #include "StringConvert.h" #include "UString.h" #include @@ -84,16 +85,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 12ccb8237f..da43530d7e 100644 --- a/Core/Tools/Launcher/Toolkit/Support/UString.cpp +++ b/Core/Tools/Launcher/Toolkit/Support/UString.cpp @@ -34,6 +34,7 @@ * ******************************************************************************/ +#include #include "Visualc.h" #include "UString.h" #include "StringConvert.h" @@ -67,7 +68,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 +147,7 @@ template bool StripRight(WChar* string, const T* trimChars) ******************************************************************************/ UString::UString() - : mData(NULL), + : mData(nullptr), mCapacity(0) { } @@ -169,7 +170,7 @@ UString::UString() ******************************************************************************/ UString::UString(UInt capacity) - : mData(NULL), + : mData(nullptr), mCapacity(0) { AllocString(capacity); @@ -185,7 +186,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 +194,7 @@ UString::UString(UInt capacity) ******************************************************************************/ UString::UString(const Char* s) - : mData(NULL), + : mData(nullptr), mCapacity(0) { Copy(s); @@ -209,7 +210,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 +218,7 @@ UString::UString(const Char* s) ******************************************************************************/ UString::UString(const WChar* ws) - : mData(NULL), + : mData(nullptr), mCapacity(0) { Copy(ws); @@ -241,7 +242,7 @@ UString::UString(const WChar* ws) ******************************************************************************/ UString::UString(const UString& s) - : mData(NULL), + : mData(nullptr), mCapacity(0) { Copy(s); @@ -288,7 +289,7 @@ UString::~UString() UInt UString::Length(void) const { - if (mData == NULL) + if (mData == nullptr) { return 0; } @@ -315,7 +316,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 +361,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 +420,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 +463,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 +517,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 +529,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 +633,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 +645,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 +777,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 +826,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 +858,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 +866,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 +991,7 @@ UString UString::Right(UInt count) void UString::ToUpper(void) { - if (mData != NULL) + if (mData != nullptr) { wcsupr(mData); } @@ -1015,7 +1016,7 @@ void UString::ToUpper(void) void UString::ToLower(void) { - if (mData != NULL) + if (mData != nullptr) { wcslwr(mData); } @@ -1040,7 +1041,7 @@ void UString::ToLower(void) void UString::Reverse(void) { - if (mData != NULL) + if (mData != nullptr) { wcsrev(mData); } @@ -1105,7 +1106,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 +1117,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 +1150,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 +1161,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 +1217,7 @@ void UString::ConvertToANSI(Char* buffer, UInt bufferLength) const UInt UString::Size(void) const { - if (mData == NULL) + if (mData == nullptr) { return 0; } @@ -1268,15 +1269,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 +1312,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 a9b23e20f8..b9000fdc71 100644 --- a/Core/Tools/Launcher/Toolkit/Support/UString.h +++ b/Core/Tools/Launcher/Toolkit/Support/UString.h @@ -35,6 +35,7 @@ ******************************************************************************/ #pragma once +#include #include "UTypes.h" #include "RefCounted.h" @@ -136,7 +137,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 77e5eaa8ba..e63047e2ce 100644 --- a/Core/Tools/Launcher/Toolkit/Support/UTypes.h +++ b/Core/Tools/Launcher/Toolkit/Support/UTypes.h @@ -87,5 +87,6 @@ typedef enum {OFF = false, ON = true, PENDING = -1} TriState; //! Empty pointer #ifndef NULL -#define NULL (0L) +//#define NULL (0L) +// NULL is now deprecated - use nullptr instead #endif diff --git a/Core/Tools/Launcher/configfile.cpp b/Core/Tools/Launcher/configfile.cpp index 7f2dc928e6..1ee4c56ec6 100644 --- a/Core/Tools/Launcher/configfile.cpp +++ b/Core/Tools/Launcher/configfile.cpp @@ -38,6 +38,7 @@ the left is used for retrieval and it must be specified in uppercase for the 'get' functions. E.g. getString("KEY",valWstring); \***************************************************************************/ +#include #include #include #include @@ -68,7 +69,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 7bd986abc3..e88e6c2cdf 100644 --- a/Core/Tools/Launcher/dialog.cpp +++ b/Core/Tools/Launcher/dialog.cpp @@ -19,6 +19,7 @@ // // Create the dialog used during the patching process. // +#include #include"winblows.h" #include"resource.h" #include"loadbmp.h" @@ -30,7 +31,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 640190a5b5..98c6a58233 100644 --- a/Core/Tools/Launcher/dictionary.h +++ b/Core/Tools/Launcher/dictionary.h @@ -36,6 +36,7 @@ your hashing function is good. \****************************************************************************/ #pragma once +#include #include #include @@ -119,7 +120,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 +144,13 @@ void Dictionary::clear() for (i=0; ihashNext; delete(del); } - table[i]=NULL; + table[i]=nullptr; } entries=0; @@ -181,7 +182,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 +208,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 +264,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 +301,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 +315,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 +324,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 +359,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 +385,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 +438,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 +480,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 +525,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 +564,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 f490b05d1c..71283c3871 100644 --- a/Core/Tools/Launcher/filed.h +++ b/Core/Tools/Launcher/filed.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "odevice.h" @@ -26,7 +27,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 01715600af..57f5a69aef 100644 --- a/Core/Tools/Launcher/findpatch.cpp +++ b/Core/Tools/Launcher/findpatch.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "findpatch.h" // @@ -35,7 +36,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 +132,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 = "<. */ +#include #include"loadbmp.h" LoadBmp::LoadBmp() { - BitmapHandle_=NULL; - PalHandle_=NULL; + BitmapHandle_=nullptr; + PalHandle_=nullptr; } LoadBmp::~LoadBmp() @@ -60,22 +61,22 @@ bit8 LoadBmp::init(const char *filename,HWND hwnd) filename, GENERIC_READ, FILE_SHARE_READ, - (LPSECURITY_ATTRIBUTES) NULL, + (LPSECURITY_ATTRIBUTES) nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, - (HANDLE) NULL); + (HANDLE) nullptr); - if (hBitmapFile==NULL) + if (hBitmapFile==nullptr) return(FALSE); // Retrieve the BITMAPFILEHEADER structure. ReadFile(hBitmapFile, &bitmapHeader, sizeof(BITMAPFILEHEADER), &dwRead, - (LPOVERLAPPED)NULL); + (LPOVERLAPPED)nullptr); // Retrieve the BITMAPFILEHEADER structure. ReadFile(hBitmapFile, &bitmapInfoHeader, sizeof(BITMAPINFOHEADER), - &dwRead, (LPOVERLAPPED)NULL); + &dwRead, (LPOVERLAPPED)nullptr); // Allocate memory for the BITMAPINFO structure. @@ -102,7 +103,7 @@ bit8 LoadBmp::init(const char *filename,HWND hwnd) // 1 << bitmapInfoHeader.biBitCount == 2 ^ bitmapInfoHeader.biBitCount ReadFile(hBitmapFile, lpHeaderMem->bmiColors, ((1< #include "dialog.h" #include "patch.h" #include "findpatch.h" @@ -181,9 +182,9 @@ int main(int argc, char *argv[]) ConfigFile config; FILE* in = fopen(configName, "r"); - if (in == NULL) + if (in == nullptr) { - MessageBox(NULL,"You must run the game from its install directory.", + MessageBox(nullptr,"You must run the game from its install directory.", "Launcher config file missing",MB_OK); exit(-1); } @@ -193,7 +194,7 @@ int main(int argc, char *argv[]) if (ok == FALSE) { - MessageBox(NULL,"File 'launcher.cfg' is corrupt","Error",MB_OK); + MessageBox(nullptr,"File 'launcher.cfg' is corrupt","Error",MB_OK); exit(-1); } @@ -264,12 +265,12 @@ int main(int argc, char *argv[]) if (cutoffTime == 0) { // We didn't have the FLAG parameter; somebody's been hacking. No game for you! Bad hacker! - DBGMSG("Saw cutoffTime of 0; real time is " << time(NULL)); - MessageBox(NULL,"File 'launcher.cfg' is corrupt","Error",MB_OK); + DBGMSG("Saw cutoffTime of 0; real time is " << time(nullptr)); + MessageBox(nullptr,"File 'launcher.cfg' is corrupt","Error",MB_OK); exit(-1); } - if (time(NULL) > cutoffTime) + if (time(nullptr) > cutoffTime) { // The future is now! Just run the game. RunGame(argv[0], config, proc); @@ -315,8 +316,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 +327,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 +362,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 8e05d8449d..2a51e902fe 100644 --- a/Core/Tools/Launcher/monod.cpp +++ b/Core/Tools/Launcher/monod.cpp @@ -16,18 +16,19 @@ ** along with this program. If not, see . */ +#include #include "monod.h" 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 +38,7 @@ MonoD::~MonoD() { #ifdef _WIN32 CloseHandle(handle); - handle=NULL; + handle = nullptr; #endif } @@ -45,8 +46,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 63c746aafb..a81407ece9 100644 --- a/Core/Tools/Launcher/patch.cpp +++ b/Core/Tools/Launcher/patch.cpp @@ -31,6 +31,7 @@ This is where all the code is for applying various types of patches. \*****************************************************************************/ +#include #include "patch.h" #include #include @@ -49,7 +50,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 +58,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 +77,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 +159,7 @@ void Apply_Patch(char *patchfile,ConfigFile &config,int skuIndex) lpClass, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, - NULL, + nullptr, ®Key, ®Previous); @@ -167,21 +168,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 +192,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 +216,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 +249,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 +301,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 +324,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 +343,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 +363,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 +383,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 +410,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 +445,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 +507,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 +575,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 335dbb0f22..d8a67a8852 100644 --- a/Core/Tools/Launcher/process.cpp +++ b/Core/Tools/Launcher/process.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "process.h" Process::Process() @@ -23,8 +24,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 +44,7 @@ bit8 Create_Process(Process &process) DBGMSG("PROCESS CMD="< #include #include "wstypes.h" @@ -37,6 +38,6 @@ class Process DWORD dwThreadID; }; -bit8 Read_Process_Info(ConfigFile &config,OUT Process &info, IN const char *key = NULL); +bit8 Read_Process_Info(ConfigFile &config,OUT Process &info, IN const char *key = nullptr); bit8 Create_Process(Process &process); -bit8 Wait_Process(Process &process, DWORD *exit_code=NULL); +bit8 Wait_Process(Process &process, DWORD *exit_code=nullptr); diff --git a/Core/Tools/Launcher/streamer.cpp b/Core/Tools/Launcher/streamer.cpp index 061baad77d..626f0fe942 100644 --- a/Core/Tools/Launcher/streamer.cpp +++ b/Core/Tools/Launcher/streamer.cpp @@ -17,6 +17,7 @@ */ +#include #include "streamer.h" #ifdef _WIN32 #include @@ -28,7 +29,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 +102,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/Launcher/wdebug.cpp b/Core/Tools/Launcher/wdebug.cpp index 21891af9b5..78e34331c5 100644 --- a/Core/Tools/Launcher/wdebug.cpp +++ b/Core/Tools/Launcher/wdebug.cpp @@ -16,35 +16,36 @@ ** along with this program. If not, see . */ +#include #include #include "wdebug.h" #include "streamer.h" #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; int MsgManager::setAllStreams(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); @@ -70,7 +71,7 @@ int MsgManager::setAllStreams(OutputDevice *device) int MsgManager::setDebugStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); @@ -83,7 +84,7 @@ int MsgManager::setDebugStream(OutputDevice *device) int MsgManager::setInfoStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); @@ -96,7 +97,7 @@ int MsgManager::setInfoStream(OutputDevice *device) int MsgManager::setWarnStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); @@ -109,7 +110,7 @@ int MsgManager::setWarnStream(OutputDevice *device) int MsgManager::setErrorStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); diff --git a/Core/Tools/Launcher/wdebug.h b/Core/Tools/Launcher/wdebug.h index 72f732b648..41576e8db5 100644 --- a/Core/Tools/Launcher/wdebug.h +++ b/Core/Tools/Launcher/wdebug.h @@ -51,6 +51,7 @@ will you be ready to leave grasshopper. \*****************************************************************************/ #pragma once +#include #include #include "odevice.h" @@ -63,7 +64,7 @@ will you be ready to leave grasshopper. #define INFMSG(X)\ {\ char timebuf[40]; \ - time_t clock=time(NULL); \ + time_t clock=time(nullptr); \ cftime(timebuf,"%D %T",&clock); \ if (MsgManager::infoStream()) \ (*(MsgManager::infoStream())) << "INF " << timebuf << " [" << \ @@ -74,7 +75,7 @@ will you be ready to leave grasshopper. #define WRNMSG(X)\ {\ char timebuf[40]; \ - time_t clock=time(NULL); \ + time_t clock=time(nullptr); \ cftime(timebuf,"%D %T",&clock); \ if (MsgManager::warnStream()) \ (*(MsgManager::warnStream())) << "WRN " << timebuf << " [" << \ @@ -85,7 +86,7 @@ will you be ready to leave grasshopper. #define ERRMSG(X)\ {\ char timebuf[40]; \ - time_t clock=time(NULL); \ + time_t clock=time(nullptr); \ strcpy(timebuf,ctime(&clock)); \ if (MsgManager::errorStream()) \ (*(MsgManager::errorStream())) << "ERR " << timebuf << " [" << \ diff --git a/Core/Tools/Launcher/wstring.cpp b/Core/Tools/Launcher/wstring.cpp index cec002a6b6..d6138a3ac5 100644 --- a/Core/Tools/Launcher/wstring.cpp +++ b/Core/Tools/Launcher/wstring.cpp @@ -29,6 +29,7 @@ A fairly typical string class. This string class always copies any input string to it's own memory (for assignment or construction). \***************************************************************************/ +#include #include #include #include @@ -36,15 +37,15 @@ string to it's own memory (for assignment or construction). #include "wstring.h" -Wstring::Wstring():str(NULL) +Wstring::Wstring():str(nullptr) { } -Wstring::Wstring(const char *string):str(NULL) +Wstring::Wstring(const char *string):str(nullptr) { set(string); } -Wstring::Wstring(const Wstring &other):str(NULL) +Wstring::Wstring(const Wstring &other):str(nullptr) { - if (other.str!=NULL) + if (other.str!=nullptr) { str=new char[strlen(other.str)+1]; strcpy(str,other.str); @@ -56,7 +57,7 @@ Wstring::~Wstring() bit8 Wstring::operator==(const char *other) { - if ((str==NULL)&&(other==NULL)) + if ((str==nullptr)&&(other==nullptr)) return(TRUE); if(strcmp(str, other) != 0) return(FALSE); @@ -66,10 +67,10 @@ bit8 Wstring::operator==(const char *other) bit8 Wstring::operator==(const Wstring &other) { - 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) @@ -90,10 +91,10 @@ bit8 Wstring::operator!=(const char *other) bit8 Wstring::operator!=(const Wstring &other) { - 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) @@ -125,7 +126,7 @@ bit8 Wstring::cat(const char *s) char *oldStr; uint32 len; - if (s==NULL) // it's OK to cat nothing + if (s==nullptr) // it's OK to cat nothing return(TRUE); // Save the contents of the string. @@ -273,14 +274,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--; @@ -306,7 +307,7 @@ void Wstring::removeSpaces(void) void Wstring::clear(void) { delete[](str); - str=NULL; + str=nullptr; } void Wstring::setSize(sint32 size) @@ -344,7 +345,7 @@ char Wstring::get(uint32 index) const uint32 Wstring::length(void) const { - if(str == NULL) + if(str == nullptr) return(0); return((uint32)strlen(str)); } @@ -353,7 +354,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); @@ -443,7 +444,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 +494,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 +546,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 +565,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 +573,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 +594,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 d521a5872a..26bcc43147 100644 --- a/Core/Tools/Launcher/wstypes.h +++ b/Core/Tools/Launcher/wstypes.h @@ -47,7 +47,8 @@ Standard type definitions for the sake of portability and readability. #endif #ifndef NULL -#define NULL 0 +//#define NULL 0 +// NULL is now deprecated - use nullptr instead #endif //These are used for readability purposes mostly, when a method takes a diff --git a/Core/Tools/MapCacheBuilder/Source/WinMain.cpp b/Core/Tools/MapCacheBuilder/Source/WinMain.cpp index 9a2d0adca3..f26f8952ee 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 bba0c3902d..0424ba2dd7 100644 --- a/Core/Tools/PATCHGET/CHATAPI.cpp +++ b/Core/Tools/PATCHGET/CHATAPI.cpp @@ -20,6 +20,7 @@ // This module takes care of all the Chat API stuff // +#include #include #include "gamespy/ghttp/ghttp.h" #include "DownloadManager.h" @@ -176,16 +177,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 +211,7 @@ static void startOnline( void ) } */ delete TheDownloadManager; - TheDownloadManager = NULL; + TheDownloadManager = nullptr; if (g_Finished != 1) { @@ -229,7 +230,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 +279,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 +287,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 +464,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 +527,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 +538,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 +626,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 +646,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 +668,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 +697,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 +712,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 +724,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 +733,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 +866,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 +904,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 +923,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 +946,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 +977,7 @@ void Update_If_Required(void) int i; // Create the events for (i=0; iRequestServerList(1000,262364,"register","regpas98",15); @@ -1034,7 +1035,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 +1098,7 @@ CChatEventSink::QueryInterface(const IID& iid, void** ppv) } else { - *ppv = NULL; + *ppv = nullptr; return E_NOINTERFACE; } (reinterpret_cast(*ppv))->AddRef() ; @@ -1157,7 +1158,7 @@ CDownloadEventSink::QueryInterface(const IID& iid, void** ppv) } else { - *ppv = NULL; + *ppv = nullptr; return E_NOINTERFACE; } (reinterpret_cast(*ppv))->AddRef() ; @@ -1204,16 +1205,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 +1233,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 +1309,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 +1317,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 +1475,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 +1662,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 +1670,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 +1681,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 +1712,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/CMakeLists.txt b/Core/Tools/PATCHGET/CMakeLists.txt index bd271598c5..ceb99e21c9 100644 --- a/Core/Tools/PATCHGET/CMakeLists.txt +++ b/Core/Tools/PATCHGET/CMakeLists.txt @@ -25,6 +25,7 @@ target_link_libraries(corei_patchgrabber INTERFACE comctl32 core_debug core_profile + core_utility gamespy::gamespy imm32 vfw32 diff --git a/Core/Tools/PATCHGET/COMINIT.cpp b/Core/Tools/PATCHGET/COMINIT.cpp index 73efff26d9..0e5197e6e4 100644 --- a/Core/Tools/PATCHGET/COMINIT.cpp +++ b/Core/Tools/PATCHGET/COMINIT.cpp @@ -19,6 +19,7 @@ // // If you link with this it will automatically call the COM initialization stuff // +#include #include "COMINIT.h" #include #include @@ -30,10 +31,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 c22268b622..9e5ff18bc7 100644 --- a/Core/Tools/PATCHGET/DownloadManager.cpp +++ b/Core/Tools/PATCHGET/DownloadManager.cpp @@ -20,6 +20,7 @@ // Generals download manager code // Author: Matthew D. Campbell, July 2002 +#include #include "debug.h" #include "CHATAPI.h" #include "DownloadManager.h" @@ -28,7 +29,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 f59ad57a44..bad204c2cc 100644 --- a/Core/Tools/PATCHGET/PROCESS.cpp +++ b/Core/Tools/PATCHGET/PROCESS.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "process.h" namespace patchget @@ -26,8 +27,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 +45,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 +59,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 26ccf044c8..b240d68619 100644 --- a/Core/Tools/PATCHGET/PROCESS.h +++ b/Core/Tools/PATCHGET/PROCESS.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include #include "WSTYPES.h" @@ -38,6 +39,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 0e79559180..8d00bebeb6 100644 --- a/Core/Tools/PATCHGET/WINBLOWS.cpp +++ b/Core/Tools/PATCHGET/WINBLOWS.cpp @@ -17,6 +17,7 @@ */ #define WIN32_LEAN_AND_MEAN +#include #include #include #include @@ -30,8 +31,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 d0809df464..60ef84ad7e 100644 --- a/Core/Tools/PATCHGET/debug.cpp +++ b/Core/Tools/PATCHGET/debug.cpp @@ -20,6 +20,7 @@ // Minmal debug info // Author: Matthew D. Campbell, Sept 2002 +#include #include #include "debug.h" #include @@ -37,7 +38,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 +97,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 +107,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 e61a99033a..61a0117347 100644 --- a/Core/Tools/PATCHGET/debug.h +++ b/Core/Tools/PATCHGET/debug.h @@ -21,6 +21,7 @@ // Author: Matthew D. Campbell, Sept 2002 #pragma once +#include namespace patchget { @@ -55,7 +56,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 0640c0a911..1e76bf7ec4 100644 --- a/Core/Tools/PATCHGET/registry.cpp +++ b/Core/Tools/PATCHGET/registry.cpp @@ -20,6 +20,7 @@ // Simple interface for storing/retreiving registry values // Author: Matthew D. Campbell, December 2001 +#include #include #define WIN32_LEAN_AND_MEAN @@ -40,7 +41,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 +64,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 +85,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 +104,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 94dc34e041..06feb6e361 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 5c331479da..25b08065a3 100644 --- a/Core/Tools/W3DView/AddToLineupDialog.h +++ b/Core/Tools/W3DView/AddToLineupDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AddToLineupDialog.h : header file // @@ -30,7 +31,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 4c57a38b2d..72b1ba5c7c 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 691787da8d..b18336b060 100644 --- a/Core/Tools/W3DView/AdvancedAnimSheet.h +++ b/Core/Tools/W3DView/AdvancedAnimSheet.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AdvancedAnimSheet.h : header file // @@ -37,7 +38,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 a8f1f1e8d4..37b1a88093 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 2d71d778dc..dc49e43c4b 100644 --- a/Core/Tools/W3DView/AggregateNameDialog.h +++ b/Core/Tools/W3DView/AggregateNameDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AggregateNameDialog.h : header file // @@ -28,8 +29,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 d5e1abc29d..708d9cbe64 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 1ffd5dca66..b7a6970112 100644 --- a/Core/Tools/W3DView/AmbientLightDialog.h +++ b/Core/Tools/W3DView/AmbientLightDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AmbientLightDialog.h : header file // @@ -28,7 +29,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 34ed1675f5..59e4526114 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 50c6c369d0..f9cb3a33a2 100644 --- a/Core/Tools/W3DView/AnimMixingPage.h +++ b/Core/Tools/W3DView/AnimMixingPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AnimMixingPage.h : header file // @@ -32,7 +33,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 1b5af2f3ce..17286668da 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 8f5caac740..99ab18ff50 100644 --- a/Core/Tools/W3DView/AnimReportPage.h +++ b/Core/Tools/W3DView/AnimReportPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AnimReportPage.h : header file // @@ -33,7 +34,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 85584f0037..dea88570ec 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 9024d742c3..4298ae78c1 100644 --- a/Core/Tools/W3DView/AnimatedSoundOptionsDialog.h +++ b/Core/Tools/W3DView/AnimatedSoundOptionsDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AnimatedSoundOptionsDialog.h : header file // @@ -28,7 +29,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 0cd1c8894b..e4203f583d 100644 --- a/Core/Tools/W3DView/AnimationSpeed.h +++ b/Core/Tools/W3DView/AnimationSpeed.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AnimationSpeed.h : header file // @@ -28,7 +29,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 3b7092dcc6..0abd6dc368 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 1ba0adf5e0..4084edfdd5 100644 --- a/Core/Tools/W3DView/AssetInfo.h +++ b/Core/Tools/W3DView/AssetInfo.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "rendobj.h" #include "Utils.h" @@ -59,13 +60,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 cb9446b6d0..9397a7bcb4 100644 --- a/Core/Tools/W3DView/AssetPropertySheet.h +++ b/Core/Tools/W3DView/AssetPropertySheet.h @@ -17,6 +17,7 @@ */ #pragma once +#include // AssetPropertySheet.h : header file // @@ -30,7 +31,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 +57,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 6de5f2c192..7fd50ca25d 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 71a86752a9..aa566623dc 100644 --- a/Core/Tools/W3DView/BackgroundBMPDialog.h +++ b/Core/Tools/W3DView/BackgroundBMPDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // BackgroundBMPDialog.h : header file // @@ -28,7 +29,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 45f066b549..e8d2a71d3d 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 5999e968f0..b35ebcefce 100644 --- a/Core/Tools/W3DView/BackgroundColorDialog.h +++ b/Core/Tools/W3DView/BackgroundColorDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // BackgroundColorDialog.h : header file // @@ -28,7 +29,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 dc4c28a0a8..2117ce6047 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 0032e55126..fdc25d1c8c 100644 --- a/Core/Tools/W3DView/BackgroundObjectDialog.h +++ b/Core/Tools/W3DView/BackgroundObjectDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // BackgroundObjectDialog.h : header file // @@ -28,7 +29,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 57ed30814e..d9eacf4f18 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 33da214143..7a48861b1d 100644 --- a/Core/Tools/W3DView/BoneMgrDialog.h +++ b/Core/Tools/W3DView/BoneMgrDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // BoneMgrDialog.h : header file // @@ -37,7 +38,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/CMakeLists.txt b/Core/Tools/W3DView/CMakeLists.txt index f8a8b9604c..dc4b189673 100644 --- a/Core/Tools/W3DView/CMakeLists.txt +++ b/Core/Tools/W3DView/CMakeLists.txt @@ -170,6 +170,10 @@ add_library(corei_w3dview INTERFACE) target_sources(corei_w3dview INTERFACE ${W3DVIEW_SRC}) +target_link_libraries(corei_w3dview INTERFACE + core_utility +) + target_precompile_headers(corei_w3dview INTERFACE "StdAfx.h" [["always.h"]] diff --git a/Core/Tools/W3DView/CameraDistanceDialog.cpp b/Core/Tools/W3DView/CameraDistanceDialog.cpp index 7064f0f35b..1c8b6b3a51 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 ffde9e0757..70b498646e 100644 --- a/Core/Tools/W3DView/CameraDistanceDialog.h +++ b/Core/Tools/W3DView/CameraDistanceDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "resource.h" @@ -29,7 +30,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 31c2a6b50a..5106424e8b 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 bd94ce278f..df7b82b2ec 100644 --- a/Core/Tools/W3DView/CameraSettingsDialog.h +++ b/Core/Tools/W3DView/CameraSettingsDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // CameraSettingsDialog.h : header file // @@ -28,7 +29,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 38ec40b1bd..f77b56415b 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 a1efce422d..e907378f4a 100644 --- a/Core/Tools/W3DView/ColorBar.h +++ b/Core/Tools/W3DView/ColorBar.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ColorBar.h : header file // @@ -103,7 +104,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 ca4e95f700..e872bd9192 100644 --- a/Core/Tools/W3DView/ColorPicker.cpp +++ b/Core/Tools/W3DView/ColorPicker.cpp @@ -22,6 +22,7 @@ // // +#include #include "StdAfx.h" #include "ColorPicker.h" #include "ColorPickerDialogClass.h" @@ -44,14 +45,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 +66,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 +98,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 +133,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 +159,7 @@ fnColorPickerProc LPARAM lparam ) { - //static ColorPickerClass *pwnd = NULL; + //static ColorPickerClass *pwnd = nullptr; //static bool bcreated = false; switch (message) @@ -166,12 +167,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 +186,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 +204,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 +250,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 +274,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 +288,7 @@ ColorPickerClass::Create this); // Return the true/false result code - return (hwnd != NULL); + return (hwnd != nullptr); } @@ -322,18 +323,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 +696,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 +776,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 +810,7 @@ ColorPickerClass::OnLButtonUp ) { if (m_bSelecting) { - ::ClipCursor (NULL); + ::ClipCursor (nullptr); ReleaseCapture (); m_bSelecting = false; } @@ -843,7 +844,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 +897,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 +930,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 +969,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 6d4941b0a1..b473500ca2 100644 --- a/Core/Tools/W3DView/ColorPicker.h +++ b/Core/Tools/W3DView/ColorPicker.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ColorPicker.h : header file // @@ -77,7 +78,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 554595a4ad..874aab9124 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 64f6ea6e97..8145861a3d 100644 --- a/Core/Tools/W3DView/ColorPickerDialogClass.h +++ b/Core/Tools/W3DView/ColorPickerDialogClass.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ColorPickerDialogClass.h : header file // @@ -39,7 +40,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 7c5c78d136..6a70810eb8 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 3c42553ed3..a7c3e6888c 100644 --- a/Core/Tools/W3DView/ColorSelectionDialog.h +++ b/Core/Tools/W3DView/ColorSelectionDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ColorSelectionDialog.h : header file // @@ -33,7 +34,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 2a440aafe3..7d96e5713d 100644 --- a/Core/Tools/W3DView/ColorUtils.h +++ b/Core/Tools/W3DView/ColorUtils.h @@ -23,6 +23,7 @@ // #pragma once +#include ///////////////////////////////////////////////////////////////////////////// // Callbacks @@ -42,6 +43,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 1b5a31d163..b3a61a299f 100644 --- a/Core/Tools/W3DView/DataTreeView.cpp +++ b/Core/Tools/W3DView/DataTreeView.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "StdAfx.h" #include "W3DView.h" #include "DataTreeView.h" @@ -81,14 +82,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 +264,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 +310,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 +394,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 +416,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 +469,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 +487,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 +505,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 +528,7 @@ CDataTreeView::LoadAnimationsIntoTree (void) // Free the object delete pAnimEnum; - pAnimEnum = NULL; + pAnimEnum = nullptr; } return ; @@ -542,7 +543,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 +572,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 +590,7 @@ CDataTreeView::LoadAnimationsIntoTree (HTREEITEM hItem) // Free the object delete pAnimEnum; - pAnimEnum = NULL; + pAnimEnum = nullptr; } return ; @@ -669,7 +670,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 +754,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 +786,7 @@ CDataTreeView::Add_Asset_To_Tree } // Success! - retval = (htree_item != NULL); + retval = (htree_item != nullptr); } // Select the instance (if requested) @@ -819,11 +820,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 +857,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 +889,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 +925,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 +978,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 +1004,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 +1043,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 +1065,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 +1105,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 +1118,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 +1140,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 +1167,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 +1197,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 +1223,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 +1247,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 +1279,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 +1298,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 +1307,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 +1330,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 +1381,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 +1407,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 +1449,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 +1473,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 2882cf719b..dbe8c644b3 100644 --- a/Core/Tools/W3DView/DataTreeView.h +++ b/Core/Tools/W3DView/DataTreeView.h @@ -17,6 +17,7 @@ */ #pragma once +#include // DataTreeView.h : header file // @@ -104,7 +105,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 fb5d7dd527..8c0af94d1d 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 18d67c60ca..f7fd387208 100644 --- a/Core/Tools/W3DView/DeviceSelectionDialog.h +++ b/Core/Tools/W3DView/DeviceSelectionDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // DeviceSelectionDialog.h : header file // @@ -28,7 +29,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 efa0cf6c38..a542bdac8c 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 f00c487d6f..a8e46a3fef 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 94187d1ea4..62ac7eb472 100644 --- a/Core/Tools/W3DView/EditLODDialog.h +++ b/Core/Tools/W3DView/EditLODDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EditLODDialog.h : header file // @@ -28,7 +29,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 e72c04317a..50ab0d9c8d 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 4c33199bbb..616f1bd74e 100644 --- a/Core/Tools/W3DView/EmitterColorPropPage.h +++ b/Core/Tools/W3DView/EmitterColorPropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EmitterColorPropPage.h : header file // @@ -38,7 +39,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 865536ae36..d18d01f9d8 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 20834f603d..852c078d3d 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 bb81f4a261..acec9886ef 100644 --- a/Core/Tools/W3DView/EmitterGeneralPropPage.h +++ b/Core/Tools/W3DView/EmitterGeneralPropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EmitterGeneralPropPage.h : header file // @@ -38,7 +39,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 a4f66a0e97..a321224cf4 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 32a7faba17..1ee23a62c4 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 91c1a5a5ff..22f0bf79e5 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 cff67fb241..f07e646e1e 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 ae3702d755..38aff04471 100644 --- a/Core/Tools/W3DView/EmitterParticlePropPage.h +++ b/Core/Tools/W3DView/EmitterParticlePropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EmitterParticlePropPage.h : header file // @@ -38,7 +39,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 465b9e64b1..7449f8e0c3 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 2b2c35cd60..20af788156 100644 --- a/Core/Tools/W3DView/EmitterPhysicsPropPage.h +++ b/Core/Tools/W3DView/EmitterPhysicsPropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EmitterPhysicsPropPage.h : header file // @@ -37,7 +38,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 0b3eed55b2..24c4d71ec6 100644 --- a/Core/Tools/W3DView/EmitterPropertySheet.cpp +++ b/Core/Tools/W3DView/EmitterPropertySheet.cpp @@ -30,6 +30,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "StdAfx.h" #include "W3DView.h" #include "EmitterPropertySheet.h" @@ -65,7 +66,7 @@ EmitterPropertySheetClass::EmitterPropertySheetClass UINT nIDCaption, CWnd *pParentWnd ) - : m_pEmitterList (NULL), + : m_pEmitterList (nullptr), CPropertySheet (nIDCaption, pParentWnd, 0) { m_pEmitterList = emitter_list; @@ -84,7 +85,7 @@ EmitterPropertySheetClass::EmitterPropertySheetClass LPCTSTR pszCaption, CWnd *pParentWnd ) - : m_pEmitterList (NULL), + : m_pEmitterList (nullptr), CPropertySheet (pszCaption, pParentWnd, 0) { m_pEmitterList = emitter_list; @@ -192,7 +193,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 +287,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 +306,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 +383,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 +429,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 +488,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 f0861029c8..359d35d4ac 100644 --- a/Core/Tools/W3DView/EmitterPropertySheet.h +++ b/Core/Tools/W3DView/EmitterPropertySheet.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EmitterPropertySheet.h : header file // @@ -48,8 +49,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 d3164102f8..4c9dc0329c 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 11a6e7cce7..f5a5b4efe4 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 14e4ca369b..32fbf2a46c 100644 --- a/Core/Tools/W3DView/EmitterSizePropPage.h +++ b/Core/Tools/W3DView/EmitterSizePropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EmitterSizePropPage.h : header file // @@ -38,7 +39,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 92a6a7ad17..bc5cf79ccf 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 514c98ab92..a1c2eb662c 100644 --- a/Core/Tools/W3DView/EmitterUserPropPage.h +++ b/Core/Tools/W3DView/EmitterUserPropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EmitterUserPropPage.h : header file // @@ -35,7 +36,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 13f1e3a4cf..600c36fcdf 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 43adf086f4..0c7e20244b 100644 --- a/Core/Tools/W3DView/GammaDialog.h +++ b/Core/Tools/W3DView/GammaDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // GammaDialog.h : header file // @@ -28,7 +29,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 45dfd6d7a3..b0328e5920 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 e32acee128..1b5af956d8 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 b52c698e0f..c39fd17155 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 e27917e65f..31b60e5192 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 701ead89ed..fb766ddd8f 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 1651831971..1d4faed13a 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 f362a012e5..d3a2e4554a 100644 --- a/Core/Tools/W3DView/OpacitySettingsDialog.h +++ b/Core/Tools/W3DView/OpacitySettingsDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // OpacitySettingsDialog.h : header file // @@ -31,7 +32,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 39401fe94c..8485ed1dbf 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 d2cc35fd87..6cf477e36a 100644 --- a/Core/Tools/W3DView/OpacityVectorDialog.h +++ b/Core/Tools/W3DView/OpacityVectorDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "resource.h" #include "sphereobj.h" @@ -34,7 +35,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 06aab5ef4e..60f661d2ca 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 2339682a1e..52271a4d6f 100644 --- a/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.h +++ b/Core/Tools/W3DView/ParticleBlurTimeKeyDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ParticleBlurTimeKeyDialog.h : header file // @@ -28,7 +29,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 9a0c7da7a4..32632555fa 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 03f045ec1e..ad2f312533 100644 --- a/Core/Tools/W3DView/ParticleFrameKeyDialog.h +++ b/Core/Tools/W3DView/ParticleFrameKeyDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ParticleFrameKeyDialog.h : header file // @@ -28,7 +29,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 7607c77cec..66b608c4b0 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 37df1e0f41..e49dc1b802 100644 --- a/Core/Tools/W3DView/ParticleRotationKeyDialog.h +++ b/Core/Tools/W3DView/ParticleRotationKeyDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ParticleRotationKeyDialog.h : header file // @@ -28,7 +29,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 c8a56a2be8..1506093d51 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 80bb2be66a..d9254d16f9 100644 --- a/Core/Tools/W3DView/ParticleSizeDialog.h +++ b/Core/Tools/W3DView/ParticleSizeDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ParticleSizeDialog.h : header file // @@ -28,7 +29,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 a15b28e23a..b97ab60223 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 eed77d841b..b591594ed9 100644 --- a/Core/Tools/W3DView/PlaySoundDialog.h +++ b/Core/Tools/W3DView/PlaySoundDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "resource.h" #include "WWAudio.h" @@ -31,7 +32,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 1846b3dcb8..05420b607c 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 b826814f73..35f0b29ca1 100644 --- a/Core/Tools/W3DView/ResolutionDialog.h +++ b/Core/Tools/W3DView/ResolutionDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "resource.h" @@ -30,7 +31,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 2c4e7640e5..bde93c0bf3 100644 --- a/Core/Tools/W3DView/RestrictedFileDialog.h +++ b/Core/Tools/W3DView/RestrictedFileDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // RestrictedFileDialog.h : header file // @@ -30,11 +31,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 383616d1ae..e60863d547 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 63bd6d40a6..b08ee008e2 100644 --- a/Core/Tools/W3DView/RingColorPropPage.h +++ b/Core/Tools/W3DView/RingColorPropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // RingColorPropPage.h : header file // @@ -36,7 +37,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 25a931856a..aec2b8bbf4 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 c09517824a..801ce89a8f 100644 --- a/Core/Tools/W3DView/RingGeneralPropPage.h +++ b/Core/Tools/W3DView/RingGeneralPropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // RingGeneralPropPage.h : header file // @@ -36,7 +37,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 51ca2e8a78..87d9710bf2 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 d221010715..5debb32fe3 100644 --- a/Core/Tools/W3DView/RingPropertySheet.h +++ b/Core/Tools/W3DView/RingPropertySheet.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "RingColorPropPage.h" #include "RingGeneralPropPage.h" @@ -58,8 +59,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 bd2ce01014..c5d0c32282 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 22def9c8f5..cf35358af0 100644 --- a/Core/Tools/W3DView/RingSizePropPage.h +++ b/Core/Tools/W3DView/RingSizePropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // RingSizePropPage.h : header file // @@ -36,7 +37,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 8746417aa0..ac4ad7acde 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 859caeda99..ee663470c3 100644 --- a/Core/Tools/W3DView/SaveSettingsDialog.h +++ b/Core/Tools/W3DView/SaveSettingsDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SaveSettingsDialog.h : header file // @@ -28,7 +29,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 287f7da900..78525e285b 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 f01746b3c5..8c244a96cf 100644 --- a/Core/Tools/W3DView/ScaleDialog.h +++ b/Core/Tools/W3DView/ScaleDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "resource.h" @@ -29,7 +30,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 0a1ddd85d5..b379c0c355 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 0dc4c05a1d..2bbf4db82c 100644 --- a/Core/Tools/W3DView/SceneLightDialog.h +++ b/Core/Tools/W3DView/SceneLightDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SceneLightDialog.h : header file // @@ -32,7 +33,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 28917a34f4..cc4d18f95e 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 6ed5c3c6ac..d8cc8ad932 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 6cf71c059f..4495ee8975 100644 --- a/Core/Tools/W3DView/SoundEditDialog.h +++ b/Core/Tools/W3DView/SoundEditDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "wwstring.h" #include "resource.h" @@ -85,7 +86,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 51f2dc616f..491648db45 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 a461d862c7..3d9281fb7a 100644 --- a/Core/Tools/W3DView/SphereColorPropPage.h +++ b/Core/Tools/W3DView/SphereColorPropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SphereColorPropPage.h : header file // @@ -36,7 +37,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 9e8b57fa5f..0b0698c3f9 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 f3e3c919ed..7dee8ba713 100644 --- a/Core/Tools/W3DView/SphereGeneralPropPage.h +++ b/Core/Tools/W3DView/SphereGeneralPropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SphereGeneralPropPage.h : header file // @@ -36,7 +37,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 400f73d631..28a4433dd9 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 65b9a5777c..1259e67407 100644 --- a/Core/Tools/W3DView/SpherePropertySheet.h +++ b/Core/Tools/W3DView/SpherePropertySheet.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "SphereColorPropPage.h" #include "SphereGeneralPropPage.h" @@ -58,8 +59,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 70cd13ac18..1372a20b63 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 ac6657054e..f8d5c1951b 100644 --- a/Core/Tools/W3DView/SphereSizePropPage.h +++ b/Core/Tools/W3DView/SphereSizePropPage.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SphereSizePropPage.h : header file // @@ -36,7 +37,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 6e05539172..b7f35f8477 100644 --- a/Core/Tools/W3DView/SphereUtils.cpp +++ b/Core/Tools/W3DView/SphereUtils.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "stdafx.h" #include "sphereutils.h" @@ -133,7 +134,7 @@ SphereKeysClass::Free_Keys (void) void SphereKeysClass::Detach (void) { - m_Keys = NULL; + m_Keys = nullptr; m_KeyCount = 0; m_MaxKeys = 0; return ; @@ -150,8 +151,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 +178,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 cb60d55545..6fd2adfcb9 100644 --- a/Core/Tools/W3DView/SphereUtils.h +++ b/Core/Tools/W3DView/SphereUtils.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "sphereobj.h" @@ -51,7 +52,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 a639372773..1eeb49dbdf 100644 --- a/Core/Tools/W3DView/TextureMgrDialog.cpp +++ b/Core/Tools/W3DView/TextureMgrDialog.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "StdAfx.h" #include "W3DView.h" #include "TextureMgrDialog.h" @@ -79,10 +80,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 +226,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 +280,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 +315,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 +409,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 +426,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 +507,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 +613,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 +648,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 +742,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 +755,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 +763,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 1e109aa479..1db74ef6d6 100644 --- a/Core/Tools/W3DView/TextureMgrDialog.h +++ b/Core/Tools/W3DView/TextureMgrDialog.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "Vector.h" #include "RendObj.h" @@ -77,18 +78,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 +174,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 027e16792d..d0d5a50d75 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 0d83bfe3df..cbc0111e2d 100644 --- a/Core/Tools/W3DView/TexturePathDialog.h +++ b/Core/Tools/W3DView/TexturePathDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // TexturePathDialog.h : header file // @@ -28,7 +29,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 6413def588..9d4f5de222 100644 --- a/Core/Tools/W3DView/TextureSettingsDialog.cpp +++ b/Core/Tools/W3DView/TextureSettingsDialog.cpp @@ -31,6 +31,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "StdAfx.h" #include "Texture.h" #include "W3DView.h" @@ -70,10 +71,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 +136,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 +154,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 +171,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 +201,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 +218,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 +231,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 +431,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 +484,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 +510,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 +524,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 +610,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 ba443b4b0c..6ff82e2ab7 100644 --- a/Core/Tools/W3DView/TextureSettingsDialog.h +++ b/Core/Tools/W3DView/TextureSettingsDialog.h @@ -31,6 +31,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #ifdef WW3D_DX8 @@ -47,7 +48,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 b252d74647..a2301d2117 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 95ed99ff0b..b4ae48c2ae 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 afd07056a7..0952ecf826 100644 --- a/Core/Tools/W3DView/Utils.h +++ b/Core/Tools/W3DView/Utils.h @@ -24,6 +24,7 @@ // #pragma once +#include #include "Vector.h" @@ -35,14 +36,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 +115,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 5cc5ca992d..c923922acf 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 2383988dce..58a9922039 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 74efda0435..6c3de349a1 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 10956f3122..665f62cc13 100644 --- a/Core/Tools/W3DView/VolumeRandomDialog.h +++ b/Core/Tools/W3DView/VolumeRandomDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // VolumeRandomDialog.h : header file // @@ -33,7 +34,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 5e47c28883..494b626c14 100644 --- a/Core/Tools/W3DView/W3DView.cpp +++ b/Core/Tools/W3DView/W3DView.cpp @@ -19,6 +19,7 @@ // W3DView.cpp : Defines the class behaviors for the application. // +#include #include "StdAfx.h" #include "W3DView.h" @@ -47,10 +48,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 +133,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 +150,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 +160,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 +190,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 +259,7 @@ BOOL CW3DViewApp::InitInstance (void) ::SetForegroundWindow (hprev_instance); } - return (hprev_instance == NULL); + return (hprev_instance == nullptr); } ///////////////////////////////////////////////////////////////////////////// @@ -347,7 +348,7 @@ void Debug_Refs(void) !strcmp(search_ref->File, ref->File) && (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 +406,7 @@ CW3DViewApp::ExitInstance() // Free the asset manager // delete _TheAssetMgr; - _TheAssetMgr = NULL; + _TheAssetMgr = nullptr; } Debug_Refs (); @@ -427,7 +428,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 +454,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 +467,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 1594b53859..0fb3d721b8 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 nullptr, 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 nullptr, 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 nullptr, 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 nullptr, 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 nullptr, 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 cab9ffd9b1..66bafc6cee 100644 --- a/Core/Tools/W3DView/W3DViewDoc.h +++ b/Core/Tools/W3DView/W3DViewDoc.h @@ -21,6 +21,7 @@ ///////////////////////////////////////////////////////////////////////////// #pragma once +#include #include "scene.h" #include "chunkio.h" @@ -130,14 +131,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 +146,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 +192,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 +225,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 +249,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 +269,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 dec1f6681a..500da188f7 100644 --- a/Core/Tools/WW3D/max2w3d/AlphaModifier.cpp +++ b/Core/Tools/WW3D/max2w3d/AlphaModifier.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "AlphaModifier.h" enum Alpha_Messages @@ -67,7 +68,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 +249,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 +399,7 @@ Animatable* AlphaModifierClass::SubAnim(int i) switch (i) { case 0: return pblock; - default: return NULL; + default: return nullptr; } } @@ -418,7 +419,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 e698b0e20e..775901a3c5 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 2290ed6d45..f7ce3fb7c3 100644 --- a/Core/Tools/WW3D/max2w3d/AppData.cpp +++ b/Core/Tools/WW3D/max2w3d/AppData.cpp @@ -40,6 +40,7 @@ ** extensions to the MAXScript language. */ +#include #include // Main MAXScript header #include // MAX* Wrapper objects #include // MAX String class @@ -82,11 +83,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 +100,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 +117,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 +133,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 +171,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 +197,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 67ed5ccd8c..793d81ad7d 100644 --- a/Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/ExportAllDlg.cpp @@ -39,6 +39,7 @@ // ExportAllDlg.cpp : implementation file // +#include #include "ExportAllDlg.h" #include #include @@ -56,8 +57,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 +82,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 +129,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 +155,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 +184,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 +199,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 28744373f6..199498287d 100644 --- a/Core/Tools/WW3D/max2w3d/FormClass.cpp +++ b/Core/Tools/WW3D/max2w3d/FormClass.cpp @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "FormClass.h" #include "dllmain.h" @@ -147,21 +148,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 +170,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 +196,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 9f12c95df3..130bb0a314 100644 --- a/Core/Tools/WW3D/max2w3d/FormClass.h +++ b/Core/Tools/WW3D/max2w3d/FormClass.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include @@ -43,14 +44,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 1010d91197..410f7442a0 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtl.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtl.cpp @@ -62,6 +62,7 @@ * GameMtl::Compute_PS2_Shader_From_PC_Shader -- Change a W3D material to a PS2 W3D material.* * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "gamemtl.h" #include #include @@ -216,7 +217,7 @@ class GameMtlPostLoad : public PostLoadCallback */ static ParamBlockDescID MainParameterBlockDesc[] = { - { TYPE_INT, NULL, FALSE, 0 }, // Pass Count + { TYPE_INT, nullptr, FALSE, 0 }, // Pass Count }; @@ -336,366 +337,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 +739,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 +749,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 +1121,7 @@ RefTargetHandle GameMtl::GetReference(int i) } } - return NULL; + return nullptr; } @@ -1178,9 +1179,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 +1250,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 +1284,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 +1303,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 +1440,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 +3073,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 +3177,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 +3205,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 +3230,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 +3270,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 67f066ab18..a86b4c37a2 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtlDlg.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include #include #include @@ -77,13 +78,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 +187,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 +304,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 +328,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 +497,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 +517,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 +537,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 +573,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 46db41bc60..0508ecd9fb 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtlPassDlg.cpp @@ -45,6 +45,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "GameMtlPassDlg.h" #include "dllmain.h" #include "resource.h" @@ -87,7 +88,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 +146,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 +209,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 +270,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 5137098f49..ce27f3b355 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtlTextureDlg.cpp @@ -45,6 +45,7 @@ +#include #include "GameMtlTextureDlg.h" #include "gamemtl.h" #include "dllmain.h" @@ -75,23 +76,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 +652,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 +660,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 2cf7923fad..ffc6b705c7 100644 --- a/Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/GameMtlVertexMaterialDlg.cpp @@ -40,6 +40,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "GameMtlVertexMaterialDlg.h" #include "gamemtl.h" #include "dllmain.h" @@ -67,17 +68,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; i #include "InputDlg.h" #include @@ -52,12 +53,12 @@ static BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LP InputDlg::InputDlg (HWND hWndParent) : m_hWndParent(hWndParent), - m_hWnd(NULL) + m_hWnd() { // Set the strings to default values. SetCaption("Input Value..."); SetLabel("Please enter a value:"); - SetValue(NULL); + SetValue(nullptr); } @@ -114,7 +115,7 @@ void InputDlg::SetValue (const char *value) BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static InputDlg *dialog = NULL; + static InputDlg *dialog = nullptr; if (uMsg == WM_INITDIALOG) { @@ -159,7 +160,7 @@ BOOL CALLBACK InputDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM if (!OnOK()) return TRUE; - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); EndDialog(m_hWnd, 1); break; @@ -179,19 +180,19 @@ BOOL CALLBACK InputDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM LRESULT InputDlg::OnInitDialog (WPARAM wParam, LPARAM lParam) { // Set the cursor to the normal arrow. - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); // Set the dialog box caption. SetWindowText(m_hWnd, m_Caption); // Set the label text. HWND hLabel = GetDlgItem(m_hWnd, IDC_LABEL); - assert(hLabel != NULL); + assert(hLabel != nullptr); SetWindowText(hLabel, m_Label); // Set the default value. HWND hEdit = GetDlgItem(m_hWnd, IDC_VALUE); - assert(hEdit != NULL); + assert(hEdit != nullptr); SetWindowText(hEdit, m_Value); // Select all of the text in the edit box. @@ -204,7 +205,7 @@ BOOL InputDlg::OnOK (void) { // Update our copy of what the user typed. HWND hEdit = GetDlgItem(m_hWnd, IDC_VALUE); - assert(hEdit != NULL); + assert(hEdit != nullptr); GetWindowText(hEdit, m_Value, sizeof(m_Value)); // The dialog can be dismissed. diff --git a/Core/Tools/WW3D/max2w3d/InputDlg.h b/Core/Tools/WW3D/max2w3d/InputDlg.h index 28beae3a67..7d65e582a2 100644 --- a/Core/Tools/WW3D/max2w3d/InputDlg.h +++ b/Core/Tools/WW3D/max2w3d/InputDlg.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "dllmain.h" #include "resource.h" @@ -50,7 +51,7 @@ class InputDlg public: // Construction - InputDlg (HWND hWndParent=NULL); + InputDlg (HWND hWndParent=nullptr); // Methods int DoModal (void); // returns IDOK or IDCANCEL diff --git a/Core/Tools/WW3D/max2w3d/MeshDeform.cpp b/Core/Tools/WW3D/max2w3d/MeshDeform.cpp index 808ba5f3eb..ce2029d60e 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeform.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeform.cpp @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "MeshDeform.h" #include "MeshDeformData.h" #include "MeshDeformPanel.h" @@ -82,7 +83,7 @@ class MeshDeformClassDesc : public ClassDesc static MeshDeformClassDesc _MeshDeformCD; ClassDesc * Get_Mesh_Deform_Desc (void) { return &_MeshDeformCD; } #else -ClassDesc * Get_Mesh_Deform_Desc (void) { return NULL; } +ClassDesc * Get_Mesh_Deform_Desc (void) { return nullptr; } #endif @@ -127,8 +128,8 @@ MeshDeformClass::ModifyObject assert(object_state->obj->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 +142,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 +195,7 @@ MeshDeformClass::NotifyRefChanged CreateMouseCallBack * MeshDeformClass::GetCreateMouseCallBack (void) { - return NULL; + return nullptr; } @@ -275,9 +276,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 +298,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 +397,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 +426,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 +530,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 +578,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 +651,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 +728,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 +785,7 @@ MeshDeformClass::Rotate void MeshDeformClass::TransformStart (TimeValue time_val) { - if (m_MaxInterface != NULL) { + if (m_MaxInterface != nullptr) { m_MaxInterface->LockAxisTripods (TRUE); } @@ -809,7 +810,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 +839,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 +857,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 +875,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 +896,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 +914,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 +979,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 +995,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 +1044,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 +1071,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 +1085,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 +1114,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 +1128,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 +1152,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 +1166,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 +1196,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 +1213,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 +1245,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 +1260,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 +1282,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 +1295,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 +1324,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 +1378,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 45ea857f2c..e6a1d6d4b8 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeform.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeform.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include "Vector.h" @@ -67,20 +68,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 e4cb34b7bd..1faa1f9199 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformPanel.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "MeshDeformPanel.h" #include "resource.h" #include "util.h" @@ -82,7 +83,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 +155,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 +164,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 +286,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 +316,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 +343,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 36322e413d..646febddac 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformPanel.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformPanel.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include "resource.h" @@ -56,11 +57,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 20746a95e9..00b47943be 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSave.cpp @@ -35,6 +35,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "MeshDeform.h" #include "MeshDeformSave.h" #include "MeshDeformData.h" @@ -67,7 +68,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 +85,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 e27ff6e08e..477ff39987 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSave.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSave.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include "Vector.h" @@ -75,8 +76,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 54f747c988..f6d1e3bdd5 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.cpp @@ -35,6 +35,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "MeshDeformSaveSet.h" #include "util.h" @@ -55,7 +56,7 @@ MeshDeformSaveSetClass::Reset (void) } m_DeformData.Delete_All (); - m_CurrentKeyFrame = NULL; + m_CurrentKeyFrame = nullptr; return ; } @@ -90,7 +91,7 @@ MeshDeformSaveSetClass::Begin_Keyframe (float state) void MeshDeformSaveSetClass::End_Keyframe (void) { - m_CurrentKeyFrame = NULL; + m_CurrentKeyFrame = nullptr; return ; } @@ -109,8 +110,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 +145,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 +172,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 13642bc8a0..6ffe8a241a 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSaveSet.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include "Vector.h" @@ -94,7 +95,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 44dc3a5ea2..23a1b02a74 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSet.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "MeshDeformSet.h" #include "util.h" #include "MeshDeformSaveSet.h" @@ -685,7 +686,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 +709,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 +900,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 +1289,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 4451fb290a..24b2117768 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformSet.h +++ b/Core/Tools/WW3D/max2w3d/MeshDeformSet.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include "Vector.h" @@ -64,10 +65,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 +124,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 +140,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 839072fabd..ee396bcddd 100644 --- a/Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp +++ b/Core/Tools/WW3D/max2w3d/MeshDeformUndo.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "MeshDeformUndo.h" #include "util.h" #include "MeshDeformData.h" @@ -58,7 +59,7 @@ VertexRestoreClass::VertexRestoreClass m_SetIndex (0), m_KeyframeIndex (0) { - assert (mesh != NULL); + assert (mesh != nullptr); // // Remember the deformer's current settings @@ -91,9 +92,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 +130,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 c8b225e3ac..c00a5f4213 100644 --- a/Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp +++ b/Core/Tools/WW3D/max2w3d/PCToPS2Material.cpp @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include #include #include @@ -75,7 +76,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 +89,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 89613c12c8..215dd1e9b2 100644 --- a/Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp +++ b/Core/Tools/WW3D/max2w3d/SceneSetupDlg.cpp @@ -38,6 +38,7 @@ // SceneSetupDlg.cpp : implementation file // +#include #include "SceneSetupDlg.h" #include #include @@ -58,9 +59,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 +73,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 +82,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 +90,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 +101,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 +112,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 +140,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 +187,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 +210,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 71b9558294..f8d83b076b 100644 --- a/Core/Tools/WW3D/max2w3d/SkinCopy.cpp +++ b/Core/Tools/WW3D/max2w3d/SkinCopy.cpp @@ -45,6 +45,7 @@ new_wsm = wwCopySkinInfo source_root target_root new_wsm */ +#include #include // Main MAXScript header #include // MAX* Wrapper objects #include // def_* functions to create static function headers @@ -138,13 +139,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 +194,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 +223,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 nullptr if one doesn't exist. * * * * WARNINGS: * * * @@ -234,8 +235,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 +250,7 @@ SkinModifierClass *find_skin_binding (INode *skinned_obj) } // Skin modifier not found. - return NULL; + return nullptr; } @@ -269,12 +270,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 +303,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 +321,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 +349,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 +358,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 +371,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 +387,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 nullptr if none was found. * * * * WARNINGS: * * * @@ -397,7 +398,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 +417,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 +430,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 +438,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 +446,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 +465,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 +486,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 +502,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 +523,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 554cde3073..c8d10d2039 100644 --- a/Core/Tools/WW3D/max2w3d/SnapPoints.cpp +++ b/Core/Tools/WW3D/max2w3d/SnapPoints.cpp @@ -37,6 +37,7 @@ #if defined(_MSC_VER) #pragma once +#include #endif #include "SnapPoints.h" @@ -53,9 +54,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 +74,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 8b0ffd2e41..678dc68d8b 100644 --- a/Core/Tools/WW3D/max2w3d/TARGA.cpp +++ b/Core/Tools/WW3D/max2w3d/TARGA.cpp @@ -60,6 +60,7 @@ * ****************************************************************************/ +#include #include "TARGA.h" #ifndef TGA_USES_WWLIB_FILE_CLASSES #include @@ -100,8 +101,8 @@ Targa::Targa(void) { - mImage = NULL; - mPalette = NULL; + mImage = nullptr; + mPalette = nullptr; Clear_File(); mAccess = TGA_READMODE; mFlags = 0; @@ -136,11 +137,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 +315,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 +339,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 +358,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 +369,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 +389,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 +420,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 +497,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 +524,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 +596,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 +632,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 +641,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 +673,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 +879,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 +922,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 +964,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 +979,7 @@ TGA2Extension *Targa::GetExtension(void) if (mFlags & TGAF_TGA2) return (&mExtension); - return (NULL); + return (nullptr); } @@ -1113,7 +1114,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 +1283,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 +1291,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 02cf38aee4..5384abf701 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 7a17225dd3..a9c0a7d0b4 100644 --- a/Core/Tools/WW3D/max2w3d/Utility.cpp +++ b/Core/Tools/WW3D/max2w3d/Utility.cpp @@ -43,6 +43,7 @@ */ +#include #include #include #include @@ -112,7 +113,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 5dce24bc68..33381c506c 100644 --- a/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp +++ b/Core/Tools/WW3D/max2w3d/aabtreebuilder.cpp @@ -57,6 +57,7 @@ * AABTreeBuilderClass::Build_W3D_AABTree_Recursive -- Build array of indices and W3dMeshAAB * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "aabtreebuilder.h" #include "chunkio.h" #include "w3d_file.h" @@ -80,12 +81,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() { } @@ -123,17 +124,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 +154,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 +191,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 +272,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 +283,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 +308,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 +895,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 604d8130c1..133578f0bb 100644 --- a/Core/Tools/WW3D/max2w3d/aabtreebuilder.h +++ b/Core/Tools/WW3D/max2w3d/aabtreebuilder.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector3.h" @@ -84,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) { if (Front) { delete Front; } @@ -133,8 +134,8 @@ class AABTreeBuilderClass SplitArraysStruct(void) : FrontCount(0), BackCount(0), - FrontPolys(NULL), - BackPolys(NULL) + FrontPolys(nullptr), + BackPolys() { } diff --git a/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp index 8fc42511cc..df79b67df2 100644 --- a/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp +++ b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.cpp @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "animationcompressionsettings.h" #include "dllmain.h" #include "resource.h" @@ -50,8 +51,8 @@ //////////////////////////////////////////////////////////////////////////////////////// AnimationCompressionSettingsDialogClass::AnimationCompressionSettingsDialogClass (Interface *maxinterface, HWND parent_wnd) : MaxInterface (maxinterface), - Options (NULL), - Wnd (NULL), + Options (nullptr), + Wnd (nullptr), ParentWnd (parent_wnd) { return ; @@ -97,7 +98,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 +116,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 +159,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 921ad26d04..430e1bac6a 100644 --- a/Core/Tools/WW3D/max2w3d/animationcompressionsettings.h +++ b/Core/Tools/WW3D/max2w3d/animationcompressionsettings.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include @@ -55,7 +56,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 335f5cca22..9170e0b113 100644 --- a/Core/Tools/WW3D/max2w3d/bchannel.cpp +++ b/Core/Tools/WW3D/max2w3d/bchannel.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "bchannel.h" #include "w3d_file.h" #include "logdlg.h" @@ -114,7 +115,7 @@ bool BitChannelClass::Save(ChunkSaveClass & csave, bool compress) W3dTimeCodedBitChannelStruct * chn = (W3dTimeCodedBitChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -157,7 +158,7 @@ bool BitChannelClass::Save(ChunkSaveClass & csave, bool compress) return false; } - if (chn != NULL) { + if (chn != nullptr) { free(chn); } @@ -183,7 +184,7 @@ bool BitChannelClass::Save(ChunkSaveClass & csave, bool compress) W3dBitChannelStruct * chn = (W3dBitChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -203,7 +204,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 7cea41c89c..02005d48b1 100644 --- a/Core/Tools/WW3D/max2w3d/bpick.cpp +++ b/Core/Tools/WW3D/max2w3d/bpick.cpp @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "bpick.h" #include "dllmain.h" #include "resource.h" @@ -64,7 +65,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 +125,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 +139,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 bb21289021..fb895ddfe5 100644 --- a/Core/Tools/WW3D/max2w3d/bpick.h +++ b/Core/Tools/WW3D/max2w3d/bpick.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "max.h" //#include "dllmain.h" @@ -63,14 +64,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 +112,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 nullptr, 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 5e97c9d638..216fc05714 100644 --- a/Core/Tools/WW3D/max2w3d/colboxsave.cpp +++ b/Core/Tools/WW3D/max2w3d/colboxsave.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "colboxsave.h" #include "w3d_file.h" #include "util.h" @@ -70,7 +71,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 3f8ecc7b86..211cb5b3a1 100644 --- a/Core/Tools/WW3D/max2w3d/dazzlesave.cpp +++ b/Core/Tools/WW3D/max2w3d/dazzlesave.cpp @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "dazzlesave.h" #include "w3d_file.h" #include "util.h" @@ -54,14 +55,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 ce3727e08e..114971c306 100644 --- a/Core/Tools/WW3D/max2w3d/dllmain.cpp +++ b/Core/Tools/WW3D/max2w3d/dllmain.cpp @@ -42,6 +42,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include #include #include "dllmain.h" @@ -64,7 +65,7 @@ * Globals *****************************************************************************/ -HINSTANCE AppInstance = NULL; +HINSTANCE AppInstance = nullptr; static int ControlsInit = FALSE; static W3dClassDesc W3d_Export_Class_Descriptor; @@ -158,9 +159,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 +200,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 6f3aefbee8..9feb3c7a97 100644 --- a/Core/Tools/WW3D/max2w3d/exportlog.cpp +++ b/Core/Tools/WW3D/max2w3d/exportlog.cpp @@ -41,6 +41,7 @@ * ExportLog::updatebar -- Set the position of the progress bar * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "exportlog.h" #include "logdlg.h" #include @@ -49,7 +50,7 @@ /* ** Static variables */ -LogDataDialogClass * _LogDialog = NULL; +LogDataDialogClass * _LogDialog = nullptr; /* @@ -73,7 +74,7 @@ LogDataDialogClass * _LogDialog = NULL; *=============================================================================================*/ void ExportLog::Init(HWND parent) { - assert(_LogDialog == NULL); + assert(_LogDialog == nullptr); _LogDialog = new LogDataDialogClass(parent); } @@ -93,14 +94,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 +120,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 +142,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 +164,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 6079b238c7..9b17e1f9e9 100644 --- a/Core/Tools/WW3D/max2w3d/floaterdialog.cpp +++ b/Core/Tools/WW3D/max2w3d/floaterdialog.cpp @@ -41,6 +41,7 @@ * FloaterDialogClass::Dialog_Proc -- Dialog Proc for the floater * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "floaterdialog.h" #include "dllmain.h" #include "resource.h" @@ -87,9 +88,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() { } @@ -107,7 +108,7 @@ FloaterDialogClass::FloaterDialogClass(void) : *=============================================================================================*/ FloaterDialogClass::~FloaterDialogClass(void) { - if (Hwnd != NULL) { + if (Hwnd != nullptr) { ::DestroyWindow(Hwnd); } } @@ -127,7 +128,7 @@ FloaterDialogClass::~FloaterDialogClass(void) *=============================================================================================*/ bool FloaterDialogClass::Is_Created(void) { - return (Hwnd != NULL); + return (Hwnd != nullptr); } @@ -204,13 +205,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 +227,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 0be2207c5c..98b161b7a7 100644 --- a/Core/Tools/WW3D/max2w3d/gamemaps.cpp +++ b/Core/Tools/WW3D/max2w3d/gamemaps.cpp @@ -42,6 +42,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "gamemaps.h" @@ -89,7 +90,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 +184,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 f94e728406..a74f3ef823 100644 --- a/Core/Tools/WW3D/max2w3d/gamemaps.h +++ b/Core/Tools/WW3D/max2w3d/gamemaps.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include "stdmat.h" @@ -57,7 +58,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 +85,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 ffc8b5c36e..3f94121cb4 100644 --- a/Core/Tools/WW3D/max2w3d/genlodextensiondialog.cpp +++ b/Core/Tools/WW3D/max2w3d/genlodextensiondialog.cpp @@ -42,6 +42,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "genlodextensiondialog.h" #include "dllmain.h" #include "resource.h" @@ -67,10 +68,10 @@ * HISTORY: * *=============================================================================================*/ GenLodExtensionDialogClass::GenLodExtensionDialogClass(Interface * maxinterface) : - Hwnd(NULL), - Options(NULL), + Hwnd(nullptr), + Options(nullptr), MaxInterface(maxinterface), - LodIndexSpin(NULL) + LodIndexSpin() { } @@ -189,7 +190,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 1347ccce46..5994ef522f 100644 --- a/Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp +++ b/Core/Tools/WW3D/max2w3d/genmtlnamesdialog.cpp @@ -42,6 +42,7 @@ * _gen_mtl_names_dialog_proc -- windows dialog proc for GenMtlNamesDialog * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "genmtlnamesdialog.h" #include "dllmain.h" #include "resource.h" @@ -70,10 +71,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 +193,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 +245,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 c3328c7bce..707afd4ea6 100644 --- a/Core/Tools/WW3D/max2w3d/gennamesdialog.cpp +++ b/Core/Tools/WW3D/max2w3d/gennamesdialog.cpp @@ -45,6 +45,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "gennamesdialog.h" #include "dllmain.h" #include "resource.h" @@ -72,10 +73,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 +252,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 +341,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 c1d83f18d8..5050ad4e52 100644 --- a/Core/Tools/WW3D/max2w3d/geometryexportcontext.h +++ b/Core/Tools/WW3D/max2w3d/geometryexportcontext.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include @@ -75,11 +76,11 @@ class GeometryExportContextClass OriginList(origin_list), Origin(origin), OriginTransform(1), - ProgressMeter(NULL), + ProgressMeter(nullptr), materialColors(materialColors), numMaterialColors(0), numHouseColors(0), - materialColorTexture(NULL) + materialColorTexture() { 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 8a6a70a668..1a72482182 100644 --- a/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp +++ b/Core/Tools/WW3D/max2w3d/geometryexporttask.cpp @@ -51,6 +51,7 @@ * MeshGeometryExportTaskClass::Combine_Mesh -- Add the given mesh into this mesh * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "geometryexporttask.h" #include "geometryexportcontext.h" #include "util.h" @@ -79,7 +80,7 @@ class MeshGeometryExportTaskClass : public GeometryExportTaskClass MeshGeometryExportTaskClass(INode * node,GeometryExportContextClass & context) : GeometryExportTaskClass(node,context), NameDirty(false), - SingleMtl(NULL) + SingleMtl() { /* ** Copy the export options @@ -271,7 +272,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 nullptr 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 +412,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 +507,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 +536,7 @@ GeometryExportTaskClass::Create_Task(INode * node,GeometryExportContextClass & c return new AggregateGeometryExportTaskClass(node,context); } - return NULL; + return nullptr; } @@ -703,9 +704,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 +742,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 +791,7 @@ void MeshGeometryExportTaskClass::Update_Cached_Data(void) } if (mat_count > 1) { - SingleMtl = NULL; + SingleMtl = nullptr; } } @@ -838,7 +839,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 +1017,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 f2ebcba44a..2bf359d996 100644 --- a/Core/Tools/WW3D/max2w3d/gmtldlg.cpp +++ b/Core/Tools/WW3D/max2w3d/gmtldlg.cpp @@ -55,6 +55,7 @@ * PsxDlgProc -- Dialog proc which thunks into GameMtlDlg::PsxProc * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include #include #include @@ -99,11 +100,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 +112,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 +152,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 +191,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 +243,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 +437,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 +591,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 +624,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 +695,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 +788,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 +884,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 +1101,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 f9aaf8773c..757939a1f4 100644 --- a/Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp +++ b/Core/Tools/WW3D/max2w3d/gridsnapmodifier.cpp @@ -38,6 +38,7 @@ +#include #include "max.h" #include "resource.h" #include "simpmod.h" @@ -87,7 +88,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 +178,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 +217,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 +259,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 +278,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 70066e54d3..443eb31463 100644 --- a/Core/Tools/WW3D/max2w3d/hiersave.cpp +++ b/Core/Tools/WW3D/max2w3d/hiersave.cpp @@ -59,6 +59,7 @@ * HierarchySaveClass::load_fixups -- reads the fixup transforms from a W3D file * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hiersave.h" #include "w3d_file.h" #include "nodefilt.h" @@ -116,7 +117,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 +171,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 +200,7 @@ HierarchySaveClass::HierarchySaveClass * 10/26/1997 GH : Created. * *=============================================================================================*/ HierarchySaveClass::HierarchySaveClass(): - Node(NULL), + Node(nullptr), CurNode(0), CurTime(0) { @@ -452,10 +453,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 +469,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 +679,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 +977,7 @@ bool HierarchySaveClass::load_header(ChunkLoadClass & cload) bool HierarchySaveClass::load_pivots(ChunkLoadClass & cload) { for (uint32 i=0; i #include "always.h" @@ -94,7 +95,7 @@ class HierarchySaveClass Progress_Meter_Class & treemeter, char * hname, int fixup_type = MATRIX_FIXUP_NONE, - HierarchySaveClass * fixuptree = NULL); + HierarchySaveClass * fixuptree = nullptr); HierarchySaveClass( INodeListClass * rootlist, @@ -102,7 +103,7 @@ class HierarchySaveClass Progress_Meter_Class & treemeter, char * hname, int fixup_type = MATRIX_FIXUP_NONE, - HierarchySaveClass * fixuptree = NULL, + HierarchySaveClass * fixuptree = nullptr, const Matrix3 & origin_offset = Matrix3(1)); ~HierarchySaveClass(); diff --git a/Core/Tools/WW3D/max2w3d/hlodsave.cpp b/Core/Tools/WW3D/max2w3d/hlodsave.cpp index 4df94e3d6f..2b95ee45ab 100644 --- a/Core/Tools/WW3D/max2w3d/hlodsave.cpp +++ b/Core/Tools/WW3D/max2w3d/hlodsave.cpp @@ -43,6 +43,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hlodsave.h" #include "meshcon.h" #include "errclass.h" @@ -99,7 +100,7 @@ struct W3dHLodSubObjectStruct HLodSaveClass::HLodSaveClass (MeshConnectionsClass **connections, int lod_count, TimeValue CurTime, char *name, const char *htree_name, Progress_Meter_Class &meter, INodeListClass *origin_list) -: lod_array(NULL) +: lod_array() { /* ** Fill in the W3dHLodHeaderStruct @@ -225,7 +226,7 @@ HLodSaveClass::~HLodSaveClass (void) if (lod_array) { delete []lod_array; - lod_array = NULL; + lod_array = nullptr; } } diff --git a/Core/Tools/WW3D/max2w3d/hlodsave.h b/Core/Tools/WW3D/max2w3d/hlodsave.h index a0b91af6b9..395740bf72 100644 --- a/Core/Tools/WW3D/max2w3d/hlodsave.h +++ b/Core/Tools/WW3D/max2w3d/hlodsave.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" @@ -81,7 +82,7 @@ class HLodSaveClass HLodArrayEntry (int num_sub_objs = 0) { - sub_obj = NULL; + sub_obj = nullptr; num_sub_objects = 0; Allocate_Sub_Objects(num_sub_objs); } @@ -91,7 +92,7 @@ class HLodSaveClass if (sub_obj) { delete sub_obj; - sub_obj = NULL; + sub_obj = nullptr; num_sub_objects = 0; } } diff --git a/Core/Tools/WW3D/max2w3d/logdlg.cpp b/Core/Tools/WW3D/max2w3d/logdlg.cpp index aa693b8223..181ac29f66 100644 --- a/Core/Tools/WW3D/max2w3d/logdlg.cpp +++ b/Core/Tools/WW3D/max2w3d/logdlg.cpp @@ -35,6 +35,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "logdlg.h" #include "resource.h" #include "dllmain.h" @@ -64,13 +65,13 @@ static DWORD WINAPI _logdata_thread_function(LPVOID log_obj_ptr); * 02/09/2000 JGA : Created. * *=============================================================================================*/ LogDataDialogClass::LogDataDialogClass(HWND parent): - Hwnd(NULL), + Hwnd(nullptr), ParentHwnd(parent), buffer_index(0), last_buffer_index(0), status(0) { - ThreadHandle = CreateThread(NULL, 0, _logdata_thread_function, (LPVOID)this, 0, &ThreadID); + ThreadHandle = CreateThread(nullptr, 0, _logdata_thread_function, (LPVOID)this, 0, &ThreadID); if (ThreadHandle) { while (status == 0) { @@ -272,7 +273,7 @@ bool LogDataDialogClass::Dialog_Proc status = 2; EndDialog(Hwnd, 1); - Hwnd = NULL; + Hwnd = nullptr; return TRUE; break; @@ -287,7 +288,7 @@ bool LogDataDialogClass::Dialog_Proc if (status >= 2) { EndDialog(Hwnd, 1); - Hwnd = NULL; + Hwnd = nullptr; } return TRUE; @@ -301,7 +302,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 d690edb50a..98f41cfc0e 100644 --- a/Core/Tools/WW3D/max2w3d/maxworldinfo.h +++ b/Core/Tools/WW3D/max2w3d/maxworldinfo.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include "meshbuild.h" @@ -58,7 +59,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 524b14c4b2..74df9ba1af 100644 --- a/Core/Tools/WW3D/max2w3d/meshbuild.cpp +++ b/Core/Tools/WW3D/max2w3d/meshbuild.cpp @@ -58,6 +58,7 @@ * MeshBuilderClass::Sort_Vertices_By_Vertex_Material -- sorts verts by vertex mtl in pass0 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshbuild.h" #include "uarray.h" #include @@ -161,7 +162,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 +414,7 @@ void MeshBuilderClass::VertClass::Reset(void) Attribute1 = 0; UniqueIndex = 0; ShadeIndex = 0; - NextHash = NULL; + NextHash = nullptr; } @@ -560,16 +561,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 () { Reset(pass_count,face_count_guess,face_count_growth_rate); } @@ -589,7 +590,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 +608,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 +826,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 +1013,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 11cdd3845f..8a8df99a29 100644 --- a/Core/Tools/WW3D/max2w3d/meshcon.cpp +++ b/Core/Tools/WW3D/max2w3d/meshcon.cpp @@ -40,6 +40,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshcon.h" #include "util.h" #include "SnapPoints.h" @@ -69,7 +70,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 cae17047f1..659e9b2209 100644 --- a/Core/Tools/WW3D/max2w3d/meshcon.h +++ b/Core/Tools/WW3D/max2w3d/meshcon.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #ifndef ALWAYS_H #include "always.h" @@ -68,7 +69,7 @@ class GeometryExportContextClass; struct ConnectionStruct { - ConnectionStruct(void) : BoneIndex(0),MeshINode(NULL) + ConnectionStruct(void) : BoneIndex(0),MeshINode() { memset(ObjectName,0,sizeof(ObjectName)); } @@ -116,11 +117,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 nullptr, 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 d1ff3513b1..ba46af15f8 100644 --- a/Core/Tools/WW3D/max2w3d/meshsave.cpp +++ b/Core/Tools/WW3D/max2w3d/meshsave.cpp @@ -58,6 +58,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshsave.h" #include #include @@ -154,7 +155,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 +253,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 +297,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 +343,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 +401,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 +435,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 +495,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 nullptr 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 +556,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 +660,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 +744,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 +786,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 +795,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 +1061,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 +1069,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 +1205,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 +1339,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 +1357,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 +1365,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 +1560,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 +1807,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 +1875,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 +2028,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 +2054,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 db46e5549d..4777f98756 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 c687772147..f3de10a1e7 100644 --- a/Core/Tools/WW3D/max2w3d/motion.cpp +++ b/Core/Tools/WW3D/max2w3d/motion.cpp @@ -49,6 +49,7 @@ * MotionClass::get_visibility -- retrieve the visibility bit for this node:frame * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "motion.h" #include "w3d_file.h" #include "vchannel.h" @@ -88,7 +89,7 @@ MotionClass::MotionClass BasePose(basepose), Scene(scene), RootNode(rootnode), - RootList(NULL), + RootList(nullptr), StartFrame(options.StartFrame), EndFrame(options.EndFrame), ReduceAnimation(options.ReduceAnimation), @@ -135,7 +136,7 @@ MotionClass::MotionClass ): BasePose(basepose), Scene(scene), - RootNode(NULL), + RootNode(nullptr), RootList(rootlist), StartFrame(options.StartFrame), EndFrame(options.EndFrame), @@ -183,18 +184,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 +209,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 +350,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 b3a831a982..508820a8ee 100644 --- a/Core/Tools/WW3D/max2w3d/namedsel.cpp +++ b/Core/Tools/WW3D/max2w3d/namedsel.cpp @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "namedsel.h" @@ -43,9 +44,9 @@ NamedSelSetList::~NamedSelSetList() { for (int i=0; i #include "nullsave.h" @@ -51,7 +52,7 @@ NullSaveClass::NullSaveClass memset(&NullData,0,sizeof(NullData)); NullData.Version = W3D_NULL_OBJECT_CURRENT_VERSION; - if ((container_name != NULL) && (strlen(container_name) > 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 1c420590cd..34ebe58fea 100644 --- a/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp +++ b/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.cpp @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "presetexportoptionsdialog.h" #include "dllmain.h" #include "resource.h" @@ -58,8 +59,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 +108,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 +126,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 +155,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 +172,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 +214,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 +235,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 +256,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 +407,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 +583,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 +697,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 +747,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 +755,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 +784,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 96fa0d295b..6d0d39ba9d 100644 --- a/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.h +++ b/Core/Tools/WW3D/max2w3d/presetexportoptionsdialog.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include @@ -55,7 +56,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 2c8223e5d0..0d47beb804 100644 --- a/Core/Tools/WW3D/max2w3d/rcmenu.cpp +++ b/Core/Tools/WW3D/max2w3d/rcmenu.cpp @@ -40,6 +40,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "rcmenu.h" #include "w3dutil.h" #include "util.h" @@ -73,7 +74,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 1c06d62cfc..f6de8b9e6b 100644 --- a/Core/Tools/WW3D/max2w3d/simpdib.cpp +++ b/Core/Tools/WW3D/max2w3d/simpdib.cpp @@ -34,23 +34,24 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "simpdib.h" 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() { // Allocate a BITMAPINFO structure Info = (BITMAPINFO *) new char [sizeof(BITMAPINFO) + 256*sizeof(RGBQUAD)]; - if (Info == NULL) { + if (Info == nullptr) { IsZombie = true; return; } @@ -78,7 +79,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 044a219940..86c8cd8e78 100644 --- a/Core/Tools/WW3D/max2w3d/skin.cpp +++ b/Core/Tools/WW3D/max2w3d/skin.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "skin.h" #include "dllmain.h" #include "max.h" @@ -63,13 +64,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 +155,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 +187,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 +202,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 +225,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 +313,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 nullptr. */ return &_SkinCreateCB; } @@ -440,11 +441,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 +477,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 +494,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 +505,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 +553,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 +703,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 +733,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 +781,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 +814,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 +827,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 +933,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 +962,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 +1049,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 +1067,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 +1130,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 +1186,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 +1240,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 +1284,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 +1303,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 +1341,7 @@ void SkinModifierClass::ActivateSubSelSet(TSTR & setname) ModContextList mclist; INodeTab nodes; - if (InterfacePtr == NULL) return; + if (InterfacePtr == nullptr) return; InterfacePtr->GetModContexts(mclist,nodes); @@ -1398,16 +1399,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 +1420,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 +1446,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 +1474,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 +1537,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 +1574,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 +1604,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 +1693,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 +1799,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 +1819,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 +1831,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 +1871,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 ff5f7baf2a..afc1fc941d 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 d5946a9ea4..f54ab45f78 100644 --- a/Core/Tools/WW3D/max2w3d/util.cpp +++ b/Core/Tools/WW3D/max2w3d/util.cpp @@ -41,6 +41,7 @@ * -- Checks if the node is the origin for the base obect (non-LOD'd). * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "util.h" #include "w3dutil.h" #include "skin.h" @@ -57,7 +58,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 +152,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 +167,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 +188,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 +201,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 +254,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 +313,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 +334,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 +352,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 +411,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 +453,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 +585,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 +618,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 96eb55e03f..4aaec1a953 100644 --- a/Core/Tools/WW3D/max2w3d/util.h +++ b/Core/Tools/WW3D/max2w3d/util.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #ifndef ALWAYS_H #include "always.h" @@ -102,11 +103,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 8392aaded4..212d3babd5 100644 --- a/Core/Tools/WW3D/max2w3d/vchannel.cpp +++ b/Core/Tools/WW3D/max2w3d/vchannel.cpp @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "vchannel.h" #include #include @@ -85,8 +86,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 +174,7 @@ bool VectorChannelClass::SaveTimeCoded(ChunkSaveClass & csave, BitChannelClass * W3dTimeCodedAnimChannelStruct * chn = (W3dTimeCodedAnimChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -240,7 +241,7 @@ bool VectorChannelClass::SaveTimeCoded(ChunkSaveClass & csave, BitChannelClass * return false; } - if (chn != NULL) { + if (chn != nullptr) { free(chn); } @@ -439,7 +440,7 @@ bool VectorChannelClass::SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelCla W3dAdaptiveDeltaAnimChannelStruct * chn = (W3dAdaptiveDeltaAnimChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -563,7 +564,7 @@ bool VectorChannelClass::SaveAdaptiveDelta(ChunkSaveClass & csave, BitChannelCla return false; } - if (chn != NULL) { + if (chn != nullptr) { free(chn); } @@ -629,7 +630,7 @@ bool VectorChannelClass::Save(ChunkSaveClass & csave, BitChannelClass *binmov) W3dAnimChannelStruct * chn = (W3dAnimChannelStruct *)malloc(channelsize); - if (chn == NULL) { + if (chn == nullptr) { return false; } @@ -652,7 +653,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 969095a7b2..076c80fafc 100644 --- a/Core/Tools/WW3D/max2w3d/vxl.cpp +++ b/Core/Tools/WW3D/max2w3d/vxl.cpp @@ -35,6 +35,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "vxl.h" #include "errclass.h" @@ -96,7 +97,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 +164,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 bbe844fa81..e230280f64 100644 --- a/Core/Tools/WW3D/max2w3d/vxldbg.cpp +++ b/Core/Tools/WW3D/max2w3d/vxldbg.cpp @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "vxldbg.h" #include "resource.h" #include "dllmain.h" @@ -49,11 +50,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 +71,7 @@ void VoxelDebugWindowClass::Display_Window(void) ( AppInstance, MAKEINTRESOURCE (IDD_VOXEL_DEBUG_DIALOG), - NULL, + nullptr, (DLGPROC) _dialog_proc, (LPARAM) this ); @@ -120,7 +121,7 @@ bool VoxelDebugWindowClass::Dialog_Proc update_display(); - SetCursor(LoadCursor (NULL, IDC_ARROW)); + SetCursor(LoadCursor (nullptr, IDC_ARROW)); return 1; @@ -137,7 +138,7 @@ bool VoxelDebugWindowClass::Dialog_Proc case IDOK: // done! - SetCursor(LoadCursor (NULL, IDC_WAIT)); + SetCursor(LoadCursor (nullptr, IDC_WAIT)); EndDialog(hWnd, 1); break; } @@ -187,7 +188,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 +242,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 06e474e83a..5ce8ac79cf 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 6d36fd2ac2..d9b6c901ea 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 5800a967a9..16b075e444 100644 --- a/Core/Tools/WW3D/max2w3d/w3dappdata.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dappdata.cpp @@ -56,6 +56,7 @@ * Is_Aggregate -- check if a node is an aggregate object * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "w3dappdata.h" #include "w3dutil.h" #include "util.h" @@ -213,7 +214,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 +295,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 +331,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 +490,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 a79acf429a..7f08e8473f 100644 --- a/Core/Tools/WW3D/max2w3d/w3dappdata.h +++ b/Core/Tools/WW3D/max2w3d/w3dappdata.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include @@ -118,7 +119,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 081f736e44..2c0e0d47bc 100644 --- a/Core/Tools/WW3D/max2w3d/w3ddlg.cpp +++ b/Core/Tools/WW3D/max2w3d/w3ddlg.cpp @@ -35,6 +35,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "w3ddlg.h" #include "resource.h" #include "dllmain.h" @@ -80,8 +81,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 +172,7 @@ bool W3dOptionsDialogClass::Dialog_Proc return 1; } - SetCursor(LoadCursor (NULL, IDC_WAIT)); + SetCursor(LoadCursor (nullptr, IDC_WAIT)); EndDialog(Hwnd, 1); break; @@ -211,7 +212,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 +235,7 @@ bool W3dOptionsDialogClass::Dialog_Proc SetSaveRequiredFlag(true); } - _HierarchyFileOFN.lpstrFile = NULL; + _HierarchyFileOFN.lpstrFile = nullptr; break; } return 1; @@ -272,7 +273,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 +767,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 +799,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 b1ade39381..9dac390f9c 100644 --- a/Core/Tools/WW3D/max2w3d/w3dexp.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dexp.cpp @@ -49,6 +49,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "rawfile.h" #include "chunkio.h" #include "w3dexp.h" @@ -225,10 +226,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 +244,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 +252,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 +272,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 +280,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 +302,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 +351,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 +373,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 +391,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 +405,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 +421,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 +437,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 +467,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 +482,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 +507,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 +520,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 +550,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 +585,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 +601,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 +632,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 +665,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 +680,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 +692,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 +725,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 +784,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 +817,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 +942,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 +956,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 +966,7 @@ HierarchySaveClass * W3dExportClass::get_hierarchy_tree(void) ** function failed to create a hierarchy tree for us. */ assert(0); - return NULL; + return nullptr; } @@ -983,7 +984,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 +1009,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 +1052,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 +1160,7 @@ void W3dExportClass::Start_Progress_Bar(void) "Processing Triangle Mesh", TRUE, progress_callback, - NULL); + nullptr); } /*********************************************************************************************** @@ -1192,7 +1193,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 +1206,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 +1221,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 +1240,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 +1266,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 +1280,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 df69186b38..34b004ac18 100644 --- a/Core/Tools/WW3D/max2w3d/w3dexp.h +++ b/Core/Tools/WW3D/max2w3d/w3dexp.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include @@ -108,7 +109,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 f86727e9d2..256a979a7d 100644 --- a/Core/Tools/WW3D/max2w3d/w3dmtl.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dmtl.cpp @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "w3dmtl.h" #include #include @@ -87,8 +88,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 +102,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 +129,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 +153,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 +174,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 +227,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 +240,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 +264,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 +584,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 +680,10 @@ bool W3dMaterialClass::Is_Multi_Pass_Transparent(void) const W3dMaterialDescClass::VertMatClass::VertMatClass(void) : PassIndex(-1), Crc(0), - Name(NULL) + Name() { for (int stage=0; stage < W3dMaterialClass::MAX_STAGES; ++stage) { - MapperArgs[stage] = NULL; + MapperArgs[stage] = nullptr; } } @@ -693,7 +694,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 +731,7 @@ void W3dMaterialDescClass::VertMatClass::Set_Name(const char * name) if (name) { Name = strdup(name); } else { - Name = NULL; + Name = nullptr; } } @@ -738,7 +739,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 +747,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 +971,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 +981,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 +991,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 +1001,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 +1016,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 +1088,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 +1132,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 +1186,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 54fb2bd9a1..8b587f984b 100644 --- a/Core/Tools/WW3D/max2w3d/w3dmtl.h +++ b/Core/Tools/WW3D/max2w3d/w3dmtl.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "w3d_file.h" @@ -52,7 +53,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 +89,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 +164,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 7cf6ad3b1f..ff9fd154b0 100644 --- a/Core/Tools/WW3D/max2w3d/w3dutil.cpp +++ b/Core/Tools/WW3D/max2w3d/w3dutil.cpp @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "w3dutil.h" #include "w3ddesc.h" #include "rcmenu.h" @@ -130,7 +131,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 +240,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 +333,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 +373,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 +742,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 +770,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 +790,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 +806,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 +835,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 +854,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 +866,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 +880,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 +896,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 +914,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 +928,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 +976,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 +984,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 +992,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 +1000,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 +1008,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 +1016,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 +1135,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 +1166,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 +1261,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 +1285,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 +1303,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 +1422,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 +1446,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 +1477,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 +1488,13 @@ SettingsFormClass::~SettingsFormClass(void) } } - Hwnd = NULL; + Hwnd = nullptr; } void SettingsFormClass::Update_All_Instances(void) { - if (ActiveList == NULL) { + if (ActiveList == nullptr) { return; } @@ -1508,7 +1509,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 +1521,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 +1541,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 +1574,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 +1727,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 +1802,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 aa2ce7b26f..5ff7135ed0 100644 --- a/Core/Tools/WW3D/pluglib/Vector.h +++ b/Core/Tools/WW3D/pluglib/Vector.h @@ -51,6 +51,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "noinit.h" #include @@ -127,7 +128,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 +418,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 +523,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. (nullptr 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 +810,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 +828,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 +836,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 +973,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 +983,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 +996,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 79a856d238..24d65f759d 100644 --- a/Core/Tools/WW3D/pluglib/always.h +++ b/Core/Tools/WW3D/pluglib/always.h @@ -147,7 +147,8 @@ template T max(T a,T b) #ifndef NULL - #define NULL 0 + //#define NULL 0 + // NULL is now deprecated - use nullptr instead #endif /********************************************************************** diff --git a/Core/Tools/WW3D/pluglib/chunkio.cpp b/Core/Tools/WW3D/pluglib/chunkio.cpp index 0a34f07526..f16084be9f 100644 --- a/Core/Tools/WW3D/pluglib/chunkio.cpp +++ b/Core/Tools/WW3D/pluglib/chunkio.cpp @@ -62,6 +62,7 @@ * ChunkLoadClass::Read -- read an IOQuaternionStruct * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "chunkio.h" #include #include @@ -733,7 +734,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 +753,7 @@ uint32 ChunkLoadClass::Read(IOVector2Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector3Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -771,7 +772,7 @@ uint32 ChunkLoadClass::Read(IOVector3Struct * v) *=============================================================================================*/ uint32 ChunkLoadClass::Read(IOVector4Struct * v) { - assert(v != NULL); + assert(v != nullptr); return Read(v,sizeof(v)); } @@ -790,7 +791,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 60c26fa0cf..400f966a25 100644 --- a/Core/Tools/WW3D/pluglib/errclass.h +++ b/Core/Tools/WW3D/pluglib/errclass.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include @@ -45,7 +46,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 +65,19 @@ inline ErrorClass::ErrorClass(char * format,...) } inline ErrorClass::ErrorClass(const ErrorClass & that) : - error_message(NULL) + error_message() { *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 0b9afa7fcc..42f9a2b1b5 100644 --- a/Core/Tools/WW3D/pluglib/matrix3d.cpp +++ b/Core/Tools/WW3D/pluglib/matrix3d.cpp @@ -51,6 +51,7 @@ * Lerp - linearly interpolate matrices (orientation is slerped) * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "matrix3d.h" #include @@ -580,7 +581,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 be1d3886fa..1fec32fa26 100644 --- a/Core/Tools/WW3D/pluglib/nodefilt.cpp +++ b/Core/Tools/WW3D/pluglib/nodefilt.cpp @@ -44,6 +44,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "nodefilt.h" #include @@ -245,14 +246,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 ef13af11c7..03388a3db6 100644 --- a/Core/Tools/WW3D/pluglib/nodelist.cpp +++ b/Core/Tools/WW3D/pluglib/nodelist.cpp @@ -46,6 +46,7 @@ * INodeListClass::Remove -- Remove the i'th element of the list * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "nodelist.h" @@ -84,10 +85,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 +111,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 +136,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 +161,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 +291,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 +312,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 +364,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 e7adc255e3..157b875545 100644 --- a/Core/Tools/WW3D/pluglib/nodelist.h +++ b/Core/Tools/WW3D/pluglib/nodelist.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include @@ -60,10 +61,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 996312b9f9..07848d3596 100644 --- a/Core/Tools/WW3D/pluglib/rawfile.cpp +++ b/Core/Tools/WW3D/pluglib/rawfile.cpp @@ -52,6 +52,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "always.h" #include "rawfile.h" #include @@ -176,7 +177,7 @@ RawFileClass::RawFileClass(void) : *=============================================================================================*/ bool RawFileClass::Is_Open(void) const { - return(Handle != NULL_HANDLE); + return(Handle != nullptr); } /*********************************************************************************************** @@ -294,7 +295,7 @@ void RawFileClass::Reset(void) Close(); if (Allocated && Filename) { free((char *)Filename); - Filename = NULL; + Filename = nullptr; Allocated = false; } } @@ -321,18 +322,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 +410,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 +443,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 +452,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 +463,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; } @@ -479,7 +480,7 @@ int RawFileClass::Open(int rights) ** For the case of the file cannot be found, then allow a retry. All other cases ** are fatal. */ - if (Handle == NULL_HANDLE) { + if (Handle == nullptr) { return(false); // Error(GetLastError(), false, Filename); @@ -511,7 +512,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,10 +541,10 @@ 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) { + if (Handle == nullptr) { return(false); } break; @@ -620,10 +621,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 +676,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 +742,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 +892,7 @@ int RawFileClass::Size(void) size=endpos-startpos; fsetpos(Handle,&curpos); #else - size = GetFileSize(Handle, NULL); + size = GetFileSize(Handle, nullptr); #endif /* @@ -1190,7 +1191,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 40d81d696a..317fbd7213 100644 --- a/Core/Tools/WW3D/pluglib/rawfile.h +++ b/Core/Tools/WW3D/pluglib/rawfile.h @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include //#include @@ -47,7 +48,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 +106,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 +146,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 +180,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 nullptr. * * * * 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 1b89db61b3..fdedf6ede9 100644 --- a/Core/Tools/WW3D/pluglib/uarray.h +++ b/Core/Tools/WW3D/pluglib/uarray.h @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #ifndef HASHCALC_H #include "hashcalc.h" @@ -151,9 +152,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 91ff7d7e93..338493f24c 100644 --- a/Core/Tools/WW3D/pluglib/vector2.h +++ b/Core/Tools/WW3D/pluglib/vector2.h @@ -50,6 +50,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwmath.h" @@ -625,7 +626,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 9249b8a5c1..6b2f3847ed 100644 --- a/Core/Tools/WW3D/pluglib/vector3.h +++ b/Core/Tools/WW3D/pluglib/vector3.h @@ -64,6 +64,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwmath.h" @@ -535,7 +536,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 +544,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 +564,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 +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/Tools/WW3D/pluglib/w3d_file.h b/Core/Tools/WW3D/pluglib/w3d_file.h index 98f09b88e0..644cfa4fa1 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 f50922fbe5..dde5741aa7 100644 --- a/Core/Tools/WW3D/pluglib/w3dquat.cpp +++ b/Core/Tools/WW3D/pluglib/w3dquat.cpp @@ -49,6 +49,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "w3dquat.h" #include "matrix3d.h" #include "matrix4.h" @@ -337,7 +338,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 b0ddb01e27..994608f5ac 100644 --- a/Core/Tools/WW3D/pluglib/w3dquat.h +++ b/Core/Tools/WW3D/pluglib/w3dquat.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwmath.h" @@ -231,7 +232,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 1ae0e39403..c7253bd812 100644 --- a/Core/Tools/WW3D/pluglib/wwfile.h +++ b/Core/Tools/WW3D/pluglib/wwfile.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #ifdef _UNIX #include "osdep.h" @@ -54,7 +55,8 @@ #endif #ifndef NULL - #define NULL 0 + //#define NULL 0 + // NULL is now deprecated - use nullptr instead #endif @@ -86,7 +88,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/CMakeLists.txt b/Core/Tools/buildVersionUpdate/CMakeLists.txt index cad2418d55..c070924350 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 + core_utility ) diff --git a/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp b/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp index 18de6bd75b..a50d49809b 100644 --- a/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp +++ b/Core/Tools/buildVersionUpdate/buildVersionUpdate.cpp @@ -22,6 +22,7 @@ // SYSTEM INCLUDES //////////////////////////////////////////////////////////// #define WIN32_LEAN_AND_MEAN // only bare bones windows stuff wanted +#include #include #include #include @@ -83,13 +84,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 +111,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 5f758520f2..bcf79b48f4 100644 --- a/Core/Tools/mangler/mangler.cpp +++ b/Core/Tools/mangler/mangler.cpp @@ -17,6 +17,7 @@ */ +#include #include #include @@ -51,7 +52,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 +65,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 033359a3d1..330637125c 100644 --- a/Core/Tools/mangler/manglertest.cpp +++ b/Core/Tools/mangler/manglertest.cpp @@ -17,6 +17,7 @@ */ +#include #include #include @@ -47,9 +48,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 nullptr"); return 0; } @@ -59,7 +60,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 +83,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 +96,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 58c8481842..32a379b130 100644 --- a/Core/Tools/mangler/wlib/arraylist.h +++ b/Core/Tools/mangler/wlib/arraylist.h @@ -45,6 +45,7 @@ that don't belong to them, etc... \****************************************************************************/ #pragma once +#include #include #include @@ -131,7 +132,7 @@ ArrayList::ArrayList() { Entries_=0; Slots_=0; - Vector_=NULL; + Vector_=nullptr; } // copy constructor @@ -140,7 +141,7 @@ ArrayList::ArrayList(ArrayList &other) { Entries_=0; Slots_=0; - Vector_=NULL; + Vector_=nullptr; (*this)=other; } @@ -653,7 +654,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 +693,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 bed6c86446..12a2f0aced 100644 --- a/Core/Tools/mangler/wlib/configfile.cpp +++ b/Core/Tools/mangler/wlib/configfile.cpp @@ -38,6 +38,7 @@ the left is used for retrieval and it must be specified in uppercase for the 'get' functions. E.g. getString("KEY",valWstring); \***************************************************************************/ +#include #include #include #include @@ -97,7 +98,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('='); @@ -137,7 +138,7 @@ bit8 ConfigFile::readFile(FILE *in) // Enum through the config strings. To start, index & offset should be 0 // If retval is false you're done, ignore whatever's in key & value. // -// Section specifies the configfile section. Set to NULL if you don't care. +// Section specifies the configfile section. Set to nullptr if you don't care. // bit8 ConfigFile::enumerate(int &index, int &offset, Wstring &key, Wstring &value, IN char *section) const { @@ -152,7 +153,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 eba5a02c81..86592a15ff 100644 --- a/Core/Tools/mangler/wlib/configfile.h +++ b/Core/Tools/mangler/wlib/configfile.h @@ -27,6 +27,7 @@ Last Update : May 13, 1999 \***************************************************************************/ #pragma once +#include #include "wstypes.h" #include "dictionary.h" @@ -40,25 +41,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 d02aae76c9..5d43b6e725 100644 --- a/Core/Tools/mangler/wlib/critsec.cpp +++ b/Core/Tools/mangler/wlib/critsec.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "critsec.h" #include #include "wlib/wdebug.h" @@ -25,7 +26,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 687667d74d..8a62ab0a20 100644 --- a/Core/Tools/mangler/wlib/critsec.h +++ b/Core/Tools/mangler/wlib/critsec.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "wstypes.h" #ifdef _WIN32 @@ -45,7 +46,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 2a21b5273b..41325da3cd 100644 --- a/Core/Tools/mangler/wlib/dictionary.h +++ b/Core/Tools/mangler/wlib/dictionary.h @@ -36,6 +36,7 @@ your hashing function is good. \****************************************************************************/ #pragma once +#include #include #include @@ -83,7 +84,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 +152,13 @@ void Dictionary::clear() for (i=0; ihashNext; delete(del); } - table[i]=NULL; + table[i]=nullptr; } entries=0; @@ -189,7 +190,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 +224,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 +273,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 +331,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 +368,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 +382,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 +391,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 +426,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 +455,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 +509,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 +545,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 +573,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 +616,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 +655,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 2d00ab1afa..a400e691b4 100644 --- a/Core/Tools/mangler/wlib/filed.h +++ b/Core/Tools/mangler/wlib/filed.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "odevice.h" @@ -26,7 +27,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 8589c3c45c..f936f2da22 100644 --- a/Core/Tools/mangler/wlib/linkedlist.h +++ b/Core/Tools/mangler/wlib/linkedlist.h @@ -34,6 +34,7 @@ If you want to store pointers then the template should be of a pointer type. \****************************************************************************/ #pragma once +#include #include #include @@ -63,9 +64,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 +107,7 @@ template LinkedList::LinkedList() { Entries=0; - Head=Tail=Current=NULL; + Head=Tail=Current=nullptr; CurIndex=-1; // Not valid when 0 entries } @@ -115,7 +116,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 +157,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 +174,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 +229,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 +279,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 +288,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 +298,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 +338,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 +442,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 a45eff3700..4f61e9ae7c 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 103409de5c..fff00e918d 100644 --- a/Core/Tools/mangler/wlib/monod.cpp +++ b/Core/Tools/mangler/wlib/monod.cpp @@ -16,18 +16,19 @@ ** along with this program. If not, see . */ +#include #include "monod.h" 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 +38,7 @@ MonoD::~MonoD() { #ifdef _WIN32 CloseHandle(handle); - handle=NULL; + handle = nullptr; #endif } @@ -45,8 +46,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 e11b95a362..3e4e146fc7 100644 --- a/Core/Tools/mangler/wlib/sem4.cpp +++ b/Core/Tools/mangler/wlib/sem4.cpp @@ -25,6 +25,7 @@ This is useful because the constructor will automatically call sem_init libraries if you don't have posix. \******************************************************************************/ +#include #include "sem4.h" #ifdef _REENTRANT @@ -34,7 +35,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 +44,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 +85,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 061baad77d..626f0fe942 100644 --- a/Core/Tools/mangler/wlib/streamer.cpp +++ b/Core/Tools/mangler/wlib/streamer.cpp @@ -17,6 +17,7 @@ */ +#include #include "streamer.h" #ifdef _WIN32 #include @@ -28,7 +29,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 +102,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 e9934e71b6..b9b6aaafa8 100644 --- a/Core/Tools/mangler/wlib/threadfac.cpp +++ b/Core/Tools/mangler/wlib/threadfac.cpp @@ -18,6 +18,7 @@ #define THREADFAC_CODE +#include #include "threadfac.h" int Runnable::ThreadCount_ = 0; @@ -73,8 +74,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 +93,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 +127,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 +138,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 a7490a1bbb..d57001829e 100644 --- a/Core/Tools/mangler/wlib/wdebug.cpp +++ b/Core/Tools/mangler/wlib/wdebug.cpp @@ -16,28 +16,29 @@ ** along with this program. If not, see . */ +#include #include #include "wdebug.h" #include "streamer.h" #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 +52,7 @@ CritSec DebugLibSemaphore; int MsgManager::setAllStreams(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -86,10 +87,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 +118,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 +131,7 @@ int MsgManager::setDebugStream(OutputDevice *device) int MsgManager::setInfoStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -143,7 +144,7 @@ int MsgManager::setInfoStream(OutputDevice *device) int MsgManager::setWarnStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -156,7 +157,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 a19c9aaa00..1211493a65 100644 --- a/Core/Tools/mangler/wlib/wstring.cpp +++ b/Core/Tools/mangler/wlib/wstring.cpp @@ -29,6 +29,7 @@ A fairly typical string class. This string class always copies any input string to it's own memory (for assignment or construction). \***************************************************************************/ +#include #include #include #include @@ -39,15 +40,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 +63,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 +74,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 +84,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 +108,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 +142,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 +241,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 +268,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 +309,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 +318,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 +398,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 +446,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 +507,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 +530,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 +538,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 +559,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 +576,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 c13ef1fa3c..4aa6a0459a 100644 --- a/Core/Tools/mangler/wlib/wstypes.h +++ b/Core/Tools/mangler/wlib/wstypes.h @@ -73,7 +73,8 @@ Standard type definitions for the sake of portability and readability. #endif #ifndef NULL -#define NULL 0 +//#define NULL 0 +// NULL is now deprecated - use nullptr instead #endif //These are used for readability purposes mostly, when a method takes a diff --git a/Core/Tools/mangler/wlib/xtime.cpp b/Core/Tools/mangler/wlib/xtime.cpp index d36a7ec187..95f6533d14 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 699b52507c..c9b3920f40 100644 --- a/Core/Tools/mangler/wnet/field.cpp +++ b/Core/Tools/mangler/wnet/field.cpp @@ -32,6 +32,7 @@ *-------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include #include #ifndef _WIN32 @@ -51,56 +52,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/packet.cpp b/Core/Tools/mangler/wnet/packet.cpp index 8cda4f64b0..efcbc3bb5f 100644 --- a/Core/Tools/mangler/wnet/packet.cpp +++ b/Core/Tools/mangler/wnet/packet.cpp @@ -35,6 +35,7 @@ * PacketClass::~PacketClass -- destroys a packet class be freeing list * * PacketClass::Add_Field -- Adds a FieldClass entry to head of packet li* * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include #include #include @@ -114,7 +115,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 +269,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 +281,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 66ea079c7a..b4837223e0 100644 --- a/Core/Tools/mangler/wnet/tcp.cpp +++ b/Core/Tools/mangler/wnet/tcp.cpp @@ -96,6 +96,7 @@ while (1) \****************************************************************************/ +#include #include "tcp.h" #include @@ -472,7 +473,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 +486,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 +500,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 +552,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 +893,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 +979,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 +1065,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 bba9479b65..875d46e2b8 100644 --- a/Core/Tools/mangler/wnet/udp.cpp +++ b/Core/Tools/mangler/wnet/udp.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "udp.h" #include "wlib/wdebug.h" @@ -40,7 +41,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 +159,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 +169,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 +268,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 c0ed7b12e1..d575079010 100644 --- a/Core/Tools/matchbot/encrypt.cpp +++ b/Core/Tools/matchbot/encrypt.cpp @@ -17,6 +17,7 @@ */ +#include #include #include #include "encrypt.h" @@ -69,7 +70,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 8c6837a879..65b30fbba2 100644 --- a/Core/Tools/matchbot/generals.cpp +++ b/Core/Tools/matchbot/generals.cpp @@ -17,6 +17,7 @@ */ #ifdef _WIN32 +#include #include #endif @@ -135,7 +136,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 +190,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 +435,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 +525,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 +561,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 +620,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 +666,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 +750,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 +815,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 +912,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 +960,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 +980,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 +991,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 +1025,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 +1107,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 +1130,7 @@ GeneralsUser* GeneralsMatcher::removeUserInAnyLadder(const std::string& who) return user; } } - return NULL; + return nullptr; } GeneralsUser* GeneralsMatcher::removeNonLadderUser(const std::string& who) @@ -1166,14 +1167,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 +1293,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 1abe63c1cf..d0c4888c2f 100644 --- a/Core/Tools/matchbot/global.cpp +++ b/Core/Tools/matchbot/global.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include // for FILE ops #include "global.h" @@ -27,7 +28,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 8b0a78fb57..3075073933 100644 --- a/Core/Tools/matchbot/main.cpp +++ b/Core/Tools/matchbot/main.cpp @@ -17,6 +17,7 @@ */ #ifdef _WIN32 +#include #include #endif #include @@ -56,8 +57,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 +112,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 +125,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 +242,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 +270,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 +346,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 53f4c95a56..1668170d16 100644 --- a/Core/Tools/matchbot/matcher.cpp +++ b/Core/Tools/matchbot/matcher.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "global.h" #include "matcher.h" #include "encrypt.h" @@ -61,7 +62,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 +90,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 +220,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 +229,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 +273,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 +397,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 3ad1e156e4..93ba1383fd 100644 --- a/Core/Tools/matchbot/mydebug.cpp +++ b/Core/Tools/matchbot/mydebug.cpp @@ -16,16 +16,17 @@ ** along with this program. If not, see . */ +#include #include #include "mydebug.h" #include "streamer.h" #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 +39,7 @@ CritSec MyDebugLibSemaphore; int MyMsgManager::setAllStreams(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); MYDEBUGLOCK; @@ -54,7 +55,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 58c8481842..32a379b130 100644 --- a/Core/Tools/matchbot/wlib/arraylist.h +++ b/Core/Tools/matchbot/wlib/arraylist.h @@ -45,6 +45,7 @@ that don't belong to them, etc... \****************************************************************************/ #pragma once +#include #include #include @@ -131,7 +132,7 @@ ArrayList::ArrayList() { Entries_=0; Slots_=0; - Vector_=NULL; + Vector_=nullptr; } // copy constructor @@ -140,7 +141,7 @@ ArrayList::ArrayList(ArrayList &other) { Entries_=0; Slots_=0; - Vector_=NULL; + Vector_=nullptr; (*this)=other; } @@ -653,7 +654,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 +693,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 bed6c86446..12a2f0aced 100644 --- a/Core/Tools/matchbot/wlib/configfile.cpp +++ b/Core/Tools/matchbot/wlib/configfile.cpp @@ -38,6 +38,7 @@ the left is used for retrieval and it must be specified in uppercase for the 'get' functions. E.g. getString("KEY",valWstring); \***************************************************************************/ +#include #include #include #include @@ -97,7 +98,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('='); @@ -137,7 +138,7 @@ bit8 ConfigFile::readFile(FILE *in) // Enum through the config strings. To start, index & offset should be 0 // If retval is false you're done, ignore whatever's in key & value. // -// Section specifies the configfile section. Set to NULL if you don't care. +// Section specifies the configfile section. Set to nullptr if you don't care. // bit8 ConfigFile::enumerate(int &index, int &offset, Wstring &key, Wstring &value, IN char *section) const { @@ -152,7 +153,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 eba5a02c81..86592a15ff 100644 --- a/Core/Tools/matchbot/wlib/configfile.h +++ b/Core/Tools/matchbot/wlib/configfile.h @@ -27,6 +27,7 @@ Last Update : May 13, 1999 \***************************************************************************/ #pragma once +#include #include "wstypes.h" #include "dictionary.h" @@ -40,25 +41,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 d02aae76c9..5d43b6e725 100644 --- a/Core/Tools/matchbot/wlib/critsec.cpp +++ b/Core/Tools/matchbot/wlib/critsec.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "critsec.h" #include #include "wlib/wdebug.h" @@ -25,7 +26,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 687667d74d..8a62ab0a20 100644 --- a/Core/Tools/matchbot/wlib/critsec.h +++ b/Core/Tools/matchbot/wlib/critsec.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "wstypes.h" #ifdef _WIN32 @@ -45,7 +46,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 2a21b5273b..41325da3cd 100644 --- a/Core/Tools/matchbot/wlib/dictionary.h +++ b/Core/Tools/matchbot/wlib/dictionary.h @@ -36,6 +36,7 @@ your hashing function is good. \****************************************************************************/ #pragma once +#include #include #include @@ -83,7 +84,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 +152,13 @@ void Dictionary::clear() for (i=0; ihashNext; delete(del); } - table[i]=NULL; + table[i]=nullptr; } entries=0; @@ -189,7 +190,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 +224,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 +273,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 +331,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 +368,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 +382,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 +391,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 +426,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 +455,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 +509,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 +545,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 +573,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 +616,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 +655,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 2d00ab1afa..a400e691b4 100644 --- a/Core/Tools/matchbot/wlib/filed.h +++ b/Core/Tools/matchbot/wlib/filed.h @@ -17,6 +17,7 @@ */ #pragma once +#include #include "odevice.h" @@ -26,7 +27,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 8589c3c45c..f936f2da22 100644 --- a/Core/Tools/matchbot/wlib/linkedlist.h +++ b/Core/Tools/matchbot/wlib/linkedlist.h @@ -34,6 +34,7 @@ If you want to store pointers then the template should be of a pointer type. \****************************************************************************/ #pragma once +#include #include #include @@ -63,9 +64,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 +107,7 @@ template LinkedList::LinkedList() { Entries=0; - Head=Tail=Current=NULL; + Head=Tail=Current=nullptr; CurIndex=-1; // Not valid when 0 entries } @@ -115,7 +116,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 +157,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 +174,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 +229,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 +279,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 +288,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 +298,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 +338,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 +442,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 a45eff3700..4f61e9ae7c 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 103409de5c..fff00e918d 100644 --- a/Core/Tools/matchbot/wlib/monod.cpp +++ b/Core/Tools/matchbot/wlib/monod.cpp @@ -16,18 +16,19 @@ ** along with this program. If not, see . */ +#include #include "monod.h" 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 +38,7 @@ MonoD::~MonoD() { #ifdef _WIN32 CloseHandle(handle); - handle=NULL; + handle = nullptr; #endif } @@ -45,8 +46,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 e11b95a362..3e4e146fc7 100644 --- a/Core/Tools/matchbot/wlib/sem4.cpp +++ b/Core/Tools/matchbot/wlib/sem4.cpp @@ -25,6 +25,7 @@ This is useful because the constructor will automatically call sem_init libraries if you don't have posix. \******************************************************************************/ +#include #include "sem4.h" #ifdef _REENTRANT @@ -34,7 +35,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 +44,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 +85,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 061baad77d..626f0fe942 100644 --- a/Core/Tools/matchbot/wlib/streamer.cpp +++ b/Core/Tools/matchbot/wlib/streamer.cpp @@ -17,6 +17,7 @@ */ +#include #include "streamer.h" #ifdef _WIN32 #include @@ -28,7 +29,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 +102,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 e9934e71b6..b9b6aaafa8 100644 --- a/Core/Tools/matchbot/wlib/threadfac.cpp +++ b/Core/Tools/matchbot/wlib/threadfac.cpp @@ -18,6 +18,7 @@ #define THREADFAC_CODE +#include #include "threadfac.h" int Runnable::ThreadCount_ = 0; @@ -73,8 +74,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 +93,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 +127,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 +138,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 8dd5005ecb..5c872a0cae 100644 --- a/Core/Tools/matchbot/wlib/wdebug.cpp +++ b/Core/Tools/matchbot/wlib/wdebug.cpp @@ -16,28 +16,29 @@ ** along with this program. If not, see . */ +#include #include #include "wdebug.h" #include "streamer.h" #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 +52,7 @@ CritSec DebugLibSemaphore; int MsgManager::setAllStreams(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -112,7 +113,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 +126,7 @@ int MsgManager::setDebugStream(OutputDevice *device) int MsgManager::setInfoStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -138,7 +139,7 @@ int MsgManager::setInfoStream(OutputDevice *device) int MsgManager::setWarnStream(OutputDevice *device) { - if (device==NULL) + if (device==nullptr) return(1); DEBUGLOCK; @@ -151,7 +152,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 a19c9aaa00..1211493a65 100644 --- a/Core/Tools/matchbot/wlib/wstring.cpp +++ b/Core/Tools/matchbot/wlib/wstring.cpp @@ -29,6 +29,7 @@ A fairly typical string class. This string class always copies any input string to it's own memory (for assignment or construction). \***************************************************************************/ +#include #include #include #include @@ -39,15 +40,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 +63,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 +74,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 +84,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 +108,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 +142,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 +241,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 +268,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 +309,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 +318,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 +398,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 +446,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 +507,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 +530,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 +538,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 +559,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 +576,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 c13ef1fa3c..4aa6a0459a 100644 --- a/Core/Tools/matchbot/wlib/wstypes.h +++ b/Core/Tools/matchbot/wlib/wstypes.h @@ -73,7 +73,8 @@ Standard type definitions for the sake of portability and readability. #endif #ifndef NULL -#define NULL 0 +//#define NULL 0 +// NULL is now deprecated - use nullptr instead #endif //These are used for readability purposes mostly, when a method takes a diff --git a/Core/Tools/matchbot/wlib/xtime.cpp b/Core/Tools/matchbot/wlib/xtime.cpp index d36a7ec187..95f6533d14 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 699b52507c..c9b3920f40 100644 --- a/Core/Tools/matchbot/wnet/field.cpp +++ b/Core/Tools/matchbot/wnet/field.cpp @@ -32,6 +32,7 @@ *-------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include #include #ifndef _WIN32 @@ -51,56 +52,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/packet.cpp b/Core/Tools/matchbot/wnet/packet.cpp index 8cda4f64b0..efcbc3bb5f 100644 --- a/Core/Tools/matchbot/wnet/packet.cpp +++ b/Core/Tools/matchbot/wnet/packet.cpp @@ -35,6 +35,7 @@ * PacketClass::~PacketClass -- destroys a packet class be freeing list * * PacketClass::Add_Field -- Adds a FieldClass entry to head of packet li* * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include #include #include @@ -114,7 +115,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 +269,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 +281,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 66ea079c7a..b4837223e0 100644 --- a/Core/Tools/matchbot/wnet/tcp.cpp +++ b/Core/Tools/matchbot/wnet/tcp.cpp @@ -96,6 +96,7 @@ while (1) \****************************************************************************/ +#include #include "tcp.h" #include @@ -472,7 +473,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 +486,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 +500,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 +552,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 +893,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 +979,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 +1065,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 bba9479b65..875d46e2b8 100644 --- a/Core/Tools/matchbot/wnet/udp.cpp +++ b/Core/Tools/matchbot/wnet/udp.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "udp.h" #include "wlib/wdebug.h" @@ -40,7 +41,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 +159,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 +169,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 +268,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 ca4017d519..4ad3aa06ea 100644 --- a/Core/Tools/textureCompress/textureCompress.cpp +++ b/Core/Tools/textureCompress/textureCompress.cpp @@ -22,6 +22,7 @@ // SYSTEM INCLUDES //////////////////////////////////////////////////////////// #define WIN32_LEAN_AND_MEAN // only bare bones windows stuff wanted //#include +#include #include #include #include @@ -41,14 +42,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 +62,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 +71,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 +318,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 +333,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 +597,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 +634,7 @@ int main(int argc, const char **argv) #ifdef RTS_DEBUG delete theDebugMunkee; - theDebugMunkee = NULL; + theDebugMunkee = nullptr; #endif } diff --git a/Core/Tools/versionUpdate/CMakeLists.txt b/Core/Tools/versionUpdate/CMakeLists.txt index e9d1f21dec..00ee21b7d4 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 + core_utility ) diff --git a/Core/Tools/versionUpdate/versionUpdate.cpp b/Core/Tools/versionUpdate/versionUpdate.cpp index e8c1a90929..20e2178e6b 100644 --- a/Core/Tools/versionUpdate/versionUpdate.cpp +++ b/Core/Tools/versionUpdate/versionUpdate.cpp @@ -22,6 +22,7 @@ // SYSTEM INCLUDES //////////////////////////////////////////////////////////// #define WIN32_LEAN_AND_MEAN // only bare bones windows stuff wanted +#include #include #include #include @@ -99,13 +100,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 +125,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/CMakeLists.txt b/Core/Tools/wolSetup/CMakeLists.txt index 01e253838f..36510f7078 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 + core_utility Version ) diff --git a/Core/Tools/wolSetup/WOLAPI/chatdefs.h b/Core/Tools/wolSetup/WOLAPI/chatdefs.h index e0175d7574..11fef9d3ee 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 3f51d306aa..4e1b191029 100644 --- a/Core/Tools/wolSetup/verchk.cpp +++ b/Core/Tools/wolSetup/verchk.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "verchk.h" #include "wolSetup.h" #include @@ -34,7 +35,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 912f470522..8569404ad2 100644 --- a/Core/Tools/wolSetup/wolInit.cpp +++ b/Core/Tools/wolSetup/wolInit.cpp @@ -23,6 +23,7 @@ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif +#include #include #include @@ -78,7 +79,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 +94,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 +110,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 +126,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 +146,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 +178,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 +193,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 5ef59825bf..a3d5a95b2f 100644 --- a/Core/Tools/wolSetup/wolSetup.cpp +++ b/Core/Tools/wolSetup/wolSetup.cpp @@ -23,6 +23,7 @@ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif +#include #include #include #include @@ -44,7 +45,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 +53,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 +66,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 2616939a11..3637d38282 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 197c79f31f..16306b2d02 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 b44a88f2ff..ac1f1558fd 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 nullptr on creation then non-nullptr 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 710a76e55c..d41752782c 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 9c0e747d9c..fae748ad4d 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 nullptr. + // The parser of the base class should set this pointer to nullptr. 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 nullptr 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 424fa3ae6b..9bc7ffb12b 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 e13310fa18..5ddde9c630 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 77d9eb99d8..7163c0753c 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 35930f6fa1..a1b2809103 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 0e48452dc5..3854f3f048 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 5afca81bc1..88300bc02b 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 adc0e98e27..7c36d5a83e 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 f3f4182f90..84a46f043f 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 2662543140..5a5ed8a369 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 f395127884..4b1aaa1988 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 nullptr 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 d89ee69324..2cbee07c1e 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 071b35b348..8f03af506d 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 ddf3e3006b..6072171f24 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 2f0362b489..94db9062cc 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 38e3bbed4d..e96bf0f938 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 9a0e836dcf..24983d70d1 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 964612308b..bea16f4bf2 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 740accba46..4229638513 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 d510d1cc5c..4c1c7a8125 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 b0b2e2013e..3333c3c05f 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 838480831e..905ad0b789 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 e35702922c..1accc3dd49 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 f01dc7038e..28e14647e4 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 e3853a3710..8a4770cbe1 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 aebea584fa..b31f48c28d 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 19e6580aae..c95f8a332b 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 bba068bd64..5055907b0d 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 3d6a9d857c..1f213388e9 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 8d4c158d7c..fff5c3f446 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 1b469cc39c..46b954fc1d 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 5619581ef5..0644183c91 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 02313409ee..d6349031d8 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 5a8691a392..017a4048b1 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 3ffc2a4500..1b3cfb034a 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 16b1f1d7a4..9f73f894b8 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 2307e00547..0119bcf2d8 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 65d9ce60fb..95eab12337 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameText.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameText.h @@ -41,6 +41,7 @@ //---------------------------------------------------------------------------- #pragma once +#include //---------------------------------------------------------------------------- // Includes @@ -72,8 +73,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 05bcc41d18..f9d27b3593 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 6b14f7bba2..bdaa7863de 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 c267fa9f03..ce043f4a3b 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 0f68b50949..8b24a35a72 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 710b5efe41..0be9410584 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 5e21e33e5f..d024f84647 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Keyboard.h +++ b/Generals/Code/GameEngine/Include/GameClient/Keyboard.h @@ -113,7 +113,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 218ebb40b8..1e53c962b7 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Line2D.h +++ b/Generals/Code/GameEngine/Include/GameClient/Line2D.h @@ -28,6 +28,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once +#include typedef std::vector Coord2DVector; typedef std::vector Coord3DVector; @@ -39,10 +40,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-nullptr. 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 497f78f901..64e9291d72 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 92fd80497c..0e23f0e3be 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -297,7 +297,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 8b2194f533..76e1977066 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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 0ea345a84f..2e40ea7ae3 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 155c6e91bb..9736282563 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 dc2053d4cc..6194c046dd 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() { 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 9672c5668f..36d8a66dc1 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 a66480e02e..a9bd8b2cd7 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 1e42be0603..9c5d09d1e3 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 03f0de0e73..dccec8bdc1 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() { - 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 ec7efe9423..7aad137072 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 829d1e84f1..dacf23a594 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 d684bee367..9242375d90 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 452fde8ce2..e4f5c9fc88 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 0993841d0a..1b756ce122 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -405,11 +405,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 a074f4f349..9b324985bd 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 e73f804193..f15c33dd36 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 0482f737aa..49a6a188fb 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 nullptr 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 9a7cba0a7d..38571a4264 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 532cc02aed..fa5c711ae1 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 b0df5fec9d..4b32f7a1a4 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 c1f3a17834..de6c91aa4c 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 a746cd0b46..18070aa525 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 6feb21738a..fab4242c33 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 f63a0e6525..7620e94d06 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 9f6ff668e7..79fe86939f 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 a5ee0e8aca..d37a0d1344 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 08fc5d2dcf..5738f07c1e 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 2f1dde3040..e69b6a11e8 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 nullptr, 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 a9cee09e8c..8a227f58fe 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 4cbc1f77b1..3fab216672 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 4c81de8af1..cb753449c2 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 2487b2f3d2..b14723f0fa 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 414402c641..62dc454a5b 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 d5d3f63eb7..98bead9fb2 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 fcb180e8f9..defdf1184b 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 17b8925305..fa9018c5c8 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 74a90c299a..40ba705747 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 a6add30d44..ece6e5d86a 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 nullptr 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 nullptr 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 1488eecb0d..63b325b581 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 2472decda5..9e936a91ae 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 4d39ec7875..dbbf2f2af9 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 6e3da93801..4ed1081837 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 0ec32bde61..2eb6702b86 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 906e7784d9..4eb7c8893a 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 a7d6a9bc7c..5b16eccb24 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 b2c9a74d98..06f3e3e6f5 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 8599b393c5..f95eac09a6 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 374e0e3c42..f8b11cf192 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 2c73c868f0..02dbab9fec 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 65a4660852..2cb66b6154 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 67e3f81b68..fa0d1a73fd 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 3e8466d67b..3d2008bbbc 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 4f8e639bc2..4a06bd5db6 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 12a474cb61..c471d1ac8d 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 d6b0d0d305..784225c3be 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 fecfaa2e13..2c4fc7acd5 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; } diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h b/Generals/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h index cb28040e67..a9924377f3 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 b046386039..7ef41f73a2 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 35d4ea3b88..553975669c 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 f313a06f55..2e3f1222a7 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 17f2493284..767132c177 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 d30a0f3035..bd33014c85 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 9857791ba9..49dfd0cc32 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 239a853d12..9a9f5fce47 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 0dd4fec2a6..7085e89368 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 b800637373..5048bfd246 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 4add4ff719..e9bdb26658 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 6e64d81837..f4ca665634 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 b33a49da94..f29c3d7730 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 8cbcc525a4..2bf7617d7b 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 c8d458ef50..26589d7cd9 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 8c4639ca96..ee5336aff5 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 a4e8967c40..5356c02bbf 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 7bf3506088..a5da244dd7 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 debea0cc3e..b879ab17cb 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 0b1943bb8b..11c9a93b1b 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 d7eca3b994..790c7f8e18 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 7d332abe48..e799907855 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 41f95ad25d..2b95b78a06 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 3790710fc4..d545415f7d 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 649e36d359..b49f205f50 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 a9f089efa3..08bc0444de 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 eeb21ea77a..e33a10d0bc 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 fea5c20041..c912175b37 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-nullptr, 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 c5fcee6975..1a47e7aec9 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 03f15d38e3..3eebc9f8b3 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 18e278bb71..a2333a3d09 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 nullptr")); } 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 2cd94188ee..8ebe4d2fc2 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 53438b1244..3833455742 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 4a9d99212c..9c304f099a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h +++ b/Generals/Code/GameEngine/Include/GameLogic/ScriptActions.h @@ -28,6 +28,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once +#include class ScriptAction; class GameWindow; @@ -86,7 +87,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 bc025c88d8..9b8afe8ea8 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 70428cc389..4229f93572 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. nullptr 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. nullptr 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 3a2570aaae..036f0e9b0b 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 d75cb276f5..ed76589401 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 eecd011a36..b5c8fdbb56 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 4b56c34b8e..38335a7d2f 100644 --- a/Generals/Code/GameEngine/Include/GameNetwork/GameSpyChat.h +++ b/Generals/Code/GameEngine/Include/GameNetwork/GameSpyChat.h @@ -27,13 +27,14 @@ // Author: Matthew D. Campbell, February 2002 #pragma once +#include #include "gamespy/peer/peer.h" 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 ceb943c974..306ccf54d7 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 19678a6744..3e98f50434 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 cd1a4fa395..0b0b9cbb55 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 f9f9e58dfd..21b54df2ea 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 f8ce2dd61c..9415aaa1e4 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 nullptr")); + DEBUG_ASSERTCRASH(TheGameText != nullptr, ("TheGameText is nullptr")); 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 nullptr 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 nullptr")); 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 b4f4592ed2..0eb5eed8d2 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 870829597b..c9dd0a9442 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 348374f57f..1a9eb5121a 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 nullptr, 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 nullptr")); // 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 51b8fc2e8a..663cc91378 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 nullptr") ); // 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 nullptr" )); 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 0fd66a4045..ad333937b1 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 9bff103b0d..2f4eb32c5b 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 0d1f1a2509..5ca92f078f 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 bf7f0220cb..ddaee904a3 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 8d044752ae..21d5bbda29 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 ba62a15dbf..66d50d48f0 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 a83d5467ee..8e75daee04 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 114adb3e3d..1e4b0c1c94 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 98694736ff..8a10f8d35b 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 c652ab5185..94cbd4779f 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 5a231166fa..d6bdec167f 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 441782733d..59388d9f85 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 0af149735e..c11407a85e 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 aba90df696..cb1fed45d3 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 f9ec094415..41586135a2 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 f1efaf1b04..a1081e6c2a 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 1505f84619..48a39364d1 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 d588bc3cf8..bfade5fa77 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 @@ -518,7 +518,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 ) @@ -579,7 +579,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())) @@ -759,7 +759,7 @@ Bool ActionManager::canConvertObjectToCarBomb( const Object *obj, const Object * { // sanity - if( obj == NULL || objectToConvert == NULL ) + if( obj == nullptr || objectToConvert == nullptr ) { return FALSE; } @@ -797,7 +797,7 @@ Bool ActionManager::canHijackVehicle( const Object *obj, const Object *objectToH ++foo; // sanity - if( obj == NULL || objectToHijack == NULL ) + if( obj == nullptr || objectToHijack == nullptr ) { return FALSE; } @@ -868,7 +868,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; } @@ -904,7 +904,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. @@ -985,7 +985,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(); @@ -1007,7 +1007,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) @@ -1089,7 +1089,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 @@ -1106,14 +1106,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 @@ -1130,7 +1130,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. @@ -1215,7 +1215,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. @@ -1297,7 +1297,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; } @@ -1719,7 +1719,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; } @@ -1738,7 +1738,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; } @@ -1768,7 +1768,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; } @@ -1802,7 +1802,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) @@ -1836,7 +1836,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 f321b4b463..ddfa29ee0f 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 00237714f5..28c0a2621a 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 6fe1d4fca4..5ee709aff0 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 - nullptr 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 a14fce84fe..3e6b734858 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 3a07fa73bf..3bc7b22e2b 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 1decc6c6e6..d4152517d9 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 b0cef87c97..2f12f2652f 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 2951c86dd8..6cb201b246 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 0056c1f7e0..9dc096e318 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 74e9ed131b..8ff183cf27 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 f81283fdae..70d191026d 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 nullptr 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 541d644a7c..739215e5b6 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 nullptr")); 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 4e0c7aa5ce..4738d87005 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 ) ) { 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 nullptr 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 nullptr 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 96771ee1e2..a4b98e048d 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 9f05592a70..259dba75df 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 25e2a59e42..a04672d020 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 nullptr 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 a50549597e..56d180e517 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 37f4351ffe..6be4ec457b 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 63f980cb58..c0a416a9ef 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 7bc538d7cd..339d71f9b1 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 093f5e068a..da6d08e0a6 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 83d3994566..480e7e3464 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 185f9c36e9..f0f5adb9cd 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 0d77c3ffc6..55b79b6dac 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 5243135f51..cf6bc82342 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 0d0229142d..2352cdb8bf 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 c10fc093f4..5b5e9ac3fe 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 a1c06976e6..e248d5d6ff 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 77f89bedf7..6d4f65f048 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 f2a8360d89..0900bdfbd3 100644 --- a/Generals/Code/GameEngine/Source/Common/System/encrypt.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/encrypt.cpp @@ -26,6 +26,7 @@ // Ancient Westwood Online password encryption (obfuscation?) code // Author: Anonymous +#include #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine #include "Common/encrypt.h" @@ -78,7 +79,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 df4ab5f2ef..0fae0ca8a5 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 796f2fcc90..751ebacddd 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 2b42198758..fc2f23f271 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 nullptr!") ); 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 nullptr!") ); 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 55a6abb1df..00dc58d63a 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 f99aeecf5e..0cf72ba402 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 22db98ea19..6584ff7210 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(): nullptr '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); } @@ -259,7 +259,7 @@ const ThingTemplate *ThingFactory::findByTemplateID( UnsignedShort id ) return tmpl; } DEBUG_CRASH(("template %d not found",(Int)id)); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -296,14 +296,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(); @@ -311,7 +311,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; } @@ -348,7 +348,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 854f5e971e..4c93abe065 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())); } @@ -1116,12 +1116,12 @@ void ThingTemplate::resolveNames() // templates can be partially overridden by map.ini files. When this happens, strings // that have been parsed are looked up, cached, then cleared. The problem is if a string // gets cached, but not overridden, it will be clear the next time we call this function. - // so we will want to make sure we don't NULL out cached data if the string is empty. A + // so we will want to make sure we don't set to nullptr cached data if the string is empty. A // concrete example is overriding an object with prerequisites. We just override the portrait. // So the 1st time we call this function, we get the standard template data. During this first // call, the strings are looked up, cached, and cleared. Then we override the portrait in the // map.ini. The next time we call this function, we look up all the strings again. The prereq - // names didn't used to check for empty strings so they would NULL out all the previous prereqs + // names didn't used to check for empty strings so they would set to nullptr all the previous prereqs // the object had. So be sure to make sure all string lookups don't blindly lookup things -- check // if the string isNotEmpty first! @@ -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 656b5f4ebf..eacd11a0a5 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 0c6375cfaf..f5bc8560ef 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 417bcbd323..7b06108866 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 2774ced465..8b0ebc7556 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 e9acb876df..0ab2cbf5f0 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 ee1bf2f028..2367de6798 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 fc7dd99c50..7f55378fd2 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 1e4b399416..65742a9f76 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 10e680001b..f253f1a0ad 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 @@ -2215,11 +2215,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; @@ -2274,7 +2274,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; @@ -2293,7 +2293,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 @@ -2340,7 +2340,7 @@ void Drawable::drawIconUI( void ) //------------------------------------------------------------------------------------------------ DrawableIconInfo* Drawable::getIconInfo() { - if (m_iconInfo == NULL) + if (m_iconInfo == nullptr) m_iconInfo = newInstance(DrawableIconInfo); return m_iconInfo; } @@ -2362,8 +2362,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; @@ -2644,7 +2644,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 @@ -2734,7 +2734,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 @@ -2768,14 +2768,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) { // @@ -2823,7 +2823,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; @@ -2834,11 +2834,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) { // @@ -2903,7 +2903,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 ]) @@ -3131,7 +3131,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 ); @@ -3178,7 +3178,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 @@ -3186,7 +3186,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) { TheDisplayStringManager->freeDisplayString( m_constructDisplayString ); - m_constructDisplayString = NULL; + m_constructDisplayString = nullptr; } return; } @@ -3198,7 +3198,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 @@ -3275,7 +3275,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; @@ -3337,7 +3337,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 ) ) @@ -3475,7 +3475,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 nullptr")); return dm; } @@ -3501,7 +3501,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 nullptr")); return dm; } @@ -3651,7 +3651,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 nullptr")); m_physicsXform = new PhysicsXformInfo; *m_physicsXform = physicsXform; } @@ -3788,7 +3788,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( @@ -3813,7 +3813,7 @@ void Drawable::clearCaptionText( void ) { if (m_captionDisplayString) TheDisplayStringManager->freeDisplayString(m_captionDisplayString); - m_captionDisplayString = NULL; + m_captionDisplayString = nullptr; } //------------------------------------------------------------------------------------------------- @@ -3853,7 +3853,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; @@ -3867,7 +3867,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; @@ -3904,7 +3904,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; } } } @@ -3958,7 +3958,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; @@ -4103,7 +4103,7 @@ ClientUpdateModule* Drawable::findClientUpdateModule( NameKeyType key ) } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -4189,7 +4189,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()) @@ -4210,7 +4210,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 @@ -4265,7 +4265,7 @@ void Drawable::xfer( Xfer *xfer ) { TheAudio->killAudioEventImmediately( m_ambientSound->m_event.getPlayingHandle() ); deleteInstance(m_ambientSound); - m_ambientSound = NULL; + m_ambientSound = nullptr; } // drawable id @@ -4306,13 +4306,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 @@ -4321,13 +4321,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 @@ -4426,11 +4426,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 @@ -4555,7 +4555,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 @@ -4601,7 +4601,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() )); @@ -4657,7 +4657,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()); } @@ -4683,7 +4683,7 @@ const Locomotor* Drawable::getLocomotor() const return ai->getCurLocomotor(); } } - return NULL; + return nullptr; } //================================================================================================= @@ -4695,7 +4695,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 5e486a2aa1..9bb05a5246 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 60c7ec34f5..24870d4ff9 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 42cfdea196..6290a3ddaa 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 dc349e6e73..93c5a3be16 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 nullptr 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 dfc5f077e1..02b40c4b20 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: nullptr 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 nullptr, 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 cc67872121..2a28418d18 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 f70dcc6612..5e2ffde4be 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 = TheControlBar->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 nullptr", 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 86b32cd64e..1fc68b9fe2 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 b21ed009e5..0da5399cd5 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 4d7b220119..406550caaa 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 d15d40b7d2..09a7a57ab2 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 adbe1332f0..2735ea28fd 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 fc8b35ad5f..bc1a4b564c 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 949284420c..634357b862 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 0dd9f43c16..2c96521351 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 c7a37c23af..d26d08b98b 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 e249a7fe96..7deb7c6605 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.getLength() > 0) { 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.getLength() > 0) { 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 650dfd09cb..814d558fbc 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 nullptr", 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 nullptr", 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 75704c557d..e08672e56c 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 nullptr } } 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 91483cdfaf..bbac03fec4 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 660e96b7bf..dc2b627342 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 67357c600c..b95227521d 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 93e3b69370..8b38afef51 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 3db793e6e7..a97474b56c 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 9311f81063..bc80a8787a 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 dda3a72f76..e2013ac274 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 133d11a141..6f2c4de1e0 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 73cef4cd84..51c1e0a561 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 1c3ce0ea66..9ae28212bc 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 0c6d03a267..0bb3ba5f97 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 b04aeb377a..62ab5cbe2d 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 b11e605499..f11b049afb 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 b88f31dd09..1fb425020a 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 0fdce08eaa..92618f576b 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,33 @@ 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] = {nullptr,nullptr,nullptr,nullptr, +// nullptr,nullptr,nullptr,nullptr }; // -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 +620,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 +717,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 +916,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 +940,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 +1040,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -1133,7 +1127,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 89e8efd685..5777a2cb68 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 58827aca51..87dfe8b7b5 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 926627b084..e2cfe319ee 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 3c6f985275..0843531069 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 f9e7349779..6f14f289ad 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 nullptr!")); 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 dc01e513b3..d6fc89193c 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 be6aaaee59..1a4cb02486 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 4d9081deca..1be4183d86 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 c34c196690..193183b066 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 30a86122e1..0f7ecd8bc3 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 2b08e31bf4..dd99652757 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 8db407bc23..2c4ae8ac22 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 6d7c3e661e..9a17f1d31c 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 3d75636428..fc76f182a0 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 nullptr")); 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 bbad3784ad..899dc6e717 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 12f22f49c1..bc466edec3 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 5078994891..b9bc05763f 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 4386c5fd91..c61a16a077 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,30 @@ 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] = {nullptr,nullptr,nullptr,nullptr, +// nullptr,nullptr,nullptr,nullptr }; // -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 +317,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 +505,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 +513,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 +563,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 +578,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 +647,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 +709,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 +724,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 +738,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 +747,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 +774,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 +787,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 +823,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 +835,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 +846,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 +1028,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 +1044,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 +1145,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 +1174,7 @@ static const char *gadgetsToHide[] = "StaticTextColor", "StaticTextTeam", "StaticTextFaction", - NULL + nullptr }; static const char *perPlayerGadgetsToHide[] = { @@ -1187,7 +1182,7 @@ static const char *perPlayerGadgetsToHide[] = "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL + nullptr }; //------------------------------------------------------------------------------------------------- @@ -1345,7 +1340,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 +1359,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 +1378,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 +1484,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -1559,11 +1554,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 +1694,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 +1708,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 +1734,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 +1747,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 805f8415cf..d6134233b4 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 6da46946c0..1bd6bca513 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 5767ddfa13..aef620ff9d 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 db5ffbd2a2..4b8ef04bd6 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,41 @@ 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] = {nullptr,nullptr,nullptr,nullptr, +// nullptr,nullptr,nullptr,nullptr }; // -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 +250,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 +286,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 +331,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 +365,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 +373,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 +464,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 +481,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 +500,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 +867,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 +897,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 +1005,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 +1107,7 @@ void InitWOLGameGadgets( void ) if( buttonAccept[0] ) buttonAccept[0]->winEnable(TRUE); - if (buttonBack != NULL) + if (buttonBack != nullptr) { buttonBack->winEnable(TRUE); } @@ -1124,31 +1116,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 +1188,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 +1321,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 +1343,7 @@ static void shutdownComplete( WindowLayout *layout ) } */ - nextScreen = NULL; + nextScreen = nullptr; } @@ -1366,12 +1358,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 +1425,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 +1445,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 +1485,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) return; } - if (TheNAT != NULL) { + if (TheNAT != nullptr) { NATStateType NATState = TheNAT->update(); if (NATState == NATSTATE_DONE) { @@ -1511,7 +1503,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 +1542,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 +1560,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 +1642,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 +1701,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 +1957,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } else if (!stricmp(resp.command.c_str(), "NAT")) { - if (TheNAT != NULL) { + if (TheNAT != nullptr) { TheNAT->processGlobalMessage(-1, resp.commandOptions.c_str()); } } @@ -2009,7 +2001,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"))) { // 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 +2310,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 +2391,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -2498,11 +2490,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 +2516,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 +2658,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 48437a6f36..2729a2eb15 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 ee6569ab86..a0503dbb56 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 59d80e4051..086149c951 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 74f8f49bbd..9e86844984 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 227c11d2ac..016f587ed2 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 23b023b156..98c4e4cb9d 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 784bbe3ffd..50e90a74af 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 10018d7577..ff4ec809a6 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"))) { // 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 894a3f0e70..072d4b4311 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 8dcf8aa581..82518dd1b9 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 8004e9c89d..205cbda963 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 26b816f486..aef04f9e1e 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 6f25d37636..8d8d406228 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 9b4547a6cf..907116fc24 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 nullptr")); 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 66966c2d16..d798d23f0d 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 d0d860fa20..edd6c9326c 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 9ca37816ec..de74e32a20 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 e9bdfe91d4..68a010e6ba 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 d213f84c1f..8262f77116 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 12f00fee58..b278e8599c 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 d11c549fa2..a87f92865a 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 706ae0ffef..258b7eb8ba 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 3710e5d5be..8e63e3a99b 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 c6a8a72b64..88ca944604 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 de8aa1c029..e53f3b95cd 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 = 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( 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 @@ -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 nullptr + 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 = TheWindowManager->winCreate( NULL, statusFlags, 0, 0, 100, 100, NULL, NULL ); + window = TheWindowManager->winCreate( nullptr, statusFlags, 0, 0, 100, 100, nullptr, nullptr ); 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 = TheWindowManager->winCreate( window, statusFlags, 10, 10, 50, 50, nullptr, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 128, 128, 128, 255 ) ); window->winSetEnabledBorderColor( 0 , TheWindowManager->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 = TheWindowManager->gogoGadgetPushButton( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetPushButton( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetPushButton( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetCheckbox( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetCheckbox( NULL, + window = TheWindowManager->gogoGadgetCheckbox( nullptr, WIN_STATUS_ENABLED, 330, 150, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make window to hold radio buttons - window = TheWindowManager->winCreate( NULL, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, - 200, 200, 250, 45, NULL ); + window = TheWindowManager->winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, + 200, 200, 250, 45, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 50, 50, 50, 200 ) ); window->winSetEnabledBorderColor( 0, TheWindowManager->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 = TheWindowManager->gogoGadgetListBox( NULL, + window = TheWindowManager->gogoGadgetListBox( nullptr, WIN_STATUS_ENABLED, 200, 250, 100, 100, &instData, - &listData, NULL, TRUE ); + &listData, nullptr, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", TheWindowManager->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 = TheWindowManager->gogoGadgetListBox( NULL, + window = TheWindowManager->gogoGadgetListBox( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 75, 250, 100, 100, &instData, - &listData, NULL, TRUE ); + &listData, nullptr, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", TheWindowManager->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 = TheWindowManager->gogoGadgetSlider( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetSlider( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetSlider( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetSlider( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetProgressBar( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetProgressBar( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetStaticText( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetStaticText( NULL, + window = TheWindowManager->gogoGadgetStaticText( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 520, 300, 25, &instData, - &textData, NULL, TRUE ); + &textData, nullptr, TRUE ); window->winSetEnabledTextColors( TheWindowManager->winMakeColor( 128, 128, 255, 255 ), TheWindowManager->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 = TheWindowManager->gogoGadgetTextEntry( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetTextEntry( NULL, + window = TheWindowManager->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 d7c25e469d..43a7647b17 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 ) ) { - 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") ) { - 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" ) ) drawData->image = TheMappedImageCollection->findImageByName( 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 deb9c35465..f9913bfed2 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 72fe21b80d..62a048a777 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 c7288236ae..dc8a0bcb81 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 368f7bb33a..565b55f54e 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 b58dbc7290..f251c55fc9 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 31e4691a68..91d73ecec1 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 9644062444..6eef3addc0 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 nullptr!") ); + 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 1bcabcdc4b..f2609a78cb 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 9e466dfa8c..1593115b37 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 1e0028dbe2..3cf24e3531 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 nullptr before adding") ); + DEBUG_ASSERTCRASH( window->winGetPrevInLayout() == nullptr, + ("PrevInLayout should be nullptr 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 8f3a55c29c..bd65114ee4 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 8bbc840f2b..0e94a30605 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 887381c444..63322480af 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 b546c3f660..7b4a5cf80a 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 32df1e7dd2..7fe975bbc4 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-nullptr 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 nullptr */ //------------------------------------------------------------------------------------------------- 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 message = 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 message = 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 3705c791c2..e85c79e996 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 ) { @@ -777,7 +777,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 903a52b8a2..6807112e41 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) }, }; @@ -461,7 +461,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 ) ); @@ -513,7 +513,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; @@ -548,11 +548,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; } @@ -561,7 +561,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 ); } //------------------------------------------------------------------------------------------------- @@ -612,7 +612,7 @@ void Mouse::onResolutionChanged( void ) { if(m_tooltipDisplayString) TheDisplayStringManager->freeDisplayString(m_tooltipDisplayString); - m_tooltipDisplayString = NULL; + m_tooltipDisplayString = nullptr; m_tooltipDisplayString = TheDisplayStringManager->newDisplayString(); @@ -694,10 +694,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 @@ -738,7 +738,7 @@ void Mouse::createStreamMessages( void ) m_stillTime = now; // button messages - msg = NULL; + msg = nullptr; switch( m_currMouse.leftEvent ) { @@ -772,7 +772,7 @@ void Mouse::createStreamMessages( void ) } - msg = NULL; + msg = nullptr; switch( m_currMouse.middleEvent ) { @@ -807,7 +807,7 @@ void Mouse::createStreamMessages( void ) } - msg = NULL; + msg = nullptr; switch( m_currMouse.rightEvent ) { @@ -843,7 +843,7 @@ void Mouse::createStreamMessages( void ) } // wheel pos - msg = NULL; + msg = nullptr; if( m_currMouse.wheelPos != 0 ) { msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_MOUSE_WHEEL ); @@ -942,7 +942,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 @@ -1068,7 +1068,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 nullptr")); const Bool inInteractiveGame = TheGameLogic && TheGameLogic->isInInteractiveGame(); if (TheDisplay->getWindowed()) @@ -1229,7 +1229,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 @@ -1343,7 +1343,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 ]; @@ -1356,7 +1356,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 9a1a4e6605..f2e0af373a 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 3fc220d77d..6596b16e93 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 f0590f22b3..a203fd30e3 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 nullptr, 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 + // nullptr 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(); @@ -4257,7 +4257,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()) @@ -4271,13 +4271,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); @@ -4585,7 +4585,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGlobalData->m_showMetrics) { TheDisplay->setDebugDisplayCallback(StatMetricsDisplay); } else { - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); } break; } @@ -4717,7 +4717,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { line = "Objects are:"; TheScriptEngine->AppendDebugMessage(line, FALSE); - pPlayer->iterateObjects( printObjects, NULL ); + pPlayer->iterateObjects( printObjects, nullptr ); } } disp = DESTROY_MESSAGE; @@ -4728,7 +4728,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEBUG_TOGGLE_NETWORK: { - if (TheNetwork != NULL) { + if (TheNetwork != nullptr) { TheNetwork->toggleNetworkOn(); } disp = DESTROY_MESSAGE; @@ -4740,7 +4740,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; @@ -4855,7 +4855,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { if (TheGameLogic->isInGame()) { - if(TheInGameUI->cameoVideoBuffer() == NULL) + if(TheInGameUI->cameoVideoBuffer() == nullptr) TheInGameUI->playCameoMovie("CameoMovie"); else TheInGameUI->stopCameoMovie(); @@ -4990,7 +4990,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; @@ -5008,7 +5008,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 3ade01756e..673237bb23 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 637450e48f..ba15e942dc 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 1f0d4e7cc7..c12a71b2a2 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 ) @@ -655,12 +655,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) @@ -672,7 +672,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 @@ -685,10 +685,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 82e81e29f7..29d7ab6f41 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 } }; @@ -596,7 +596,7 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa //------------------------------------------------------------------------------------------------- MetaMap::MetaMap() : - m_metaMaps(NULL) + m_metaMaps(nullptr) { } @@ -658,7 +658,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 9e066f527a..f9ec209c31 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 nullptr")); // 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 627da82562..6c26efffcb 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 cd30ff3c2c..e89f3f9bca 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 28b20813bb..b13866c7f5 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-nullptr 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 4cc29191ca..38e75a017f 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 dc3cf08312..11dcdc7cdf 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 nullptr 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 - nullptr 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 nullptr") ); // 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 97ed8527e8..13a7f51a8d 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 e2fffa78cb..bc70cb3d98 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 5e4c0e8b4d..f8e00a7f67 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 nullptr. 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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-nullptr, 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 nullptr!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("INIT: ParticleSystem all particles tail[%d] is not nullptr!", 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 nullptr!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("RESET: ParticleSystem all particles tail[%d] is not nullptr!", 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 ea98b2fde5..6531346e1d 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 430028eb38..f0d5722dbe 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 nullptr 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 4359077735..0780246f59 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 aa09e57472..7b668290a3 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 9ebff0f48d..9ecb46fa30 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 nullptr 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 nullptr 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 nullptr 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 f0f4ca98dc..4cf1f1c742 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==0, ("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 9bd88bcb31..193a01f261 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 nullptr 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 nullptr, 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 nullptr, 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 nullptr 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 1df77caa3b..37e1276749 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 05ce1ea359..08bed8c31a 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 nullptr 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 nullptr 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(); @@ -2639,7 +2639,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) { @@ -2703,7 +2703,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 @@ -2758,7 +2758,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; } @@ -2926,7 +2926,7 @@ StateReturnType AIAttackPursueTargetState::updateInternal() if (getMachine()->isGoalObjectDestroyed()) { ai->notifyVictimIsDead(); - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); return STATE_FAILURE; } m_stopIfInRange = false; @@ -3156,7 +3156,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 @@ -3264,7 +3264,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; @@ -3464,7 +3464,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("*nullptr m_deployMachine"); return name; } #endif @@ -3529,7 +3529,7 @@ StateReturnType AIAttackMoveToState::update() Object* nextObjectToAttack; nextObjectToAttack = ai->getNextMoodTarget( !forceRetargetThisFrame, false ); - if (nextObjectToAttack != NULL) + if (nextObjectToAttack != nullptr) { ai->friend_endingMove(); m_attackMoveMachine->setGoalObject(nextObjectToAttack); @@ -3682,7 +3682,7 @@ const Waypoint * AIFollowWaypointPathState::getNextWaypoint(void) #else if (!hasNextWaypoint()) { m_priorWaypoint = m_currentWaypoint; - return NULL; + return nullptr; } Int skip = -1; Int i; @@ -3716,7 +3716,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) { @@ -3755,7 +3755,7 @@ Real AIFollowWaypointPathState::calcExtraPathDistance(void) //---------------------------------------------------------------------------------------------------------- void AIFollowWaypointPathState::computeGoal(Bool useGroupOffsets) { - if (m_currentWaypoint == NULL) + if (m_currentWaypoint == nullptr) return; Object *obj = getMachineOwner(); @@ -3884,11 +3884,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()); @@ -3930,7 +3930,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 @@ -4013,7 +4013,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); @@ -4084,7 +4084,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; @@ -4170,7 +4170,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()); @@ -4298,7 +4298,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("*nullptr m_attackFollowMachine"); return name; } #endif @@ -4355,7 +4355,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 ); @@ -4433,8 +4433,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(); @@ -4477,7 +4477,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); @@ -4667,7 +4667,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(); @@ -4718,7 +4718,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); @@ -4790,7 +4790,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; @@ -4937,7 +4937,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) @@ -5008,7 +5008,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(); @@ -5022,7 +5022,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); } } @@ -5093,7 +5093,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 @@ -5104,7 +5104,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) @@ -5170,13 +5170,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(); } @@ -5186,7 +5186,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) @@ -5213,12 +5213,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 ); } @@ -5244,7 +5244,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 @@ -5254,7 +5254,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("*nullptr m_attackMachine"); return name; } #endif @@ -5330,7 +5330,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! @@ -5355,7 +5355,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 ) @@ -5393,7 +5393,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 @@ -5415,15 +5415,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; @@ -5437,9 +5437,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; @@ -5460,11 +5460,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; /** @@ -5484,12 +5484,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, @@ -5504,10 +5504,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); } } @@ -5562,7 +5562,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 ); } @@ -5602,11 +5602,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" ); } @@ -5630,7 +5630,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("*nullptr m_attackSquadMachine"); return name; } #endif @@ -5705,7 +5705,7 @@ void AIAttackSquadState::onExit( StateExitType status ) { // destroy the attack machine deleteInstance(m_attackSquadMachine); - m_attackSquadMachine = NULL; + m_attackSquadMachine = nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -5714,7 +5714,7 @@ Object *AIAttackSquadState::chooseVictim(void) Squad *victimSquad = ((AIStateMachine*)getMachine())->getGoalSquad(); if (!victimSquad) { - return NULL; + return nullptr; } Object *owner = getMachineOwner(); @@ -5725,20 +5725,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); @@ -5768,7 +5768,7 @@ Object *AIAttackSquadState::chooseVictim(void) Int numUnits = objects.size(); if (numUnits == 0) { - return NULL; + return nullptr; } Int unitToAttack = GameLogicRandomValue(0, numUnits - 1); @@ -5782,9 +5782,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; } @@ -5798,12 +5798,12 @@ Object *AIAttackSquadState::chooseVictim(void) return objects[0]; } - return NULL; + return nullptr; break; } }; - return NULL; + return nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -5836,11 +5836,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()); } @@ -5864,7 +5864,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("*nullptr m_dockMachine"); return name; } #endif @@ -5879,17 +5879,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; } @@ -5920,7 +5920,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")); } @@ -5930,7 +5930,7 @@ void AIDockState::onExit( StateExitType status ) if (ai) { ai->setCanPathThroughUnits(false); - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); } } @@ -6049,7 +6049,7 @@ void AIEnterState::onExit( StateExitType status ) if (ai) { - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); if (ai->getCurLocomotor()) { ai->getCurLocomotor()->setAllowInvalidPosition(false); @@ -6086,7 +6086,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; } @@ -6246,8 +6246,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() ) @@ -6311,7 +6311,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("*nullptr guardMachine"); return name; } #endif @@ -6332,11 +6332,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()); } @@ -6385,7 +6385,7 @@ StateReturnType AIGuardState::onEnter() void AIGuardState::onExit( StateExitType status ) { deleteInstance(m_guardMachine); - m_guardMachine = NULL; + m_guardMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -6396,7 +6396,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. } @@ -6437,7 +6437,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("*nullptr guardMachine"); return name; } #endif @@ -6458,11 +6458,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()); } @@ -6506,7 +6506,7 @@ StateReturnType AITunnelNetworkGuardState::onEnter() void AITunnelNetworkGuardState::onExit( StateExitType status ) { deleteInstance(m_guardMachine); - m_guardMachine = NULL; + m_guardMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -6517,7 +6517,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. } @@ -6572,11 +6572,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"); } @@ -6619,7 +6619,7 @@ void AIHuntState::onExit( StateExitType status ) { // destroy the hunt machine deleteInstance(m_huntMachine); - m_huntMachine = NULL; + m_huntMachine = nullptr; Object *obj = getMachineOwner(); if (obj) @@ -6635,7 +6635,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("*nullptr huntMachine"); return name; } #endif @@ -6667,17 +6667,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; } @@ -6685,15 +6685,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; } @@ -6719,7 +6719,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. } } @@ -6768,11 +6768,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"); } @@ -6797,7 +6797,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("*nullptr m_attackMachine"); return name; } #endif @@ -6823,7 +6823,7 @@ void AIAttackAreaState::onExit( StateExitType status ) { // destroy the hunt machine deleteInstance(m_attackMachine); - m_attackMachine = NULL; + m_attackMachine = nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -6847,10 +6847,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()); @@ -6862,7 +6862,7 @@ StateReturnType AIAttackAreaState::update() { m_attackMachine->setState( AI_ATTACK_OBJECT ); } - if (victim==NULL) { + if (victim==nullptr) { return STATE_SUCCESS; } } @@ -6923,7 +6923,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 048c716343..8f110cb49b 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 157899e690..ba01babc0e 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 nullptr 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 c9270e8904..ed84d57495 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 nullptr.")); return STATE_FAILURE; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 4026e72869..81f6b5c8ad 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 c660fdf121..b7a62a193b 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 nullptr 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 685cd22558..1cfda02f61 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 nullptr 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 nullptr") ); // 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 2fbddabc9f..b4e67c7f90 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 97c49aee13..1bc2c1febe 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 1bdc37c657..834310b967 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 4ca2944332..43486d9c58 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 554688e605..6b99c27700 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 e4096fcab7..59edca33a3 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 c846c48e9c..d9fed1586a 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 c52f4fd5b2..80fe1d9503 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 d2da84a2ef..5015a14df9 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 b5cdc239d8..91731d4640 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 1f4da6a1d4..a5c429ad1b 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 2df2eee4ff..1d15dc1f83 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 5d72a53965..7570b9967a 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 4105cf9600..501a625987 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 d9c446f248..9d5cbe3efc 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 89be9fc77d..5ab7fb70d1 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 f4ffa2dedd..21b7e78f28 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 3d0ee6d9b2..c0fff7a12c 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 cbb54d5a2c..102f6320dd 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 a833818b7f..1a44165671 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 294fad763d..411c4aaee6 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 a6d6ed0281..5a0c0de785 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 7b1efe52b6..c9da92bb87 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 f96f8c8d33..5894e32e23 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 ce79e91864..ba77c2b260 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 2eacd9f010..fa5fa721d9 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 8d8e7d5081..8e2b550461 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 3ba3e04856..1b921e1711 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 e6b019cc9b..9170d55842 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 427271044f..9e05526497 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 6706f057eb..3e66c56c9e 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 dd014d6c64..ca4bc9b2ed 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 603106a97f..bdb672e82a 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 3851d860ca..23f0175ff6 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 4885ab2570..8f40b8272c 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 3e729bc947..1a2b1c5df8 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 9cff8d09cd..7186bc4718 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 )); @@ -273,7 +273,7 @@ void OpenContain::addToContain( Object *rider ) { // sanity - if( rider == NULL ) + if( rider == nullptr ) return; #if defined(RTS_DEBUG) @@ -289,12 +289,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():"nullptr", 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'", @@ -363,7 +363,7 @@ void OpenContain::removeFromContain( Object *rider, Bool exposeStealthUnits ) { // sanity - if( rider == NULL ) + if( rider == nullptr ) return; // @@ -666,7 +666,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. @@ -674,7 +674,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. @@ -862,8 +862,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(); @@ -899,7 +899,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); @@ -981,8 +981,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(); @@ -1004,7 +1004,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); @@ -1039,7 +1039,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. @@ -1117,7 +1117,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 @@ -1155,7 +1155,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 { @@ -1188,7 +1188,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) */ void OpenContain::onObjectWantsToEnterOrExit(Object* obj, ObjectEnterExitType wants) { - if (obj == NULL) + if (obj == nullptr) return; ObjectID id = obj->getID(); @@ -1211,7 +1211,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; @@ -1345,7 +1345,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 nullptr element") ); // Calculate the damage to be inflicted on each unit. Real damage = object->getBodyModule()->getMaxHealth() * data->m_damagePercentageToUnits; @@ -1405,7 +1405,7 @@ const Coord3D *OpenContain::getRallyPoint( void ) const if (m_rallyPointExists) return &m_rallyPoint; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1419,7 +1419,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 { @@ -1638,7 +1638,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 a67b4afe6f..4f61dbfede 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 2cb5300b4a..bae366a945 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 56d3636b29..ca8646d079 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 2916b52158..d08780676f 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 2fc9fb89aa..904e467da6 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 nullptr 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 c8bcb5ded2..9eb5a639b4 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 4e743c5fb9..cce2cc2100 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 da84fa1eb8..e04f94e424 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 339ee4c674..069011df6c 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 51b09ce1ca..ae7cdade6e 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 7d9a7d1090..f400b12350 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 nullptr") ); 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 ee05f5bd9f..da46471d73 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 c21f3b1079..09ff68387d 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 93f9127d0c..45f0e93054 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 913c2cbba7..97872d534c 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 a993aa2955..a4d07536ad 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 372d55d0bf..ea732262fd 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 78bc4fced5..72833b66dc 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 2c7af51476..52dfefb245 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 06d42d780c..07607992a4 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 d0f4b52301..1a408b94e5 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 nullptr 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; @@ -640,7 +640,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; } @@ -674,7 +674,7 @@ const Object* Object::getEnclosingContainedBy() const return container; } - return NULL; + return nullptr; } const Object* Object::getOuterObject() const @@ -751,11 +751,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; @@ -883,7 +883,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. @@ -1249,7 +1249,7 @@ void Object::clearSpecialModelConditionStates() // } // else // { -// DEBUG_CRASH(("NULL Drawable at this point, you can't get modelconditionflags now.")); +// DEBUG_CRASH(("nullptr Drawable at this point, you can't get modelconditionflags now.")); // static ModelConditionFlags noFlags; // return noFlags; // } @@ -1259,7 +1259,7 @@ void Object::clearSpecialModelConditionStates() Weapon* Object::getCurrentWeapon(WeaponSlotType* wslot) { if (!m_weaponSet.hasAnyWeapon()) - return NULL; + return nullptr; if (wslot) *wslot = m_weaponSet.getCurWeaponSlot(); @@ -1270,7 +1270,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(); @@ -1339,7 +1339,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(); @@ -1361,7 +1361,7 @@ void Object::fireCurrentWeapon(const Coord3D* pos) { //USE_PERF_TIMER(fireCurrentWeapon) - if (pos == NULL) + if (pos == nullptr) return; Weapon* weapon = m_weaponSet.getCurWeapon(); @@ -1456,7 +1456,7 @@ Player * Object::getControllingPlayer() const if (myTeam) return myTeam->getControllingPlayer(); - return NULL; + return nullptr; } //============================================================================= @@ -1695,7 +1695,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 ); @@ -1793,7 +1793,7 @@ void Object::kill() //------------------------------------------------------------------------------------------------- void Object::healCompletely() { - attemptHealing(HUGE_DAMAGE_AMOUNT, NULL); + attemptHealing(HUGE_DAMAGE_AMOUNT, nullptr); } //------------------------------------------------------------------------------------------------- @@ -2288,17 +2288,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 ) @@ -2435,7 +2435,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; @@ -2516,8 +2516,8 @@ void Object::removeFromList(Object **pListHead) else *pListHead = m_next; - m_prev = NULL; - m_next = NULL; + m_prev = nullptr; + m_next = nullptr; } //------------------------------------------------------------------------------------------------- @@ -2593,14 +2593,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; } @@ -2883,7 +2883,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; @@ -2968,7 +2968,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" @@ -3607,7 +3607,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; @@ -3683,7 +3683,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; @@ -3806,7 +3806,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) { @@ -3826,7 +3826,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 @@ -3868,7 +3868,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; @@ -3918,7 +3918,7 @@ void Object::loadPostProcess() if( m_xferContainedByID != INVALID_ID ) m_containedBy = TheGameLogic->findObjectByID(m_xferContainedByID); else - m_containedBy = NULL; + m_containedBy = nullptr; } @@ -4216,10 +4216,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; } //------------------------------------------------------------------------------------------------- @@ -4641,8 +4641,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) @@ -4655,7 +4655,7 @@ SpecialPowerModuleInterface *Object::getSpecialPowerModule( const SpecialPowerTe return sp; } - return NULL; + return nullptr; } @@ -4788,7 +4788,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 ) { @@ -4797,7 +4797,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 ); @@ -5029,7 +5029,7 @@ ProductionUpdateInterface* Object::getProductionUpdateInterface( void ) } - return NULL; + return nullptr; } @@ -5037,15 +5037,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; } @@ -5066,7 +5066,7 @@ SpecialPowerModuleInterface* Object::findSpecialPowerModuleInterface( SpecialPow return sp; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5086,7 +5086,7 @@ SpecialPowerModuleInterface* Object::findAnyShortcutSpecialPowerModuleInterface( return sp; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5102,7 +5102,7 @@ SpawnBehaviorInterface* Object::getSpawnBehaviorInterface() const return sbi; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5121,7 +5121,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestinationA } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5140,7 +5140,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestination( } } } - return NULL; + return nullptr; } @@ -5162,7 +5162,7 @@ SpecialAbilityUpdate* Object::findSpecialAbilityUpdate( SpecialPowerType type ) } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5203,17 +5203,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 @@ -5235,7 +5235,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; @@ -5263,7 +5263,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; } @@ -5505,9 +5505,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 2398127315..57d77b20d7 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 9986736965..a9cd6ee29d 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 = ThePartitionManager->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 78ae8a6063..1aa7772e0e 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 43d4850f73..8808fd4d4f 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 1e6bd51e3b..de75236289 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 82b94e1a75..ac11418900 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 dfa4286447..1260c0979d 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 d6f6ec2742..cff0913d87 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 3ebffaddd1..983f569ad9 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 0e70351b04..cf93a6f8b4 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 61628a2e3f..cf6ce80969 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 20e8230cd9..1902010dda 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 7364383304..d7c754b0a2 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 678d87cfeb..1cdd157629 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 nullptr")); 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 nullptr */ 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()) { @@ -2965,7 +2965,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); } @@ -3022,7 +3022,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 ); @@ -3093,18 +3093,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); } @@ -3225,14 +3225,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 ); } } @@ -3356,7 +3356,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 @@ -3369,7 +3369,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 ) ); @@ -3407,9 +3407,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(); @@ -3963,14 +3963,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) @@ -3999,7 +3999,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. @@ -4013,7 +4013,7 @@ const Coord3D *AIUpdateInterface::getCurrentVictimPos( void ) const } } - return NULL; + return nullptr; } @@ -4067,7 +4067,7 @@ Object* AIUpdateInterface::getEnterTarget() if( stateType != AI_ENTER && stateType != AI_GUARD_TUNNEL_NETWORK && stateType != AI_GET_REPAIRED ) - return NULL; + return nullptr; return getStateMachine()->getGoalObject(); } @@ -4125,7 +4125,7 @@ UnsignedInt AIUpdateInterface::getMoodMatrixValue( void ) const } else { - if (m_turretAI[0] != NULL) + if (m_turretAI[0] != nullptr) { returnVal |= MM_UnitType_Turreted; } @@ -4259,10 +4259,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(); @@ -4271,14 +4271,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 @@ -4294,12 +4294,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; } } } @@ -4308,7 +4308,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(); @@ -4322,7 +4322,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; @@ -4338,7 +4338,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 @@ -4354,7 +4354,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); } @@ -4403,7 +4403,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 )); @@ -4432,7 +4432,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 ); } @@ -4448,7 +4448,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 ); } @@ -4873,7 +4873,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) { @@ -4952,7 +4952,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 214cb16d0c..6d703fcb3b 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 eff1686059..15dfbda5eb 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) { ExitInterface *exitInterface = obj->getObjectExitInterface(); ExitDoorType exitDoor = exitInterface ? exitInterface->reserveDoorForExit(rappeller->getTemplate(), rappeller) : DOOR_NONE_AVAILABLE; @@ -600,7 +600,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); @@ -619,7 +619,7 @@ class ChinookCombatDropState : public State } } - if (numRopesInUse == 0 && getPotentialRappeller(obj) == NULL) + if (numRopesInUse == 0 && getPotentialRappeller(obj) == nullptr) { // we're done! return STATE_SUCCESS; @@ -646,8 +646,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); } @@ -664,7 +664,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 } } @@ -724,7 +724,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; @@ -843,21 +843,21 @@ ChinookAIUpdateModuleData::ChinookAIUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "RappelSpeed", INI::parseVelocityReal, 0, offsetof(ChinookAIUpdateModuleData, m_rappelSpeed) }, - { "RopeDropSpeed", INI::parseVelocityReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeDropSpeed) }, - { "RopeName", INI::parseAsciiString, 0, offsetof(ChinookAIUpdateModuleData, m_ropeName) }, - { "RopeFinalHeight", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeFinalHeight) }, - { "RopeWidth", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeWidth) }, - { "RopeWobbleLen", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleLen) }, - { "RopeWobbleAmplitude", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleAmp) }, - { "RopeWobbleRate", INI::parseAngularVelocityReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleRate) }, - { "RopeColor", INI::parseRGBColor, 0, offsetof(ChinookAIUpdateModuleData, m_ropeColor) }, - { "NumRopes", INI::parseUnsignedInt, 0, offsetof(ChinookAIUpdateModuleData, m_numRopes) }, - { "PerRopeDelayMin", INI::parseDurationUnsignedInt, 0, offsetof(ChinookAIUpdateModuleData, m_perRopeDelayMin) }, - { "PerRopeDelayMax", INI::parseDurationUnsignedInt, 0, offsetof(ChinookAIUpdateModuleData, m_perRopeDelayMax) }, - { "MinDropHeight", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_minDropHeight) }, - { "WaitForRopesToDrop", INI::parseBool, 0, offsetof(ChinookAIUpdateModuleData, m_waitForRopesToDrop) }, - { 0, 0, 0, 0 } + { "RappelSpeed", INI::parseVelocityReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_rappelSpeed) }, + { "RopeDropSpeed", INI::parseVelocityReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeDropSpeed) }, + { "RopeName", INI::parseAsciiString, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeName) }, + { "RopeFinalHeight", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeFinalHeight) }, + { "RopeWidth", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeWidth) }, + { "RopeWobbleLen", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleLen) }, + { "RopeWobbleAmplitude", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleAmp) }, + { "RopeWobbleRate", INI::parseAngularVelocityReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleRate) }, + { "RopeColor", INI::parseRGBColor, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeColor) }, + { "NumRopes", INI::parseUnsignedInt, nullptr, offsetof(ChinookAIUpdateModuleData, m_numRopes) }, + { "PerRopeDelayMin", INI::parseDurationUnsignedInt, nullptr, offsetof(ChinookAIUpdateModuleData, m_perRopeDelayMin) }, + { "PerRopeDelayMax", INI::parseDurationUnsignedInt, nullptr, offsetof(ChinookAIUpdateModuleData, m_perRopeDelayMax) }, + { "MinDropHeight", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_minDropHeight) }, + { "WaitForRopesToDrop", INI::parseBool, nullptr, offsetof(ChinookAIUpdateModuleData, m_waitForRopesToDrop) }, + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -890,13 +890,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; } @@ -910,7 +910,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); } @@ -1002,7 +1002,7 @@ Bool ChinookAIUpdate::chooseLocomotorSet(LocomotorSetType wst) UpdateSleepTime ChinookAIUpdate::update() { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); - if (pp != NULL) + if (pp != nullptr) { if (m_flightStatus == CHINOOK_LANDED && !m_hasPendingCommand && @@ -1010,7 +1010,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 { @@ -1039,11 +1039,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); } } } @@ -1084,7 +1084,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); } @@ -1096,12 +1096,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 @@ -1163,7 +1163,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 @@ -1171,7 +1171,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; } } @@ -1186,7 +1186,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; } } @@ -1200,7 +1200,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 a8c7c8876c..29f62d3fa3 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 4d7749f530..2b29c96896 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 32aa3ece0f..933798b769 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 @@ -1633,8 +1633,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, @@ -1657,7 +1657,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, @@ -1665,8 +1665,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; } @@ -1738,7 +1738,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 @@ -1759,14 +1759,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" )); @@ -1849,7 +1849,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // make sure we can resume construction on this @@ -1919,7 +1919,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)); @@ -1945,7 +1945,7 @@ void DozerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType cm return bestTower; DEBUG_CRASH(("should not happen, no reachable tower found")); - return NULL; + return nullptr; } } @@ -1963,7 +1963,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; // @@ -1983,7 +1983,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 // @@ -2155,7 +2155,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); // } @@ -2171,7 +2171,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 ); // @@ -2242,7 +2242,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); } @@ -2287,18 +2287,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 82c34f3859..b0654ec3f7 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 f264228618..ee67717ff0 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 1b42513fc2..862bc0ac6c 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 b809367e51..bb3e8aceeb 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: nullptr 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 f22256ff03..bf1a69f28c 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 05608fd5f5..a4f8dce787 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 79afbb2b75..80c142b8a8 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 00b494a802..1fffd9bf8e 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 4721df43da..cde456a8c2 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(); @@ -332,8 +332,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, @@ -352,8 +352,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 @@ -361,7 +361,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, @@ -369,8 +369,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; } @@ -472,7 +472,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 @@ -493,14 +493,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" )); @@ -583,7 +583,7 @@ void WorkerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType c { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // make sure we can resume construction on this @@ -605,7 +605,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. @@ -627,7 +627,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 // @@ -814,7 +814,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); // } @@ -825,7 +825,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 ); @@ -885,7 +885,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); } @@ -922,18 +922,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; } @@ -1166,14 +1166,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. @@ -1250,7 +1250,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(); } @@ -1322,18 +1322,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 @@ -1348,18 +1348,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 3670aeb4e9..8a58326da9 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 7637a09f74..9ea2f39891 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 8e88437b83..3f49891481 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 8647e01008..7d3d6f72ad 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 92dc1c839d..185b5ac44a 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 746118fb4d..f91c782973 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 9fc92b0a4e..d99b265ebe 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 802d2d7afa..50f89ca1ee 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 0ba4f1aac1..1dc715090b 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 95b1f638fd..337d4f4af6 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 f1ee45abe7..339d5d9688 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 3ee5ae7e84..54c5993c2c 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 bedbd258ca..ad8def5579 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 f39dd2741f..51505682b3 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 965f0fdd02..37f5e5f088 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 fcfb9f0eb9..67806c33fb 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 1663997ab2..8410b28611 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 0253517006..4405b72fcf 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 e64539f715..25c27f9f68 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 nullptr" ) ); 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 nullptr" ) ); 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 3bd99fbb76..09d58ed636 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 5a1c35f59c..7add830fe8 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 82553422d9..cb0da1c915 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 915540b4a8..ad579de604 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 72201fbcd5..9a3915a6ce 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 e8e8f750e7..996d9dcaa2 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 4963527673..157c53c5e6 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 892d741695..95fe4d2496 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 57057173a9..650d9a4c10 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 c71120c255..d5e506481f 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 9d1be6984d..f8dd42765c 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 8b4a9b4ed7..6c323c786f 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 071f32af64..12a4299601 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 c7b1b9abfa..323f3e62b3 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 f7f728ab4e..c34e51fb0b 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 ae5549043f..23d1f5b4a5 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 ad7614d1f1..d13a3f1e36 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; @@ -273,7 +273,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 nullptr")); //All human players have manual control and must "drive" the beam around! m_startAttackFrame = TheGameLogic->getFrame(); @@ -285,7 +285,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 nullptr")); //All computer controlled players have automatic control -- the "S" curve. UnsignedInt now = TheGameLogic->getFrame(); @@ -565,7 +565,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(); @@ -600,7 +600,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! @@ -624,7 +624,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 ); @@ -695,7 +695,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; } @@ -811,7 +811,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 ); } } } @@ -919,7 +919,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 ); } } } @@ -958,7 +958,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 ); } } } @@ -1443,11 +1443,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 36dd8619c9..f161a6046b 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 e82f830db9..a36e435d48 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 f8ed7a44af..a088d16f1b 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 bfcab8950b..500b6aad80 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 2bf00757c5..a330a09f1e 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 179b61d139..8a1d6d7561 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 c805e87220..87a70875f4 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 4e1013b63a..fcfd8c87cf 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 1cff280766..551de9f5f3 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 7a1e167cbc..a5357afb8c 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 5397affbdc..b02adae856 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 79769bc521..89ad057dce 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 1411a1b830..3ef650cecf 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 0b7ca86706..34f5382338 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 7789f245f4..67f317afeb 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 ec95774da6..ea7664dcc1 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 8eb909b880..5db9614f8f 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 33737623cb..027fb33bb4 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 ddd99e0860..58c8952b53 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 b4a9a24438..68b7dcfd56 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 c2b7252656..e55d6ab5f5 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 68fd6ecfc4..099eb96ef0 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 bfa7e0a54e..ba56e9229f 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 e5aa81681a..0b6bf32a44 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 2fd664af72..144a964654 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 cd899a854c..d930a3f3e5 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 582a8fa48b..a3034a31b6 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 e99d360087..aca0023877 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 2edb3c799a..4edb9ab994 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 7bae95eebb..d2ad10c272 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():"nullptr")); //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; @@ -910,7 +910,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")); @@ -925,10 +925,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; @@ -1049,7 +1049,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 ); @@ -1070,10 +1070,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) @@ -1256,7 +1256,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... @@ -1266,7 +1266,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(); @@ -1274,7 +1274,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; @@ -1297,20 +1297,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. @@ -1404,7 +1404,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; @@ -1456,7 +1456,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 = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); @@ -1468,7 +1468,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 = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); @@ -1480,9 +1480,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; } @@ -1490,9 +1490,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; } @@ -1504,7 +1504,7 @@ WeaponTemplate *WeaponStore::findWeaponTemplatePrivate( NameKeyType key ) const if( m_weaponTemplateVector[ i ]->getNameKey() == key ) return m_weaponTemplateVector[i]; - return NULL; + return nullptr; } @@ -1514,7 +1514,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) // sanity if(name.isEmpty()) - return NULL; + return nullptr; // allocate a new weapon WeaponTemplate *wt = newInstance(WeaponTemplate); @@ -1529,7 +1529,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); @@ -2150,7 +2150,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)) { @@ -2256,7 +2256,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(); @@ -2295,12 +2295,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(); } @@ -2322,7 +2322,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 @@ -2477,7 +2477,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 ); @@ -2582,7 +2582,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); } //------------------------------------------------------------------------------------------------- @@ -2590,21 +2590,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); } //------------------------------------------------------------------------------------------------- @@ -2618,7 +2618,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 ); } @@ -2746,8 +2746,8 @@ class AssistanceRequestData //------------------------------------------------------------------------------------------------- AssistanceRequestData::AssistanceRequestData() { - m_requestingObject = NULL; - m_victimObject = NULL; + m_requestingObject = nullptr; + m_victimObject = nullptr; m_requestDistanceSquared = 0.0f; } @@ -2772,7 +2772,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 @@ -2833,7 +2833,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)); @@ -2869,7 +2869,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; @@ -2889,7 +2889,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; @@ -2926,7 +2926,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 @@ -2960,7 +2960,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); } //------------------------------------------------------------------------------------------------- @@ -2972,7 +2972,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); } //------------------------------------------------------------------------------------------------- @@ -2986,7 +2986,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); } //------------------------------------------------------------------------------------------------- @@ -3001,7 +3001,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); } // ------------------------------------------------------------------------------------------------ @@ -3224,7 +3224,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; } } @@ -3321,7 +3321,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 9eb4a1e54e..bdcedf0907 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 6680f09c8c..5aa14860a1 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 9ebaba9e85..7a7fd6cd79 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 3430b6352a..a87eacb180 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 nullptr 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(("nullptr 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 nullptr 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()); TheScriptEngine->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 nullptr 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 nullptr) 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 e81045e9a9..f66f27dd64 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 c3f70c082c..7779e98180 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 380dd9529d..a7162ebe82 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 nullptr, 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 810e5d07b4..4360fb637f 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 03b6cfda0f..bb94ade715 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; @@ -258,7 +258,7 @@ void GameLogic::setDefaults( Bool saveGame ) 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 @@ -267,7 +267,7 @@ void GameLogic::setDefaults( Bool saveGame ) (*it)->friend_setIndexInLogic(-1); } m_sleepyUpdates.clear(); - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; // // only reset the next object ID allocater counter when we're not loading a save game. @@ -313,7 +313,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") ); } @@ -331,7 +331,7 @@ GameLogic::~GameLogic() { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } // destroy all remaining objects @@ -339,27 +339,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; } // ------------------------------------------------------------------------------------------------ @@ -477,7 +477,7 @@ void GameLogic::reset( void ) m_forceGameStartByTimeOut = FALSE; delete TheStatsCollector; - TheStatsCollector = NULL; + TheStatsCollector = nullptr; // clear any table of contents we have m_objectTOC.clear(); @@ -574,8 +574,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; @@ -603,7 +603,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 @@ -643,7 +643,7 @@ LoadScreen *GameLogic::getLoadScreen( Bool saveGame ) break; case GAME_NONE: default: - return NULL; + return nullptr; } } @@ -973,7 +973,7 @@ void GameLogic::deleteLoadScreen( void ) { delete m_loadScreen; - m_loadScreen = NULL; + m_loadScreen = nullptr; } @@ -1057,13 +1057,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); } } @@ -1086,8 +1086,8 @@ void GameLogic::startNewGame( Bool saveGame ) m_scriptHulkMaxLifetimeOverride = -1; // Fill in the game color and Factions before we do the Load Screen - GameInfo *game = NULL; - TheGameInfo = NULL; + GameInfo *game = nullptr; + TheGameInfo = nullptr; Int localSlot = 0; if (TheNetwork) { @@ -1134,7 +1134,7 @@ void GameLogic::startNewGame( Bool saveGame ) } else { if (m_gameMode == GAME_SINGLE_PLAYER) { delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; + TheSkirmishGameInfo = nullptr; } } @@ -1161,7 +1161,7 @@ void GameLogic::startNewGame( Bool saveGame ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } setFPMode(); if(TheCampaignManager) @@ -1418,7 +1418,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; } @@ -1427,7 +1427,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) @@ -1576,7 +1576,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()) @@ -1683,7 +1683,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()) @@ -1795,7 +1795,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); @@ -1906,7 +1906,7 @@ void GameLogic::startNewGame( Bool saveGame ) { Player *pPlayer = ThePlayerList->getNthPlayer(i); if (pPlayer && pPlayer->getPlayerType() != PLAYER_HUMAN) - pPlayer = NULL; + pPlayer = nullptr; if (pPlayer) { @@ -1933,7 +1933,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()) @@ -2172,7 +2172,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. @@ -2182,7 +2182,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. @@ -2292,9 +2292,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()) @@ -2449,8 +2449,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) { @@ -2682,7 +2682,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); @@ -2911,7 +2911,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; @@ -2949,7 +2949,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); @@ -3000,7 +3000,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++; @@ -3009,11 +3009,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; } @@ -3065,7 +3065,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; @@ -3242,7 +3242,7 @@ void GameLogic::update( void ) u->update(); #endif - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; } } } @@ -3281,7 +3281,7 @@ void GameLogic::update( void ) if (sleepLen < 1) sleepLen = UPDATE_SLEEP_NONE; - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; } @@ -3383,7 +3383,7 @@ void GameLogic::addObjectToLookupTable( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // add to lookup @@ -3398,7 +3398,7 @@ void GameLogic::removeObjectFromLookupTable( Object *obj ) { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // remove from lookup table @@ -3483,7 +3483,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()) @@ -3642,7 +3642,7 @@ UnsignedInt GameLogic::getCRC( Int mode, AsciiString deepCRCFileName ) UnsignedInt theCRC = xferCRC->getCRC(); delete xferCRC; - xferCRC = NULL; + xferCRC = nullptr; if (isInGameLogicUpdate()) { @@ -3692,7 +3692,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 @@ -3703,7 +3703,7 @@ void GameLogic::sendObjectDestroyed( Object *obj ) } // erase the binding of the drawable to this object - obj->friend_bindToDrawable( NULL ); + obj->friend_bindToDrawable( nullptr ); } @@ -4091,7 +4091,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryByName( AsciiString name ) if( (*it).name == name ) return &(*it); - return NULL; + return nullptr; } @@ -4105,7 +4105,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryById( UnsignedShort id ) if( (*it).id == id ) return &(*it); - return NULL; + return nullptr; } @@ -4150,7 +4150,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 @@ -4271,7 +4271,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()) ); @@ -4332,7 +4332,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() )); @@ -4372,7 +4372,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 )); @@ -4385,7 +4385,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!", @@ -4484,7 +4484,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'", @@ -4590,11 +4590,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 e556457319..b35ea5df56 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; TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 ) return; // 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 f4a2d3c4b0..18265789d1 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 7ead7cd440..cc6b1e3300 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 a567fd126c..925d892b9a 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 be309ddae3..906d3f52cf 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 92dc5ddd07..cad15e8929 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 nullptr 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 nullptr when it should be")); + DEBUG_ASSERTCRASH(TheNAT == nullptr, ("TheNAT is not nullptr 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 76b3ef38de..76cbf4f45a 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 226dc9c769..9bfaf45c1a 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 baae21cb17..eeaedcb31e 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 40e18524de..782aa73d5e 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 da0a942acd..8c08410246 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h @@ -23,6 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// #pragma once +#include #include "matrix4.h" #include "GameClient/Shadow.h" @@ -42,7 +43,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;} /// #include "WW3D2/matpass.h" #include "WW3D2/dx8wrapper.h" @@ -59,7 +60,7 @@ class W3DShroudMaterialPassClass : public MaterialPassClass class W3DMaskMaterialPassClass : public MaterialPassClass { public: - W3DMaskMaterialPassClass(void) : m_texture(NULL), m_allowUninstall(TRUE) {} + W3DMaskMaterialPassClass(void) : m_texture(nullptr), m_allowUninstall(TRUE) {} virtual void Install_Materials(void) const; virtual void UnInstall_Materials(void) const; void setTexture(TextureClass *texture) {m_texture=texture;} diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h index bcf573c9d9..13ce8651ca 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h @@ -115,7 +115,7 @@ class W3DVolumetricShadow : public Shadow void setOptimalExtrusionPadding(Real value) {m_extraExtrusionPadding=value;} const W3DShadowGeometry *getGeometry(void) {return m_geometry;} - void setRenderObject( RenderObjClass *robj) {assert(m_robj==NULL); m_robj=robj;} + void setRenderObject( RenderObjClass *robj) {assert(m_robj==nullptr); m_robj=robj;} void setRenderObjExtent ( Real extent) { m_robjExtent = extent; } // called once per frame, updates shadow volume when necessary diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DTerrainLogic.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DTerrainLogic.h index e2cd3cab2c..080295a8df 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DTerrainLogic.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DTerrainLogic.h @@ -53,11 +53,11 @@ class W3DTerrainLogic : public TerrainLogic 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 getGroundHeight( Real x, Real y, Coord3D* normal = nullptr ) const; virtual Bool isCliffCell( Real x, Real y) const; ///< is point cliff cell. - virtual Real getLayerHeight(Real x, Real y, PathfindLayerEnum layer, Coord3D* normal = NULL, Bool clip = true) const; + virtual Real getLayerHeight(Real x, Real y, PathfindLayerEnum layer, Coord3D* normal = nullptr, Bool clip = true) const; virtual void getExtent( Region3D *extent ) const ; ///< Get the 3D extent of the terrain in world coordinates diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp index 8a107fa5a6..2b33029551 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp @@ -95,7 +95,7 @@ static FunctionLexicon::TableEntry gameWinDrawTable [] = { NAMEKEY_INVALID, "W3DNoDraw", W3DNoDraw }, { NAMEKEY_INVALID, "W3DDrawMapPreview", W3DDrawMapPreview }, - { NAMEKEY_INVALID, NULL, NULL }, + { NAMEKEY_INVALID, nullptr, nullptr }, }; @@ -105,7 +105,7 @@ static FunctionLexicon::TableEntry layoutInitTable [] = { NAMEKEY_INVALID, "W3DMainMenuInit", W3DMainMenuInit }, - { NAMEKEY_INVALID, NULL, NULL }, + { NAMEKEY_INVALID, nullptr, nullptr }, }; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp index 664d9bbe05..f7b57d4fa4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp @@ -52,13 +52,13 @@ //------------------------------------------------------------------------------------------------- W3DDebrisDraw::W3DDebrisDraw(Thing *thing, const ModuleData* moduleData) : DrawModule(thing, moduleData) { - m_renderObject = NULL; + m_renderObject = nullptr; for (int i = 0; i < STATECOUNT; ++i) - m_anims[i] = NULL; - m_fxFinal = NULL; + m_anims[i] = nullptr; + m_fxFinal = nullptr; m_state = INITIAL; m_frames = 0; - m_shadow = NULL; + m_shadow = nullptr; m_finalStop = false; } @@ -69,19 +69,19 @@ W3DDebrisDraw::~W3DDebrisDraw(void) if (TheW3DShadowManager && m_shadow) { TheW3DShadowManager->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 e07a19a7ca..e199b6b050 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 a0151a6016..1a578779f5 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 aab8c0ebf9..46853c96f3 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 nullptr 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 nullptr 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 nullptr")); 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 a89398e22f..5546a77dc0 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 d05f9103df..b6efb3babe 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 44a69928ea..8f699cc7c1 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 e809aac033..620b4e8d08 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 f9b5dbd254..9649d1b80f 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 efdc37d46a..55aa19f567 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 433b3af4c4..eb2ab2a924 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 c56ae62d0a..0552e6ce20 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 0baa25aa28..9ae1953443 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 1a99fe9ac1..fa6e7ba0d3 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 6579e5d595..97a88b6295 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 f321f803e6..981e8ac0ee 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 b58f44730b..b5a72407fa 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 e8a97d8105..9baf04b4fd 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 fb5f3390dc..5c434203bf 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 e13bf6fa40..fe463b8ecf 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 84c4e9ff1d..f1d8a3bc61 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 30f356cfa4..baea075892 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 dba4d4f1e7..36e7b452bf 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 8884b0f095..5593517ccd 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 836a338bcd..c90931db76 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 7fa36bca02..8cf7953ea1 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 5022bbb876..801300fa57 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 49c3c00e9b..87fa37c6e8 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 9e5b24fee5..bc605b06cf 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 94caea0b44..60eb3fd54c 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 nullptr!")); 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 a0143fd001..f0f81fc2c2 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 eca9c59f7d..df93aabad9 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 282706871e..0e29e3a7dd 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 nullptr") ); 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 nullptr") ); 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 7c06301c91..174850d850 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 3ddf49f69a..7f7ab7c11b 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 833b6da546..8066f671b3 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 0d79197c64..de50039400 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 33775af48a..41f1fe51be 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 459fc1be20..ba0ff1765c 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 c0df9dc89d..0b4ab05e73 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 11f6372e14..be3efb0db2 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 816d96ec8c..25b40d5ad5 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 260558f8cb..848ea23b4e 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 f71bccd308..adb44f0d3b 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 b8d8db3d90..ffe5521fb0 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 2b60391f2c..5b5d7901cd 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 2337420cfe..2533b42271 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 nullptr 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 f1dd583f15..f3f71c7dd0 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 5fe6e86f4e..257ef93f81 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 01e42c7e6e..7332c3c7d3 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 ec1e2521ac..50bb063f02 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 nullptr 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 6ece16cdf7..04284ef67a 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 d15828036c..e528e838a5 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 03801ec67a..22898219c5 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 3511d609d7..dd6baa139e 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 6bc06e14ea..61dfaca697 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" )); } @@ -341,8 +341,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 ) @@ -407,7 +407,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 56eadc80fb..793794c06c 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" )); } @@ -323,8 +323,8 @@ void DirectInputMouse::mapDirectInputMouse( MouseIO *mouse, DirectInputMouse::DirectInputMouse( void ) { - m_pDirectInput = NULL; - m_pMouseDevice = NULL; + m_pDirectInput = nullptr; + m_pMouseDevice = nullptr; } @@ -469,20 +469,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 5f84cca905..5710806b15 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -275,7 +275,7 @@ Win32Mouse::Win32Mouse( void ) m_currentWin32Cursor = NONE; for (Int i=0; i #include "aabtreebuilder.h" #include "chunkio.h" #include "w3d_file.h" @@ -80,12 +81,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,13 +124,13 @@ AABTreeBuilderClass::~AABTreeBuilderClass(void) void AABTreeBuilderClass::Reset(void) { delete Root; - Root = NULL; + Root = nullptr; delete[] Verts; - Verts = NULL; + Verts = nullptr; delete[] Polys; - Polys = NULL; + Polys = nullptr; } /*********************************************************************************************** @@ -148,8 +149,8 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,TriIndex * 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 @@ -185,7 +186,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 +267,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 +278,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 +303,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 +890,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 9098dfb60e..7f1c6d7f3f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector3.h" @@ -85,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; @@ -134,8 +135,8 @@ class AABTreeBuilderClass SplitArraysStruct(void) : FrontCount(0), BackCount(0), - FrontPolys(NULL), - BackPolys(NULL) + FrontPolys(nullptr), + BackPolys() { } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 32a40db2f5..cb6472b884 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 1e2ad69f8f..bd43349ef3 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "composite.h" @@ -123,7 +124,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 2afb91369d..fcd4686a07 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -76,6 +76,7 @@ * WW3DAssetManager::Get_Streaming_Texture -- Gets a streaming texture. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "assetmgr.h" #include @@ -120,7 +121,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 +177,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 +206,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 +254,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 +449,7 @@ void WW3DAssetManager::Free_Assets(void) PrototypeClass * proto = Prototypes[count]; Prototypes.Delete(count); - if (proto != NULL) { + if (proto != nullptr) { proto->DeleteSelf(); } } @@ -527,7 +528,7 @@ void WW3DAssetManager::Free_Assets_With_Exclusion_List(const DynamicVectorClass< for (; iGet_Name())); proto->DeleteSelf(); } - Prototypes[i] = NULL; + Prototypes[i] = nullptr; } } @@ -589,7 +590,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 +708,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 +731,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 +748,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 +789,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 +811,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 +820,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 +841,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 +882,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 +967,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 +975,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 +990,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 +1021,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 +1037,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 +1080,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 +1104,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 +1399,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 +1467,7 @@ FontCharsClass * WW3DAssetManager::Get_FontChars( const char * name, int point_s } font->Release_Ref(); - return NULL; + return nullptr; } @@ -1511,7 +1512,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 +1524,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 nullptr if one wasn't found * * * * WARNINGS: * * * @@ -1538,7 +1539,7 @@ PrototypeLoaderClass * WW3DAssetManager::Find_Prototype_Loader(int chunk_id) return loader; } } - return NULL; + return nullptr; } @@ -1558,7 +1559,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 +1581,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 +1635,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 +1676,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 +1702,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 f3f1ca83f7..77e46b74d2 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "Vector.h" @@ -201,7 +202,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 829cb1406c..def4a0fed4 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp @@ -88,6 +88,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "boxrobj.h" #include "w3d_util.h" #include "wwdebug.h" @@ -158,7 +159,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 +307,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 +352,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 +507,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 +725,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 +1102,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 aadd17ced0..b9b8172077 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp @@ -71,6 +71,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "camera.h" #include "ww3d.h" #include "matrix4.h" @@ -771,7 +772,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 +780,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 +801,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 db25bf9260..ea6935ca9b 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/camera.h @@ -44,6 +44,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "rendobj.h" @@ -287,10 +288,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 de63c6bdd6..02bca9b257 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "dazzle.h" #include "simplevec.h" #include "vector2.h" @@ -232,7 +233,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 +299,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 +313,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 +327,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 +344,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 +433,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 +573,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 +1285,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 nullptr. // // ---------------------------------------------------------------------------- -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 nullptr if not found { - if (id>=lensflare_count) return NULL; + if (id>=lensflare_count) return nullptr; return lensflares[id]; } @@ -1350,7 +1351,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 +1391,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 nullptr 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 +1446,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 +1455,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 +1477,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 +1554,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 +1562,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 5c59019771..1495594014 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 nullptr 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 nullptr 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 300d913270..98ff4c7b84 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 b97dfdbf0c..a2e1d5dd43 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp @@ -51,6 +51,7 @@ * SkinDecalMeshClass::Process_Material_Run -- scans the mesh for material runs * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "decalmsh.h" #include "decalsys.h" #include "rinfo.h" @@ -198,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/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 7e818fcbed..71ee9461fb 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -38,6 +38,7 @@ //#define INDEX_BUFFER_LOG +#include #include "dx8indexbuffer.h" #include "dx8wrapper.h" #include "dx8caps.h" @@ -52,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; @@ -339,7 +340,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 +367,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 687b972af3..dacceee56c 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp @@ -39,6 +39,7 @@ //#define ENABLE_CATEGORY_LOG //#define ENABLE_STRIPING +#include #include "dx8renderer.h" #include "dx8wrapper.h" #include "dx8polygonrenderer.h" @@ -101,10 +102,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 +143,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 +193,7 @@ DX8TextureCategoryClass::DX8TextureCategoryClass( : pass(pass_), shader(shd), - render_task_head(NULL), + render_task_head(nullptr), material(mat), container(container_) { @@ -201,7 +202,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 +268,7 @@ void DX8FVFCategoryContainer::Remove_Texture_Category(DX8TextureCategoryClass* t } for (pass=0; passSet_Next_Visible(new_mpr); } @@ -292,10 +293,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 +312,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 +322,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 +363,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 +383,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 +423,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 +443,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category } dest_it.Next(); } - return NULL; + return nullptr; } DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category( @@ -451,7 +452,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 +468,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category } dest_it.Next(); } - return NULL; + return nullptr; } void DX8FVFCategoryContainer::Change_Polygon_Renderer_Texture( @@ -700,7 +701,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 +1201,8 @@ DX8SkinFVFCategoryContainer::DX8SkinFVFCategoryContainer(bool sorting) : DX8FVFCategoryContainer(DX8_FVF_XYZNUV1,sorting), VisibleVertexCount(0), - VisibleSkinHead(NULL), - VisibleSkinTail(NULL) + VisibleSkinHead(nullptr), + VisibleSkinTail(nullptr) { } @@ -1249,7 +1250,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 +1275,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 +1285,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 +1399,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 +1638,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() : "nullptr")); DX8Wrapper::Set_Texture(i,Peek_Texture(i)); } @@ -1645,7 +1646,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() : "nullptr")); 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 +1678,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 +1709,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 +1722,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 +1732,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 +1750,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 +1837,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 +1867,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 +1888,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 +1907,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 +1918,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 +1937,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 +1962,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 +2111,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 +2128,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 +2177,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 1bd4dc0a67..ac367be184 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwstring.h" @@ -91,7 +92,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 +110,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 +203,7 @@ class DX8FVFCategoryContainer : public MultiListObjectClass void Add_Visible_Texture_Category(DX8TextureCategoryClass * tex_category,int pass) { WWASSERT(pass #include "dx8vertexbuffer.h" #include "dx8wrapper.h" #include "dx8fvf.h" @@ -48,13 +49,13 @@ #define DEFAULT_VB_SIZE 5000 static bool _DynamicSortingVertexArrayInUse=false; -//static VertexFormatXYZNDUV2* _DynamicSortingVertexArray=NULL; -static SortingVertexBufferClass* _DynamicSortingVertexArray=NULL; +//static VertexFormatXYZNDUV2* _DynamicSortingVertexArray=nullptr; +static SortingVertexBufferClass* _DynamicSortingVertexArray=nullptr; static unsigned short _DynamicSortingVertexArraySize=0; static unsigned short _DynamicSortingVertexArrayOffset=0; static bool _DynamicDX8VertexBufferInUse=false; -static DX8VertexBufferClass* _DynamicDX8VertexBuffer=NULL; +static DX8VertexBufferClass* _DynamicDX8VertexBuffer=nullptr; static unsigned short _DynamicDX8VertexBufferSize=DEFAULT_VB_SIZE; static unsigned short _DynamicDX8VertexBufferOffset=0; @@ -305,7 +306,7 @@ SortingVertexBufferClass::~SortingVertexBufferClass() DX8VertexBufferClass::DX8VertexBufferClass(unsigned FVF, unsigned short vertex_count_, UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, FVF, vertex_count_), - VertexBuffer(NULL) + VertexBuffer(nullptr) { Create_Vertex_Buffer(usage); } @@ -320,7 +321,7 @@ DX8VertexBufferClass::DX8VertexBufferClass( UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_NORMAL, VertexCount), - VertexBuffer(NULL) + VertexBuffer(nullptr) { WWASSERT(vertices); WWASSERT(normals); @@ -341,7 +342,7 @@ DX8VertexBufferClass::DX8VertexBufferClass( UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_NORMAL|D3DFVF_DIFFUSE, VertexCount), - VertexBuffer(NULL) + VertexBuffer(nullptr) { WWASSERT(vertices); WWASSERT(normals); @@ -362,7 +363,7 @@ DX8VertexBufferClass::DX8VertexBufferClass( UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_DIFFUSE, VertexCount), - VertexBuffer(NULL) + VertexBuffer(nullptr) { WWASSERT(vertices); WWASSERT(tex_coords); @@ -381,7 +382,7 @@ DX8VertexBufferClass::DX8VertexBufferClass( UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, D3DFVF_XYZ|D3DFVF_TEX1, VertexCount), - VertexBuffer(NULL) + VertexBuffer(nullptr) { WWASSERT(vertices); WWASSERT(tex_coords); @@ -711,7 +712,7 @@ DynamicVBAccessClass::DynamicVBAccessClass(unsigned t,unsigned fvf,unsigned shor Type(t), FVFInfo(_DynamicFVFInfo), VertexCount(vertex_count_), - VertexBuffer(0) + VertexBuffer(nullptr) { WWASSERT(fvf==dynamic_fvf_type); WWASSERT(Type==BUFFER_TYPE_DYNAMIC_DX8 || Type==BUFFER_TYPE_DYNAMIC_SORTING); @@ -742,13 +743,13 @@ DynamicVBAccessClass::~DynamicVBAccessClass() void DynamicVBAccessClass::_Deinit() { - WWASSERT ((_DynamicDX8VertexBuffer == NULL) || (_DynamicDX8VertexBuffer->Num_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 b669695788..380ec1c2bd 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -47,6 +47,7 @@ #define WINVER 0x0500 // Required to access GetMonitorInfo in VC6. #endif +#include #include "dx8wrapper.h" #include "dx8webbrowser.h" #include "dx8fvf.h" @@ -99,7 +100,7 @@ int DX8Wrapper_PreserveFPU = 0; ** ***********************************************************************************/ -static HWND _Hwnd = NULL; +static HWND _Hwnd = nullptr; bool DX8Wrapper::IsInitted = false; bool DX8Wrapper::_EnableTriangleDraw = true; @@ -122,8 +123,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 +142,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 +168,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 +198,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 +305,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 +316,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 +332,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 +352,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 +370,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 +462,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 nullptr, 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 nullptr. MW Release_Render_State(); // (gth) clear the matrix shadows too @@ -512,14 +513,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 +609,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 +656,11 @@ void DX8Wrapper::Release_Device(void) for (int a=0;aRelease(); - D3DDevice=NULL; + D3DDevice=nullptr; } } @@ -894,7 +895,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 +947,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 +1185,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 +1221,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 +1348,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 +1612,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 +1648,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 +1688,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 +1720,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 +1874,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 +2169,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 nullptr")); } } } @@ -2203,7 +2204,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 +2228,7 @@ void DX8Wrapper::Apply_Render_State_Changes() } else { DX8CALL(SetIndices( - NULL, + nullptr, 0)); DX8_RECORD_INDEX_BUFFER_CHANGE(); } @@ -2250,7 +2251,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 +2260,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 nullptr. if (rendertarget) { unsigned ret=D3DXCreateTexture( DX8Wrapper::_Get_D3D_Device8(), @@ -2273,12 +2274,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 +2316,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 +2335,8 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture D3DX_FILTER_BOX, D3DX_FILTER_BOX, 0, - NULL, - NULL, + nullptr, + nullptr, &texture); if (result != D3D_OK) { @@ -2360,7 +2361,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 +2373,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 +2402,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 +2420,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 +2455,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } } @@ -2484,7 +2485,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 +2494,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 nullptr. if (rendertarget) { unsigned ret=D3DXCreateCubeTexture @@ -2510,7 +2511,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 +2546,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 +2622,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 +2692,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 +2716,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 +2925,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 +2943,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 +2956,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 +2982,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 nullptr 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 +3014,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 +3044,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 nullptr if (!Get_Current_Caps()->Support_Render_To_Texture_Format(format) || !Get_Current_Caps()->Support_Depth_Stencil_Format(zformat)) { @@ -3085,7 +3086,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 +3118,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 +3144,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 +3160,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 +3180,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 nullptr. 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 +3243,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 +3273,7 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default } else { - DX8CALL(SetRenderTarget (CurrentRenderTarget, NULL)); + DX8CALL(SetRenderTarget (CurrentRenderTarget, nullptr)); } } } @@ -3280,9 +3281,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 +3309,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 nullptr. 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 +3371,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 +3388,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 +3430,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 +3626,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 nullptr",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 f72ce2e13e..7aed2a19e5 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "dllist.h" @@ -459,9 +460,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 +488,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 +829,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 fa9af0c8db..ee4ff6e7be 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp @@ -46,6 +46,7 @@ * HAnimManagerClass::Add_Anim -- Adds an externally created animation to the manager * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hanimmgr.h" #include "hanim.h" #include "hrawanim.h" @@ -94,11 +95,11 @@ HAnimManagerClass::~HAnimManagerClass(void) Free_All_Anims(); delete AnimPtrTable; - AnimPtrTable = NULL; + AnimPtrTable = nullptr; Reset_Missing(); delete MissingAnimTable; - MissingAnimTable = NULL; + MissingAnimTable = nullptr; } @@ -153,7 +154,7 @@ int HAnimManagerClass::Load_Morph_Anim(ChunkLoadClass & cload) { HMorphAnimClass * newanim = W3DNEW HMorphAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -163,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; @@ -196,7 +197,7 @@ int HAnimManagerClass::Load_Raw_Anim(ChunkLoadClass & cload) { HRawAnimClass * newanim = W3DNEW HRawAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -206,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; @@ -239,7 +240,7 @@ int HAnimManagerClass::Load_Compressed_Anim(ChunkLoadClass & cload) { HCompressedAnimClass * newanim = W3DNEW HCompressedAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -249,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; @@ -298,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; @@ -384,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)); } } @@ -405,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 (); @@ -419,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 ) @@ -429,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/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hlod.cpp index 2287e2a6dc..51ec0141a6 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 * @@ -126,6 +126,7 @@ +#include #include "hlod.h" #include "assetmgr.h" #include "hmdldef.h" @@ -213,21 +214,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 +271,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 +293,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 +338,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 +373,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 +399,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 +724,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 +764,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 +1008,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 +1079,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 +1113,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 +1126,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 +1168,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 +1249,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 +1350,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 +1362,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 +1425,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 +1708,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 +1740,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 +1751,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 +1825,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 +1856,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 +1866,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 +1908,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 +1924,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 +1934,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 +1949,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 +1985,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 +2010,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 nullptr object to the start of the lod list Add_Lod_Model (0, null_object, 0); null_object->Release_Ref (); } @@ -2039,7 +2040,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 +2064,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 +2377,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 +2414,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 +2500,7 @@ RenderObjClass * HLodClass::Get_Sub_Object_On_Bone(int index,int boneindex) cons count++; } } - return NULL; + return nullptr; } @@ -3206,7 +3207,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 +3319,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 +3419,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 +3434,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 +3510,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 27ea79983c..9ee8a2d1e1 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -36,6 +36,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hmorphanim.h" #include "w3d_file.h" #include "chunkio.h" @@ -195,9 +196,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 +212,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 +350,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 +363,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 +395,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 +428,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // Cleanup // delete [] channel_list; - channel_list = NULL; + channel_list = nullptr; } // @@ -441,7 +442,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 +450,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 +483,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 +511,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 +560,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 +608,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 +656,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 b4dcf09fe1..66ae301af1 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -50,6 +50,7 @@ * HRawAnimClass::Get_Visibility -- return visibility state for given pivot/frame * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hrawanim.h" #include "motchan.h" #include "chunkio.h" @@ -68,14 +69,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 +122,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 +162,7 @@ HRawAnimClass::~HRawAnimClass(void) void HRawAnimClass::Free(void) { delete[] NodeMotion; - NodeMotion = NULL; + NodeMotion = nullptr; } @@ -220,7 +221,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 +230,7 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) FrameRate = aheader.FrameRate; NodeMotion = W3DNEWARRAY NodeMotionStruct[ NumNodes ]; - if (NodeMotion == NULL) { + if (NodeMotion == nullptr) { goto Error; } @@ -429,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; } @@ -448,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])); } @@ -465,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])); } @@ -509,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); @@ -537,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]); } @@ -548,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]); } @@ -573,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; // } @@ -591,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]); } @@ -615,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 ); @@ -644,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); } @@ -669,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; } @@ -684,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/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp index c0c8fdec4d..4fc53aa7a3 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 1e9f8ecc21..ed83f8a8a3 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 178db80b33..c3622f3a15 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp @@ -86,6 +86,7 @@ * MeshClass::Make_Unique -- Makes mesh unique in the renderer, but still shares system ram * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "mesh.h" #include #include "w3d_file.h" @@ -154,11 +155,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 +182,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 +218,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 +392,7 @@ MaterialInfoClass * MeshClass::Get_Material_Info(void) return Model->MatInfo; } } - return NULL; + return nullptr; } @@ -409,7 +410,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 +511,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 +565,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 +593,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 +616,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 +750,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 +789,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 +840,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 +991,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 +1017,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 +1105,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 +1426,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 +1437,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 +1531,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 +1539,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 c1633d5a0e..793c4349c7 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/mesh.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "rendobj.h" @@ -141,7 +142,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 db16e9d09f..42d74eb75a 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp @@ -58,6 +58,7 @@ * MeshBuilderClass::Sort_Vertices_By_Vertex_Material -- sorts verts by vertex mtl in pass0 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshbuild.h" #include "uarray.h" #include @@ -160,7 +161,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 +407,7 @@ void MeshBuilderClass::VertClass::Reset(void) Attribute1 = 0; UniqueIndex = 0; ShadeIndex = 0; - NextHash = NULL; + NextHash = nullptr; } @@ -557,16 +558,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 +587,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 +606,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 +824,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 +1011,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 221307965e..ea99882099 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp @@ -85,6 +85,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshgeometry.h" #include "aabtree.h" #include "chunkio.h" @@ -121,25 +122,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 +158,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 +312,7 @@ const char * MeshGeometryClass::Get_Name(void) const if (MeshName) { return MeshName->Get_Array(); } - return NULL; + return nullptr; } @@ -356,7 +357,7 @@ const char * MeshGeometryClass::Get_User_Text(void) if (UserText) { return UserText->Get_Array(); } - return NULL; + return nullptr; } @@ -398,7 +399,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 +419,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 +474,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 +513,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 +1248,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 +1285,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 +1377,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 +1466,7 @@ Vector4 * MeshGeometryClass::get_planes(bool create) if (PlaneEq) { return PlaneEq->Get_Array(); } - return NULL; + return nullptr; #endif } @@ -1540,7 +1541,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 +1612,7 @@ WW3DErrorType MeshGeometryClass::Load_W3D(ChunkLoadClass & cload) Set_Name(tmpname); delete[] tmpname; - tmpname = NULL; + tmpname = nullptr; /* ** Set Bounding Info @@ -1671,7 +1672,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 +1893,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 15474c20fa..bf3f9bfba3 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "bittype.h" @@ -149,7 +150,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 +264,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 +275,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 55561099f0..c4ff827e8d 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp @@ -36,6 +36,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshmatdesc.h" #include "texture.h" #include "vertmaterial.h" @@ -180,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 @@ -522,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 @@ -549,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]; @@ -557,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]; @@ -565,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) @@ -587,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; @@ -623,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 @@ -651,25 +652,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 +744,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 +760,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 2926692389..2215b1655b 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector2.h" @@ -145,11 +146,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 +179,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 +226,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-nullptr pointers will be released when the buffer ** is destroyed. */ class MatBufferClass : public ShareBufferClass < VertexMaterialClass * > @@ -303,12 +304,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 +333,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 +346,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 +358,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 +387,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 +438,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 +466,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 275c79e234..13572eeede 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 2a48ea3b17..f5aba8a7a1 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 nullptr 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 c2bfcf7691..5f3f81cd46 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -75,6 +75,7 @@ * MeshSaveContextClass::~MeshSaveContextClass -- destructor * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshmdl.h" #include "aabtree.h" #include "matinfo.h" @@ -236,7 +237,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 +281,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 +399,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 +585,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 +644,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 +766,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 +886,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 +1554,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 +1654,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 +1834,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 +1873,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 +1898,7 @@ MeshLoadContextClass::MeshLoadContextClass(void) PrelitChunkID = 0xffffffff; CurPass = 0; CurTexStage = 0; - TexCoords = NULL; + TexCoords = nullptr; LoadedDIG = false; } @@ -1919,7 +1920,7 @@ MeshLoadContextClass::~MeshLoadContextClass(void) int i; delete TexCoords; - TexCoords = NULL; + TexCoords = nullptr; for (i=0; iRelease_Ref(); @@ -1949,7 +1950,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 +1991,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 +2013,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 +2053,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 +2071,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 +2134,7 @@ VertexMaterialClass * MeshLoadContextClass::Peek_Legacy_Vertex_Material(int lega if (vi != -1) { return Peek_Vertex_Material(vi); } else { - return NULL; + return nullptr; } } @@ -2158,7 +2159,7 @@ TextureClass * MeshLoadContextClass::Peek_Legacy_Texture(int legacy_material_ind if (ti != -1) { return Peek_Texture(ti); } else { - return NULL; + return nullptr; } } @@ -2275,7 +2276,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 +2319,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 +2336,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 +2464,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 +2586,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 +2616,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 +2636,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 +2652,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 +2667,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 +2682,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 +2699,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 +2719,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 ec512b3520..3273211292 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 feeb891f57..0f8585efd8 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 a70cf24f65..34c33cb9b1 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 nullptr (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 nullptr 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 37a1731b0e..4b30352fe7 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -34,6 +34,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "part_emt.h" #include "wwdebug.h" #include "ww3d.h" @@ -92,8 +93,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 +132,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 +179,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 +197,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 +350,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-nullptr Scene), and then adds the particle // buffer to it. if ( BufferSceneNeeded ) { @@ -451,8 +452,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 +463,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 +631,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 +687,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 +811,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 +824,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 +861,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 410de23a81..2274c6c87b 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "rendobj.h" #include "RANDOM.h" @@ -77,8 +78,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 +118,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 +174,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 +215,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 +296,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 +304,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 nullptr). Vector3 BaseVel; // Base initial emission velocity. - Vector3Randomizer * VelRand; // Velocity randomizer pointer (may be NULL). + Vector3Randomizer * VelRand; // Velocity randomizer pointer (may be nullptr). 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 e25e57244a..a1b12dedf6 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 1856a8c1ef..6e88239b02 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(); } @@ -634,7 +634,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) @@ -665,7 +665,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 a9bf9a5169..904ae58d33 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/render2d.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "simplevec.h" @@ -94,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); @@ -188,7 +189,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 cea7f87bce..93ee8b64ce 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 62c73f0488..a189e698c6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp @@ -57,6 +57,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "scene.h" #include "plane.h" #include "camera.h" @@ -351,7 +352,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 +544,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 f17ba4de0d..7be5079fcf 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ +#include #include "sortingrenderer.h" #include "dx8vertexbuffer.h" #include "dx8indexbuffer.h" @@ -377,7 +378,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 +495,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 +544,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 +562,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 +720,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 +737,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 +750,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 +848,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 267d9f3384..3b8e2b4712 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp @@ -37,6 +37,7 @@ * Get_Preset -- retrieve presets * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "vertmaterial.h" #include "realcrc.h" #include "wwdebug.h" @@ -71,9 +72,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 +88,7 @@ VertexMaterialClass::VertexMaterialClass(void): for (i=0; iClone(); @@ -156,7 +157,7 @@ VertexMaterialClass::~VertexMaterialClass(void) if (Mapper[i]) { REF_PTR_RELEASE(Mapper[i]); - Mapper[i]=NULL; + Mapper[i]=nullptr; } } @@ -181,9 +182,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;stage #include "ww3d.h" #include "rinfo.h" #include "assetmgr.h" @@ -183,7 +184,7 @@ bool WW3D::MungeSortOnLoad = false; bool WW3D::OverbrightModifyOnLoad = false; -FrameGrabClass * WW3D::Movie = NULL; +FrameGrabClass * WW3D::Movie = nullptr; bool WW3D::PauseRecord; bool WW3D::RecordNextFrame; @@ -194,11 +195,11 @@ long WW3D::UserStat2 = 0; float WW3D::DefaultNativeScreenSize = 1.0f; -StaticSortListClass * WW3D::DefaultStaticSortLists = NULL; -StaticSortListClass * WW3D::CurrentStaticSortLists = NULL; +StaticSortListClass * WW3D::DefaultStaticSortLists = nullptr; +StaticSortListClass * WW3D::CurrentStaticSortLists = nullptr; -VertexMaterialClass * WW3D::DefaultDebugMaterial = NULL; +VertexMaterialClass * WW3D::DefaultDebugMaterial = nullptr; ShaderClass WW3D::DefaultDebugShader(DEFAULT_DEBUG_SHADER_BITS); ShaderClass WW3D::LightmapDebugShader(LIGHTMAP_DEBUG_SHADER_BITS); @@ -214,7 +215,7 @@ unsigned WW3D::NPatchesLevel=1; bool WW3D::IsTexturingEnabled=true; bool WW3D::IsColoringEnabled=false; -static HWND _Hwnd = NULL; // Not a member to hide windows from WW3D users +static HWND _Hwnd = nullptr; // Not a member to hide windows from WW3D users static int _TextureReduction = 0; static int _TextureMinDim = 1; static bool _LargeTextureExtraReductionEnabled = false; @@ -1016,7 +1017,7 @@ WW3DErrorType WW3D::Render( DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_SOLID); // Install the lighting environment if one is supplied - if (rinfo.light_environment != NULL) { + if (rinfo.light_environment != nullptr) { DX8Wrapper::Set_Light_Environment(rinfo.light_environment); } @@ -1356,10 +1357,10 @@ void WW3D::Make_Screen_Shot( const char * filename_base , const float gamma, con 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 { @@ -1368,7 +1369,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 +1399,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 +1505,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 +1540,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 +1656,7 @@ bool WW3D::Is_Movie_Paused() *=============================================================================================*/ bool WW3D::Is_Recording_Next_Frame() { - return (Movie != 0) && (!PauseRecord || RecordNextFrame); + return (Movie != nullptr) && (!PauseRecord || RecordNextFrame); } @@ -1673,7 +1674,7 @@ bool WW3D::Is_Recording_Next_Frame() *=============================================================================================*/ bool WW3D::Is_Movie_Ready() { - return Movie != 0; + return Movie != nullptr; } @@ -1706,10 +1707,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 +1719,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 +1749,7 @@ void WW3D::Update_Movie_Capture( void ) surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; Movie->Grab(image); #endif @@ -1877,7 +1878,7 @@ VertexMaterialClass * WW3D::Peek_Default_Debug_Material(void) WWASSERT(DefaultDebugMaterial); return DefaultDebugMaterial; #else - return NULL; + return nullptr; #endif } @@ -1930,7 +1931,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 f169690b69..6dd5fef435 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector3.h" @@ -100,7 +101,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 +144,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 1bdfe50293..2a18f60ac5 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 dda18bf3ae..0a0cca6e32 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 d79cb6085e..af2fa5bd93 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 nullptr, 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 84300568e4..81d66d82eb 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, ("nullptr 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 b53865f58f..475af3a4da 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 f65f77b031..f688806a28 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 4a31019bc9..8c9230fddc 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 4f2f38a36a..5b30349535 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 ea0b71c312..c0ac2f89ed 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 7d73dea209..101dfeda44 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 9692ada0d9..35e4ea7f12 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 4b34062e48..e44b979f27 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 762e869b3e..334362fa10 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 a02474ed9c..db2da4e813 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 2fd0bec921..66e8373758 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 07b2c4da46..1079058099 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 2d8b21d018..22da4b484b 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 7cb45b9e44..e0735558d7 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 e5a350b1a9..de4cf8437d 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 8e00fe565f..6f914913fd 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 nullptr 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 45904e7c54..576a176eeb 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 nullptr 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 nullptr 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( TheHierarchyView->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 9ede862b0f..28f5ebc620 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 3a85e20411..371b3d853d 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 ad880c3211..328b7b3a54 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 bc6a055d5e..36d262ed99 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 0ba1ac79c9..f1a4fe80d6 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 2e933110eb..997badeb12 100644 --- a/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h +++ b/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h @@ -17,12 +17,13 @@ */ #pragma once +#include 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 8b2f8df1a1..6a3f2d3037 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 5a3be36cca..235b21da68 100644 --- a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h +++ b/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------------*/ #pragma once +#include // INCLUDES /////////////////////////////////////////////////////////////////// #include "Resource.h" @@ -49,7 +50,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 +68,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 +86,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 +104,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 +122,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 7d3dd89fcb..fc8e38cd2b 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 4cd07683ea..f7f3dc0d13 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 bccb164389..bd4b45e05d 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 670b92543b..cb5bfef299 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 0e62ee6e95..0b1e474b4d 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 93b05b4b5d..ca97cf0a8f 100644 --- a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h +++ b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------------*/ #pragma once +#include #include "Resource.h" #include "ISwapablePanel.h" @@ -48,7 +49,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 +67,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 +86,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 e6b499af11..d9bfa47736 100644 --- a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h +++ b/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------------*/ #pragma once +#include // INCLUDES /////////////////////////////////////////////////////////////////// #include "Resource.h" @@ -49,7 +50,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 +68,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 +86,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 +104,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 +122,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 b8ee509478..20bc9f5254 100644 --- a/Generals/Code/Tools/WorldBuilder/include/BaseBuildProps.h +++ b/Generals/Code/Tools/WorldBuilder/include/BaseBuildProps.h @@ -17,6 +17,7 @@ */ #pragma once +#include // BaseBuildProps.h : header file // @@ -28,7 +29,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 00f661fa1b..2b72f9d0ef 100644 --- a/Generals/Code/Tools/WorldBuilder/include/BlendMaterial.h +++ b/Generals/Code/Tools/WorldBuilder/include/BlendMaterial.h @@ -17,6 +17,7 @@ */ #pragma once +#include // BlendMaterial.h : header file // @@ -32,7 +33,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 26b7b28e03..1fa68ff27e 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 bb77f20cfa..b740698729 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 9d81a9db14..f444e3d0cb 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 95863f9cd0..167697750c 100644 --- a/Generals/Code/Tools/WorldBuilder/include/CameraOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/CameraOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // CameraOptions.h : header file // @@ -31,7 +32,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 9b8c8fc88e..a229aa8aff 100644 --- a/Generals/Code/Tools/WorldBuilder/include/CellWidth.h +++ b/Generals/Code/Tools/WorldBuilder/include/CellWidth.h @@ -17,6 +17,7 @@ */ #pragma once +#include // CellWidth.h : header file // @@ -28,7 +29,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 26f4cffbee..31b61ff7af 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ContourOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ContourOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ContourOptions.h : header file // @@ -35,7 +36,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 d060b685f3..c7a069211f 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditAction.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditAction.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EditAction.h : header file // @@ -32,7 +33,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 b6f04353a5..773ffa8014 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditCondition.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditCondition.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EditCondition.h : header file // @@ -31,7 +32,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 f2dc677090..94e88687d8 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 2a3585f808..9446372b78 100644 --- a/Generals/Code/Tools/WorldBuilder/include/EditGroup.h +++ b/Generals/Code/Tools/WorldBuilder/include/EditGroup.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EditGroup.h : header file // @@ -29,7 +30,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 6f1c4dd965..0ab31d7529 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 082e10b3c6..2ac6663eae 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 fa38ca049d..24300dfdbc 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ExportScriptsOptions.h : header file // @@ -28,7 +29,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 2cd482dd5f..bd83773f26 100644 --- a/Generals/Code/Tools/WorldBuilder/include/FeatherOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/FeatherOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // brushoptions.h : header file // @@ -37,7 +38,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 8c11eefa41..144244eb03 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 f38d6251bb..cb8a2b24d8 100644 --- a/Generals/Code/Tools/WorldBuilder/include/GlobalLightOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/GlobalLightOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // GLOBALLIGHTOPTIONS.h : header file // @@ -40,7 +41,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 22df766d48..a176b4858b 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 6312a67db7..7db3a7cc11 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include class ImpassableOptions : public CDialog { @@ -24,7 +25,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 2dbbcb0dd1..2b761c4917 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 e08e6b0759..3022c30853 100644 --- a/Generals/Code/Tools/WorldBuilder/include/LightOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/LightOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // LightOptions.h : header file // @@ -31,7 +32,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 8fc0810a06..9fc1eda841 100644 --- a/Generals/Code/Tools/WorldBuilder/include/MapSettings.h +++ b/Generals/Code/Tools/WorldBuilder/include/MapSettings.h @@ -17,6 +17,7 @@ */ #pragma once +#include // MapSettings.h : header file // @@ -28,7 +29,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 0e6515be6f..02d3709609 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 d81891a47b..39c8ba0bcc 100644 --- a/Generals/Code/Tools/WorldBuilder/include/MoundOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/MoundOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // MoundOptions.h : header file // @@ -41,7 +42,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 9ae6fde449..3cacd82ec1 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 3b94fd9b70..d4f0a79894 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 80d679ccd8..befda7f02f 100644 --- a/Generals/Code/Tools/WorldBuilder/include/OpenMap.h +++ b/Generals/Code/Tools/WorldBuilder/include/OpenMap.h @@ -17,6 +17,7 @@ */ #pragma once +#include // OpenMap.h : header file // @@ -35,7 +36,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 ff459a0e90..9c8c674e19 100644 --- a/Generals/Code/Tools/WorldBuilder/include/OptionsPanel.h +++ b/Generals/Code/Tools/WorldBuilder/include/OptionsPanel.h @@ -17,6 +17,7 @@ */ #pragma once +#include // OptionsPanel.h : header file // @@ -32,7 +33,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 c6a58c0e32..dcd641a509 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 1d6828ae48..255e7fbfd1 100644 --- a/Generals/Code/Tools/WorldBuilder/include/RampOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/RampOptions.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------------*/ #pragma once +#include // INCLUDES /////////////////////////////////////////////////////////////////// #include "OptionsPanel.h" @@ -47,7 +48,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 1536469cbf..f62b02bb6f 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 4a849ff5ec..177704fb22 100644 --- a/Generals/Code/Tools/WorldBuilder/include/SaveMap.h +++ b/Generals/Code/Tools/WorldBuilder/include/SaveMap.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SaveMap.h : header file // @@ -36,7 +37,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 1fdae4e413..128bcd5d53 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 2e3e305579..55f3f8b130 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 a310883828..2480c60477 100644 --- a/Generals/Code/Tools/WorldBuilder/include/SelectMacrotexture.h +++ b/Generals/Code/Tools/WorldBuilder/include/SelectMacrotexture.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SelectMacrotexture.h : header file // @@ -28,7 +29,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 1af6e29d51..2e04d28f74 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ShadowOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ShadowOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ShadowOptions.h : header file // @@ -28,7 +29,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 5018911070..9dbf445a10 100644 --- a/Generals/Code/Tools/WorldBuilder/include/TerrainMaterial.h +++ b/Generals/Code/Tools/WorldBuilder/include/TerrainMaterial.h @@ -17,6 +17,7 @@ */ #pragma once +#include // terrainmaterial.h : header file // @@ -32,7 +33,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 6032a53b6f..96427faeb8 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 70515caca9..670a74c921 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 129b12204f..327e876a2b 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WBFrameWnd.h +++ b/Generals/Code/Tools/WorldBuilder/include/WBFrameWnd.h @@ -17,6 +17,7 @@ */ #pragma once +#include // WBFrameWnd.h : header file // @@ -41,8 +42,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 +71,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 fe2e8fa083..f6fca8fd16 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 nullptr, 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 9cf098f0e3..70ef07da24 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 3a4feaabd3..4663df59d1 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 5ea8f22dde..03c02004b2 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 01f04ea829..b36a4f64d5 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 nullptr, 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 822473285e..1418f56da2 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 nullptr 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 2222f54b99..7039b42a46 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 fe9a13b162..22e2f6a977 100644 --- a/Generals/Code/Tools/WorldBuilder/include/brushoptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/brushoptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // brushoptions.h : header file // @@ -37,7 +38,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 87eb399ba1..d233b0ced4 100644 --- a/Generals/Code/Tools/WorldBuilder/include/euladialog.h +++ b/Generals/Code/Tools/WorldBuilder/include/euladialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // euladialog.h : header file // @@ -28,7 +29,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 8579629282..64ad5cbc7c 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 3ec9c41051..8069032ab1 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 34c9c0beaa..1a290550d6 100644 --- a/Generals/Code/Tools/WorldBuilder/include/propedit.h +++ b/Generals/Code/Tools/WorldBuilder/include/propedit.h @@ -17,6 +17,7 @@ */ #pragma once +#include // propedit.h : header file // @@ -28,7 +29,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 536bcd4ac7..096e1c845e 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 9b8a879c2c..98c0210889 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 nullptr 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 f1f38c74c0..e6c4dd3d4f 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 nullptr 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 cd7adaf8f3..f0630a84b9 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 2848478375..d0676c592b 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 e3017bdaa7..08c69b405e 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BrushTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BrushTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -46,8 +48,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 3b677d78e5..ad895aa69c 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 aa520a4105..3b8d10c59c 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 1ba555be5d..7fe6ab3178 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 a998b7869b..32f1633aac 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 25a4440e3b..a2fd1b0a95 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 6309e481e9..ea1bc9dea1 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 db327f00a1..42fe7c2d67 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 nullptr. 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 6c0e522a53..c7bce6af8e 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 4db1f52698..4ea362a23a 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 ddf29114ad..31b897cfae 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 cb3953b404..ed5052bcbb 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 72fa568592..1f9f059529 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(), ("nullptr 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 3f8321d85c..d1321a2f06 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 038f5d440b..1ec0631136 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 fea78fb438..1fcad1a76e 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 e836537407..6d6db24f6d 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 117004025f..d5c2faac0b 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FeatherTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FeatherTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -42,9 +44,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 0b4885ad5c..702ad907b5 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(), ("nullptr 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 c7d89109b8..60a5793ace 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 328370274d..451e77c3b5 100644 --- a/Generals/Code/Tools/WorldBuilder/src/FloodFillTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/FloodFillTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -40,7 +42,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 +68,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 5cbd61e86f..6879f5eb27 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 b0cb541a0f..8687248189 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 c53bc119d5..0905871cf3 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 5a44b9c464..7d73bf7297 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 nullptr 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 nullptr 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 nullptr 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 788a2cae4e..10ee00a028 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 0501faf23b..369067109f 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 114bbda21a..1c454135dc 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 bfd863b061..1801d404e8 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 fc0ec4df85..7a04ba1cd2 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 c5ae174c04..34eed254fc 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp @@ -20,6 +20,8 @@ // Terrain shaping tool for worldbuilder. // Author: John Ahlquist, Oct 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -41,7 +43,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 +97,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 +188,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 8bdc6b806d..bde4aa980f 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 ffcaefc317..44156f7ebf 100644 --- a/Generals/Code/Tools/WorldBuilder/src/MoundTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/MoundTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -45,8 +47,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 3e42d6af2c..a79ca28d42 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 98d0421808..43358bb9f3 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 941cee4d11..a523df0779 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(), ("nullptr 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 0e3cc1618f..20e74dc964 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 c8f140bdb5..43ddb3b405 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 5810c435c8..015a5b091d 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 1a747e2cd8..ea5f1df381 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 5f4b9d903a..bb960eb7d6 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(), ("nullptr 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 7d8490ba11..2bb96cd190 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 c58312ca60..2fec8cd3e4 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 6bf4b22e39..88447e1c81 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RampOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RampOptions.cpp @@ -31,6 +31,7 @@ /* 4/23/2002 : Initial creation */ /*---------------------------------------------------------------------------*/ +#include #include "StdAfx.h" #include "RampOptions.h" @@ -48,7 +49,7 @@ RampOptions::RampOptions(CWnd* pParent) : COptionsPanel(RampOptions::IDD, pParen RampOptions::~RampOptions() { - TheRampOptions = NULL; + TheRampOptions = nullptr; } Bool RampOptions::shouldApplyTheRamp() @@ -79,7 +80,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 d0764505b3..17cbb61aa1 100644 --- a/Generals/Code/Tools/WorldBuilder/src/RampTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/RampTool.cpp @@ -30,6 +30,9 @@ /* Revision History: */ /* 4/19/2002 : Initial creation */ /*---------------------------------------------------------------------------*/ + +#include + #include "StdAfx.h" #include "RampTool.h" @@ -83,7 +86,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 +102,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 +117,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 +166,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 68d0820454..15c95eb859 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 ffb6a3d65d..55e07945b9 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 4214f46804..9640f4e448 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 12c8ef06c2..1ef2a1dedf 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 7dc51c9a8d..e5c9cd07ff 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 8c226f8bf5..31310f25ee 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; @@ -126,13 +126,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()); @@ -144,7 +144,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(); @@ -218,7 +218,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 7513d0f669..097e13a08e 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; @@ -126,13 +126,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()); @@ -144,7 +144,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(); @@ -218,7 +218,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 ab2d3abed1..0ca551a1ad 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; @@ -143,10 +143,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); @@ -154,15 +154,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; @@ -186,8 +186,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(); @@ -232,7 +232,7 @@ void ScriptConditionsDlg::OnOr() m_script->setOrCondition(pOr); } loadList(); - setSel(pOr, NULL); + setSel(pOr, nullptr); } void ScriptConditionsDlg::OnNew() @@ -246,7 +246,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); @@ -290,7 +290,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); @@ -306,7 +306,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(); @@ -326,9 +326,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(); @@ -356,14 +356,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 1cfdb69b09..a56eeace5c 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 64b1c401ea..68e403d43d 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 d2de095c9e..23bbfa673e 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 b07a6ad140..d3695af3b4 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 ecd327af6d..325d6c8596 100644 --- a/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp @@ -16,6 +16,8 @@ ** along with this program. If not, see . */ +#include + #include "StdAfx.h" #include "SplashScreen.h" @@ -65,7 +67,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 803b19d7e5..76ae9a5c0f 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 3ca98b22b2..36cbba5c4f 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 beed12aff1..8b25017731 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 c4d6e5a30a..a17a70211a 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 a526281496..92565ef6e6 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TileTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TileTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -40,7 +42,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 4962e7cff4..f55ab2027c 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 3b57d0cb3f..25c07caef7 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WBFrameWnd.cpp @@ -19,6 +19,8 @@ // WBFrameWnd.cpp : implementation file // +#include + #include "StdAfx.h" #include "WorldBuilder.h" #include "MainFrm.h" @@ -50,7 +52,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 ceaf815bc8..ef58aa73b7 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 4a3fd07652..5762c98987 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 nullptr!")); 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 e667ac3f90..aa68debe4b 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 nullptr 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 e716b431b4..eabfa56d1b 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 239e003acd..e820d5a10c 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 111bb04d8e..c232423875 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 2456882821..56d7475652 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 aa8be4c583..a17f31a1c5 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 nullptr. 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 nullptr, 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 da3eb6fb1c..fa54052e72 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 nullptr 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 171d50879a..97a1590866 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 0c0abb1afa..7372b0d42e 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 030a00630b..4f4e9c12a5 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 59d8b88363..2080472675 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 ec1855d77a..8448aad469 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 1ad5e6a164..7fcf8ae1d0 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 d512204cf1..a087a7cb8f 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 ee07f29dfb..abf98a9d03 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 ) ) { @@ -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 ) ) { @@ -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 ) ) { @@ -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 84b2ec0b70..c2d731229c 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 f579652028..6e8e895992 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 b27261582a..68d040ea8e 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 nullptr on creation then non-nullptr 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 af9bfadd78..bd16a53fa3 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 438580c5b3..f1fba30919 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 nullptr. + // The parser of the base class should set this pointer to nullptr. 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 nullptr 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 295ffd2fae..bdd741ffe3 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 2f9cfd1572..0214bf86ae 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 5cf1b10b62..1e7c224fd5 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 fa4fccad23..9b2a12458d 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 613cae1406..86437a1b46 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 d73af7cd0f..cf5d9e5484 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 e6ea3dd33c..2dd9f863f2 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 a7af21cd32..074b104299 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 ffa939baf7..c948ff09c1 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 03ae479dd0..e94f51d8b0 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 nullptr 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 45cd955858..aa41b18cc2 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 b2a4c60d05..c072e01f2c 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 ac292248cd..5b1d77ed29 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 7fe0641a24..90bec473a8 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 829c0cb4de..13d8660547 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 5c2990fe3a..6312d3467e 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 c23f802362..719d5cb846 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 e7c5725ba1..d0b6175a70 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 b5ac00ce11..cc332e97e4 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 2c9ea65d22..de3984df9a 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 982a401ae6..134276ae68 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 621f798a87..dcd4745339 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 77220fbfb8..3fb0770465 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 eed24494d8..b0f4a2cb3e 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 fb8456685e..d69afabace 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() { } // ~GeneralPersona( void ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h b/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h index 2017aba7ac..dcd5a2d18d 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 1d37eb6ee3..b4a0dbbddb 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 a4a1782e84..a00dfda8c6 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 799633ed04..352a2517d8 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 b66eb7dc96..60c1035211 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 356bc358ba..747c88ef9b 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 0c1ac74524..56fc475e5c 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 9823f276f1..7709091010 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 53d485e4d2..ced1e0c301 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 8eb102efae..323c2a610b 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 3a0d32e59f..e142704760 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 08ce4da1ec..154799a5dd 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 500c4ecd22..d9d0656052 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h @@ -41,6 +41,7 @@ //---------------------------------------------------------------------------- #pragma once +#include //---------------------------------------------------------------------------- // Includes @@ -72,8 +73,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 18f652a9df..4a490fef3e 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 22616dff9d..62fe086204 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 fcd6bca92d..239014b8ec 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 5c791363fd..1301e402fa 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 d30b79567f..775610d4e0 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 99a4cd54ce..f43abe3b11 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Keyboard.h @@ -113,7 +113,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 ba8031e8d7..e92ea0fcc4 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Line2D.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Line2D.h @@ -28,6 +28,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once +#include typedef std::vector Coord2DVector; typedef std::vector Coord3DVector; @@ -39,10 +40,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-nullptr. 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 f096807b8d..c1101296ed 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 abd5c0c403..44b0a8f518 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -297,7 +297,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 c2fd7e89da..778b05161e 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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-nullptr, 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 3b8347c9d1..01e02d09db 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 a4bdf6ce2b..b5d4c5456a 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 23cf4f94f8..86061898af 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() { 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 c8b0597bff..029df010c1 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 cc889280cd..4f1e9b9a83 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 a76f26cc52..89f36104be 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 c623b5aba3..f7ded4d174 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 3171df36bc..4986c880e5 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() { - 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 c5a34a6944..ff82a06d26 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 b98b2ba8d9..bd584b46a9 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 6f99fde5fd..247011075a 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 df1b6e5f67..54df02f52d 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 420142129b..6cc66370c4 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -429,17 +429,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 6a3886ea98..adb0faf584 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 c4002d3562..c684a9a48c 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 423977192c..2d6a76da36 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 nullptr 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 6ffc8b3060..49f3cc8e6a 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 edcaf28bea..6b5f8af440 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 a70c06b973..ad37bf5beb 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 549bcd5fac..e56dead9e5 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 8eeed38c7d..5d101b7d5a 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 0290d52b50..235d3efcd6 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 2e9e792cff..c39d7cf06a 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 8aea676986..8db256dc9e 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 fca16c556a..030749a542 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 4c3bb82e42..5021f09655 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 3394bee886..d1e223519e 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 nullptr, 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 c748c8ec30..922a4a9bdc 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 c4ed34504a..d49252ecdc 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 a5c9f2e21d..eb476ab589 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 c18289db5b..457d5ae6df 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 6555522a81..be732c89ed 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 4d2aea2d39..f79f4097d4 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 436feb28d7..58ccdb8408 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 84e64d9f04..f028aabe93 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 d50fc085f1..c8ad16ae63 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 92695de6c5..f8ac24964f 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 nullptr 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 nullptr 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 2d5d4bd399..fd1b97ba62 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 9e6712b508..5a78d581b8 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 3929983db0..c6d0d056b1 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 20533a7b50..ec82e7db40 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 5d1f6fb04a..fce140d069 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 e675e82a2c..076de50a23 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 5c666599d5..1467788d20 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 650166809a..20bc95c7a6 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 b8c78b631a..bccf952d2c 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 ed0491c3c7..d7863c4756 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 48c3f44b91..1ee56d8570 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 bbabac53f1..b0b2746216 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 7ff7780860..e938c79c08 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 9ec900ce0a..8889194668 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 7802e2bf50..555b3e315a 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 30bf8b44b4..da27b222bb 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 ce18cf4873..6f9920a51f 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 ed767becd8..2dd3b3b42e 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 9f972ea26a..8ec75e5519 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 5fa059cff7..28fe4d7842 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 180fc86aac..5cc5991422 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; } diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h index 8cb487b76e..0610fd3fb4 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 f937ba66b6..db21542f97 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 053d3108e6..09c4d70728 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 015813b9a7..3796711135 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 bd41d3c97f..228b36bd31 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 97c21634e5..765ebd01dd 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 2baf25279c..33789d1b3f 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 5c6cc19fe4..23f721ead5 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 d6eb4714fd..27a541ce34 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 c36d57bf36..6b695a324b 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 3d58a6ae6f..7536a9b7b0 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 537d0293ba..d9f83936a0 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 994a7e67de..dc17124452 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 8a37bc1e41..406b16ec68 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 ff8c94e972..55aa122157 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 319dc68a3f..f00fb7a082 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 543e001657..e7ca672ca0 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 daff695180..479b9db8e8 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 c3f75fc1e9..9b62fdb0f1 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 0bf5d1c2d7..c85cb59234 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 5540c678b5..5153d58331 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 2a77c29aeb..f49cf3e7f1 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 db778297fd..d415bd9dd8 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 4f27ad1a9a..42203c8a1a 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 748355ff15..f1a097b603 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 8622540f49..fa81a35213 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 bee145e9aa..7e619c43bb 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 fef438647a..290538a6d0 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 8669842463..739b170c08 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 01d4aed564..5672fdc6ac 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 ee44fd479d..5249b78d54 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 c494e4b1a5..6660616ace 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 6410014f21..135f48273f 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 6eab70e630..76ff049530 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 11b4471295..3d922c4264 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 5d1c16d07f..dde03c6025 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 9e8931794d..a0d1178628 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 e6d0d2d282..45ebe75b72 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-nullptr, 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 d39dd19c00..f34fb31966 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 6ef3f32d58..0e3fcd0184 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 010418a47c..0be8a668ed 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 nullptr")); } 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 39ef5273f2..8c122fd5d6 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 5473296795..40fc6b4f64 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 c849fb5fa8..ba0c5a783d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h @@ -28,6 +28,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once +#include class ScriptAction; class GameWindow; @@ -86,7 +87,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 fe237cbcee..0447dc2020 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 3b928470bd..e9b0556dc7 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. nullptr 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. nullptr 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 30aa1d34cf..c1f46c9d16 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 6b39c95758..eaffbc1bcf 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 707d5fffc1..604ea78318 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 cf149df174..d8f284d0e5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpyChat.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpyChat.h @@ -27,13 +27,14 @@ // Author: Matthew D. Campbell, February 2002 #pragma once +#include #include "gamespy/peer/peer.h" 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 8fb0da908e..9be1aa1401 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 19678a6744..3e98f50434 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 8975fa7d60..849d43ef37 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 0eba66efd0..67c75b7c90 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 3c183794f8..82f7819c3f 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 nullptr")); + DEBUG_ASSERTCRASH(TheGameText != nullptr, ("TheGameText is nullptr")); 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 nullptr 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 nullptr")); 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 4594265789..371926ead1 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 7c72fc4e1e..ed94ec7bf5 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 8da2880226..d449f597ac 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 nullptr, 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 nullptr")); // 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 edda2599bf..a02f0cf450 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 nullptr") ); 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 nullptr" )); 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 7300b1ebc7..fe994c3745 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 67b6216c7c..7d0c542596 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 a732029ae7..8c939923cb 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 00e6a6cabb..2e67cfae62 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 f7a4c80154..9c7fb4bd21 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 380c5e2548..ed7840d7bd 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 617f396363..fd0b84d518 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 ae6e2c9281..cff4840ca0 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 3ad8a5d3ee..2bcb705c19 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 99b5ec9ebf..719d1b9c88 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 d3894bf3ea..3ec7eddfcb 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 8efd3aef39..17908288d9 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 1acee2d16f..e4b3957497 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 7d3945c75e..d74f485686 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 d23ec32b56..30dccadc62 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 44894061da..7f700e779d 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 336cffbc83..50c75c8cc7 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 9041f653bd..d7060c5925 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 nullptr AcademyAdviceInfo.") ); return FALSE; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index ee93d3a076..7191e0eeeb 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 @@ -522,7 +522,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 ) @@ -597,7 +597,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())) @@ -814,7 +814,7 @@ Bool ActionManager::canConvertObjectToCarBomb( const Object *obj, const Object * { // sanity - if( obj == NULL || objectToConvert == NULL ) + if( obj == nullptr || objectToConvert == nullptr ) { return FALSE; } @@ -848,7 +848,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; } @@ -910,7 +910,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; } @@ -955,7 +955,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; } @@ -991,7 +991,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. @@ -1073,7 +1073,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(); @@ -1095,7 +1095,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) @@ -1178,7 +1178,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 @@ -1195,14 +1195,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 @@ -1219,7 +1219,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. @@ -1305,7 +1305,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. @@ -1388,7 +1388,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; } @@ -1936,7 +1936,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; } @@ -1955,7 +1955,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; } @@ -1994,7 +1994,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; } @@ -2028,7 +2028,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) @@ -2062,7 +2062,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 a0928add8f..702a300c88 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 ed1a177ad3..eaa8fe7522 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 ec98aa370d..fb2306800b 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 - nullptr 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 7b33095bc6..485588c5f9 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 ef8be636a6..81c5cf6b32 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 0e5bc0904e..49c560c2b1 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 8724a73f20..3db81c1a66 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 c2f75e58c2..0876e37cc6 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 41e6d5ceaa..b0efba7739 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 f059cfdef1..159404daab 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 701debf163..05fa45a392 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 nullptr 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 72ea6a2822..7c5c839a34 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 nullptr")); 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 a90b4903f7..cd415c0132 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 ) ) { 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 nullptr 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 nullptr 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 be7de3cd04..144391545b 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 nullptr 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 nullptr 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 4289f2b201..e253300153 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 b3e11d5f10..d594b02784 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 nullptr 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 5b7147d1e9..f6610198ff 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 6b30352242..aa3bdb5063 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 6f04f71e8d..977ecc1d78 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 643d3c0611..e1259282ec 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 3eccb5ef08..c269e5316f 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 69be9afe5b..7f8b4ff401 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 b4fbba3d5c..5cd0d41122 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 7e703a508a..faae743262 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 af7da9cc3f..25f632a498 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 b8add65553..2364631878 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 15782d5442..9efafb2ea2 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 b6a48d4737..184845ebef 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); @@ -194,14 +194,14 @@ stack_frame.AddrFrame.Offset = myebp; while (b_ret&&skip) { b_ret = DbgHelpLoader::stackWalk( IMAGE_FILE_MACHINE_I386, - process, - thread, - &stack_frame, - NULL, //&gsContext, - NULL, - DbgHelpLoader::symFunctionTableAccess, - DbgHelpLoader::symGetModuleBase, - NULL); + process, + thread, + &stack_frame, + nullptr, //&gsContext, + nullptr, + DbgHelpLoader::symFunctionTableAccess, + DbgHelpLoader::symGetModuleBase, + nullptr); skip--; } @@ -210,14 +210,14 @@ stack_frame.AddrFrame.Offset = myebp; { b_ret = DbgHelpLoader::stackWalk( IMAGE_FILE_MACHINE_I386, - process, - thread, - &stack_frame, - NULL, //&gsContext, - NULL, - DbgHelpLoader::symFunctionTableAccess, - DbgHelpLoader::symGetModuleBase, - NULL); + process, + thread, + &stack_frame, + nullptr, //&gsContext, + nullptr, + DbgHelpLoader::symFunctionTableAccess, + DbgHelpLoader::symGetModuleBase, + 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 1047f7970a..15df5a4084 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 8520c0a119..2684ece12f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/encrypt.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/encrypt.cpp @@ -26,6 +26,7 @@ // Ancient Westwood Online password encryption (obfuscation?) code // Author: Anonymous +#include #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine #include "Common/encrypt.h" @@ -78,7 +79,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 339423da85..df78c8ed78 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 43b5186f62..08ed9776d0 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 0607cddd1d..853fa60335 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 nullptr!") ); 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 nullptr!") ); 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 7d85052fd7..07ba266dc1 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 6fc61f7be9..50bd1d01e3 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 1aa09afad2..5c6fa77081 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(): nullptr '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); } @@ -259,7 +259,7 @@ const ThingTemplate *ThingFactory::findByTemplateID( UnsignedShort id ) return tmpl; } DEBUG_CRASH(("template %d not found",(Int)id)); - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -296,14 +296,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(); @@ -311,7 +311,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; } @@ -348,7 +348,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 70d8c1b2b9..0e447e5400 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())); } @@ -1255,12 +1255,12 @@ void ThingTemplate::resolveNames() // templates can be partially overridden by map.ini files. When this happens, strings // that have been parsed are looked up, cached, then cleared. The problem is if a string // gets cached, but not overridden, it will be clear the next time we call this function. - // so we will want to make sure we don't NULL out cached data if the string is empty. A + // so we will want to make sure we don't set to nullptr cached data if the string is empty. A // concrete example is overriding an object with prerequisites. We just override the portrait. // So the 1st time we call this function, we get the standard template data. During this first // call, the strings are looked up, cached, and cleared. Then we override the portrait in the // map.ini. The next time we call this function, we look up all the strings again. The prereq - // names didn't used to check for empty strings so they would NULL out all the previous prereqs + // names didn't used to check for empty strings so they would set to nullptr all the previous prereqs // the object had. So be sure to make sure all string lookups don't blindly lookup things -- check // if the string isNotEmpty first! @@ -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 7fefc7d5d1..1a77fdeee4 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 39876290cc..5c7ad7bcf6 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 417bcbd323..7b06108866 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 14c845436a..d3a1d8ed1a 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 1b75c62468..015b66c3e8 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 8d61a053e4..418b8144d9 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 6d8adb6b17..dcf6524b79 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 558cee48c1..22723e8d91 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 9f1f5f7eaf..40a3a56352 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 @@ -2660,11 +2660,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; @@ -2719,7 +2719,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; @@ -2738,7 +2738,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 @@ -2789,7 +2789,7 @@ void Drawable::drawIconUI( void ) //------------------------------------------------------------------------------------------------ DrawableIconInfo* Drawable::getIconInfo() { - if (m_iconInfo == NULL) + if (m_iconInfo == nullptr) m_iconInfo = newInstance(DrawableIconInfo); return m_iconInfo; } @@ -2811,8 +2811,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; @@ -3093,7 +3093,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 @@ -3223,7 +3223,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 @@ -3257,14 +3257,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) { // @@ -3312,7 +3312,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; @@ -3323,11 +3323,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) { // @@ -3392,7 +3392,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 ]) @@ -3626,7 +3626,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 ); @@ -3673,7 +3673,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 @@ -3681,7 +3681,7 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) { TheDisplayStringManager->freeDisplayString( m_constructDisplayString ); - m_constructDisplayString = NULL; + m_constructDisplayString = nullptr; } return; } @@ -3693,7 +3693,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 @@ -3773,7 +3773,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; @@ -3835,7 +3835,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 ) ) @@ -3955,7 +3955,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 nullptr")); return dm; } @@ -3981,7 +3981,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 nullptr")); return dm; } @@ -4007,7 +4007,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 nullptr")); return dm; } @@ -4166,7 +4166,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 nullptr")); m_physicsXform = new PhysicsXformInfo; *m_physicsXform = physicsXform; } @@ -4312,7 +4312,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( @@ -4337,7 +4337,7 @@ void Drawable::clearCaptionText( void ) { if (m_captionDisplayString) TheDisplayStringManager->freeDisplayString(m_captionDisplayString); - m_captionDisplayString = NULL; + m_captionDisplayString = nullptr; } //------------------------------------------------------------------------------------------------- @@ -4376,7 +4376,7 @@ const AudioEventInfo * Drawable::getBaseSoundAmbientInfo() const if ( baseAmbient ) return baseAmbient->getAudioEventInfo(); - return NULL; + return nullptr; } /** @@ -4427,13 +4427,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 ) { @@ -4452,11 +4452,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 @@ -4472,7 +4472,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; @@ -4486,7 +4486,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; @@ -4528,7 +4528,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; } } } @@ -4614,7 +4614,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; @@ -4759,7 +4759,7 @@ ClientUpdateModule* Drawable::findClientUpdateModule( NameKeyType key ) } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -4845,7 +4845,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()) @@ -4866,7 +4866,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 @@ -4923,7 +4923,7 @@ void Drawable::xfer( Xfer *xfer ) { TheAudio->killAudioEventImmediately( m_ambientSound->m_event.getPlayingHandle() ); deleteInstance(m_ambientSound); - m_ambientSound = NULL; + m_ambientSound = nullptr; } // drawable id @@ -4964,13 +4964,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 @@ -4979,13 +4979,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 @@ -5084,11 +5084,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 @@ -5213,7 +5213,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 @@ -5259,7 +5259,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() )); @@ -5319,7 +5319,7 @@ void Drawable::xfer( Xfer *xfer ) if ( version >= 7 ) { - Bool customized = ( m_customSoundAmbientInfo != NULL ); + Bool customized = ( m_customSoundAmbientInfo != nullptr ); xfer->xferBool( &customized ); if ( customized ) @@ -5342,7 +5342,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() ) ); @@ -5370,12 +5370,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( ... ) @@ -5407,7 +5407,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()); } @@ -5440,7 +5440,7 @@ const Locomotor* Drawable::getLocomotor() const return ai->getCurLocomotor(); } } - return NULL; + return nullptr; } //================================================================================================= @@ -5452,7 +5452,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 338b0cc82e..509f4436b0 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 31db3b8761..c03a9ec855 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 5549137d7c..e04a65bca4 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 167d48f52f..f853139d27 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 nullptr 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 d270e95daf..ffe9a6b097 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 c6f3972b40..b9cc646060 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: nullptr 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 nullptr, 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 9851cc03ff..4dc8596430 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 d76112978d..ec5e35ec55 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 = TheControlBar->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 nullptr", 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 dd1278d3bf..8a8e5f0778 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 4ba7345e65..903faa97a2 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 ea1211b34a..4f371e9179 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 bd7a154d68..bb6975721c 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 7fe4f4e843..73d6da2998 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 2eee2dd531..d3ef6a5c23 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 32b2752719..e8cc648bb6 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 d41a25c3d5..3bece0dc76 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 b85445884d..79ccbaf6d5 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 13c80807ea..3059593e10 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.getLength() > 0) { 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.getLength() > 0) { 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 223e4afae7..7ad378d37f 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 nullptr", 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 nullptr", 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 fef643087a..0e2b20d062 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 8d2659db83..11f971464b 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 da73cce360..115a315e46 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 ec5c383e37..a858dae4aa 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 feb813c857..9cc92034e2 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 fee4cf69ae..8648fb28a3 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 09336b1417..1f21323ade 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 25726ad39c..8782368c13 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 8a7ca7b216..5f1caed39d 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 nullptr, 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 3a0087ded9..3d83d0d91e 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 4e8d80624a..b2c3d41dd1 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 c0b7f7097c..a87aa0fb17 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 61a4e89ee7..f40010e506 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 c3c10fa3f6..2ae75b2f54 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 3286091c8e..287808684b 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 0c466741cc..5d2353454a 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 2541ecafb9..4e07dbfa95 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,35 @@ 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] = {nullptr,nullptr,nullptr,nullptr, +// nullptr,nullptr,nullptr,nullptr }; // -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 +685,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 +791,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 +1011,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 +1035,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 +1135,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -1236,7 +1230,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 359d9da101..84a8644361 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 5ff05f9ff1..b79272a6a6 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 23b5e9ea14..e006099b62 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 429d921a4f..067f60a824 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 bd85e8826f..7ed7b19464 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 nullptr!")); 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 16e2cc0311..f8f484e17d 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 d3b9be11bc..3789ca9337 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 76a55a69e9..e8ce0f003f 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 efbba30770..3400fd7a74 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 72389c9f9f..cc517e5b56 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 3dd610bcfd..555b1ac888 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 b4a6e905e1..ad95903768 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 7f4d4b990a..63bdf6a7b7 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 0d387b201c..e4d6d1076f 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 nullptr")); 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 058841715c..bd2ec5aaf8 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 d1edfbd099..3e16150c71 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 5f72983f75..a396dfccaa 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 d99f370cc3..be6f867f44 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,32 @@ 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] = {nullptr,nullptr,nullptr,nullptr, +// nullptr,nullptr,nullptr,nullptr }; // -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 +325,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 +516,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 +524,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 +574,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 +589,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 +659,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 +721,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 +736,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 +750,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 +759,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 +786,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 +799,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 +835,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 +847,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 +858,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 +1078,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 +1099,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 +1204,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 +1233,7 @@ static const char *gadgetsToHide[] = "StaticTextColor", "StaticTextTeam", "StaticTextFaction", - NULL + nullptr }; static const char *perPlayerGadgetsToHide[] = { @@ -1246,7 +1241,7 @@ static const char *perPlayerGadgetsToHide[] = "ComboBoxTeam", "ComboBoxColor", "ComboBoxPlayerTemplate", - NULL + nullptr }; //------------------------------------------------------------------------------------------------- @@ -1424,7 +1419,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 +1438,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 +1457,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 +1572,7 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -1655,11 +1650,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 +1793,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 +1806,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 +1832,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 +1947,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 42ad7642cb..32ea190a7c 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 166659a950..9b1add86d1 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 359cac5d11..861ebd1aa4 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 bb36b3501f..d57a392fee 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,45 @@ 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] = {nullptr,nullptr,nullptr,nullptr, +// nullptr,nullptr,nullptr,nullptr }; // -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 +260,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 +296,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 +343,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 +377,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 +385,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 +476,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 +493,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 +512,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 +929,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 +959,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 +1118,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 +1260,7 @@ void InitWOLGameGadgets( void ) if( buttonAccept[0] ) buttonAccept[0]->winEnable(TRUE); - if (buttonBack != NULL) + if (buttonBack != nullptr) { buttonBack->winEnable(TRUE); } @@ -1277,35 +1269,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 +1345,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 +1387,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 +1500,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 +1522,7 @@ static void shutdownComplete( WindowLayout *layout ) } */ - nextScreen = NULL; + nextScreen = nullptr; } @@ -1545,12 +1537,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 +1604,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 +1624,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 +1664,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) return; } - if (TheNAT != NULL) { + if (TheNAT != nullptr) { NATStateType NATState = TheNAT->update(); if (NATState == NATSTATE_DONE) { @@ -1690,7 +1682,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 +1720,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 +1738,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 +1820,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 +1879,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 +2135,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } else if (!stricmp(resp.command.c_str(), "NAT")) { - if (TheNAT != NULL) { + if (TheNAT != nullptr) { TheNAT->processGlobalMessage(-1, resp.commandOptions.c_str()); } } @@ -2187,7 +2179,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"))) { // 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 +2297,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 +2498,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 +2579,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg case GWM_DESTROY: { if (windowMap) - windowMap->winSetUserData(NULL); + windowMap->winSetUserData(nullptr); break; } @@ -2693,11 +2685,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 +2711,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 +2857,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 2e02bd2960..af3f8f4b1f 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 6ad99be4c4..25b694b6d0 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 9c8aa8db08..8a85485165 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 52955e817d..994e1dcf46 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 ea60f55856..76e1f49f75 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 7eb372eb8c..70e057bf6a 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 94b1113afa..e8df740905 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 5557eade74..4b27c20948 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"))) { // 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 f098089806..d0a854556f 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 998f9daee5..a63ca2aec6 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 2adcad2546..a37d576370 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 e4c715ab38..07796e9a5e 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 94e9f3e533..f5abf8391e 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 783f360723..f48ae81f0c 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 nullptr")); 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 48e53b5727..ffc8d60d7c 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 02eb8a7e38..db8362a61c 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 3843009576..3365f6817c 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 9913fa9633..4432cad079 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 1a1d2e2b0c..8d72462519 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 0319ca6828..e8f5f1115b 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 a5bf79259b..be6599b437 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 799f7d2776..983b9d4e94 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 49d7e6ee54..315c4bf373 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 d0fb42146a..67b0945a4e 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 197fdd05ec..620c6dc2a3 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 = 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( 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 @@ -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 nullptr + 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 = TheWindowManager->winCreate( NULL, statusFlags, 0, 0, 100, 100, NULL, NULL ); + window = TheWindowManager->winCreate( nullptr, statusFlags, 0, 0, 100, 100, nullptr, nullptr ); 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 = TheWindowManager->winCreate( window, statusFlags, 10, 10, 50, 50, nullptr, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 128, 128, 128, 255 ) ); window->winSetEnabledBorderColor( 0 , TheWindowManager->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 = TheWindowManager->gogoGadgetPushButton( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetPushButton( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetPushButton( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetCheckbox( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetCheckbox( NULL, + window = TheWindowManager->gogoGadgetCheckbox( nullptr, WIN_STATUS_ENABLED, 330, 150, 100, 30, - &instData, NULL, TRUE ); + &instData, nullptr, TRUE ); // make window to hold radio buttons - window = TheWindowManager->winCreate( NULL, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, - 200, 200, 250, 45, NULL ); + window = TheWindowManager->winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGABLE, + 200, 200, 250, 45, nullptr ); window->winSetInputFunc( testGrab ); window->winSetEnabledColor( 0, TheWindowManager->winMakeColor( 50, 50, 50, 200 ) ); window->winSetEnabledBorderColor( 0, TheWindowManager->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 = TheWindowManager->gogoGadgetListBox( NULL, + window = TheWindowManager->gogoGadgetListBox( nullptr, WIN_STATUS_ENABLED, 200, 250, 100, 100, &instData, - &listData, NULL, TRUE ); + &listData, nullptr, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", TheWindowManager->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 = TheWindowManager->gogoGadgetListBox( NULL, + window = TheWindowManager->gogoGadgetListBox( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 75, 250, 100, 100, &instData, - &listData, NULL, TRUE ); + &listData, nullptr, TRUE ); GadgetListBoxAddEntryText( window, L"Listbox text", TheWindowManager->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 = TheWindowManager->gogoGadgetSlider( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetSlider( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetSlider( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetSlider( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetProgressBar( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetProgressBar( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetStaticText( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetStaticText( NULL, + window = TheWindowManager->gogoGadgetStaticText( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, 200, 520, 300, 25, &instData, - &textData, NULL, TRUE ); + &textData, nullptr, TRUE ); window->winSetEnabledTextColors( TheWindowManager->winMakeColor( 128, 128, 255, 255 ), TheWindowManager->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 = TheWindowManager->gogoGadgetTextEntry( NULL, + window = TheWindowManager->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 = TheWindowManager->gogoGadgetTextEntry( NULL, + window = TheWindowManager->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 f5e2871c92..a8925d52d6 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 ) ) { - 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") ) { - 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" ) ) drawData->image = TheMappedImageCollection->findImageByName( 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 684b10dff8..19458e64a6 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 dfedf3d095..2f749338f9 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 4b873a3a77..d1afe4a1d7 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 ccc22ea9f7..ca6e279847 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 ef054982de..ffb718029d 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 7cc73e923f..6c7319c275 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 nullptr... 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 nullptr 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 319c5cc475..a8a3b31cde 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 nullptr!") ); + 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 276f0f5e0d..0f15079539 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 393296d7ba..7e2473a872 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 e0b08d321f..e4e00c1f9a 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 nullptr before adding") ); + DEBUG_ASSERTCRASH( window->winGetPrevInLayout() == nullptr, + ("PrevInLayout should be nullptr 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 0c49c2a141..2a7f489c68 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 7492768036..44efa1f78d 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 17c88e9480..2683c02d7f 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 76aff3d7c5..15e9854571 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 de61454f1d..ab951812a3 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-nullptr 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 nullptr */ //------------------------------------------------------------------------------------------------- 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 message = 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 message = 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 5a642bdff8..33e400371d 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 ) { @@ -777,7 +777,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 db0e9c745f..ab5892674d 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) }, }; @@ -461,7 +461,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 ) ); @@ -513,7 +513,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; @@ -548,11 +548,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; } @@ -561,7 +561,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 ); } //------------------------------------------------------------------------------------------------- @@ -612,7 +612,7 @@ void Mouse::onResolutionChanged( void ) { if(m_tooltipDisplayString) TheDisplayStringManager->freeDisplayString(m_tooltipDisplayString); - m_tooltipDisplayString = NULL; + m_tooltipDisplayString = nullptr; m_tooltipDisplayString = TheDisplayStringManager->newDisplayString(); @@ -694,10 +694,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 @@ -738,7 +738,7 @@ void Mouse::createStreamMessages( void ) m_stillTime = now; // button messages - msg = NULL; + msg = nullptr; switch( m_currMouse.leftEvent ) { @@ -772,7 +772,7 @@ void Mouse::createStreamMessages( void ) } - msg = NULL; + msg = nullptr; switch( m_currMouse.middleEvent ) { @@ -807,7 +807,7 @@ void Mouse::createStreamMessages( void ) } - msg = NULL; + msg = nullptr; switch( m_currMouse.rightEvent ) { @@ -843,7 +843,7 @@ void Mouse::createStreamMessages( void ) } // wheel pos - msg = NULL; + msg = nullptr; if( m_currMouse.wheelPos != 0 ) { msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_MOUSE_WHEEL ); @@ -942,7 +942,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 @@ -1068,7 +1068,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 nullptr")); const Bool inInteractiveGame = TheGameLogic && TheGameLogic->isInInteractiveGame(); if (TheDisplay->getWindowed()) @@ -1229,7 +1229,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 @@ -1343,7 +1343,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 ]; @@ -1356,7 +1356,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 6185748421..93c2513baa 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 610ef69963..227695aa47 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 c4056a6c92..b518251973 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 nullptr, 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 + // nullptr 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(); @@ -4647,7 +4647,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()) @@ -4661,13 +4661,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); @@ -4978,7 +4978,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGlobalData->m_showMetrics) { TheDisplay->setDebugDisplayCallback(StatMetricsDisplay); } else { - TheDisplay->setDebugDisplayCallback(NULL); + TheDisplay->setDebugDisplayCallback(nullptr); } break; } @@ -5125,7 +5125,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { line = "Objects are:"; TheScriptEngine->AppendDebugMessage(line, FALSE); - pPlayer->iterateObjects( printObjects, NULL ); + pPlayer->iterateObjects( printObjects, nullptr ); } } disp = DESTROY_MESSAGE; @@ -5136,7 +5136,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEBUG_TOGGLE_NETWORK: { - if (TheNetwork != NULL) { + if (TheNetwork != nullptr) { TheNetwork->toggleNetworkOn(); } disp = DESTROY_MESSAGE; @@ -5148,7 +5148,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; @@ -5275,7 +5275,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage { if (TheGameLogic->isInGame()) { - if(TheInGameUI->cameoVideoBuffer() == NULL) + if(TheInGameUI->cameoVideoBuffer() == nullptr) TheInGameUI->playCameoMovie("CameoMovie"); else TheInGameUI->stopCameoMovie(); @@ -5410,7 +5410,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; @@ -5545,7 +5545,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 2479b0d89e..b97895d35a 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 9e8ffd3a1c..651512e443 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 8d900a3636..ac2bdb63b3 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 ) @@ -666,12 +666,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) @@ -683,7 +683,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 @@ -696,10 +696,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 aeaf2287b4..1f091ccb72 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 } }; @@ -654,7 +654,7 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa //------------------------------------------------------------------------------------------------- MetaMap::MetaMap() : - m_metaMaps(NULL) + m_metaMaps(nullptr) { } @@ -716,7 +716,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 97f9b76ce9..20915ad5c9 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 nullptr")); // 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 d4eb297771..2c2e39d2bf 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 29d30e2873..9a4b5ac02b 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 0bc882eae4..7f9662354c 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-nullptr 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 e2f1a26cee..cfb37555f6 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 cabff15a15..47c85d7be4 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 nullptr 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 - nullptr 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 nullptr") ); // 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 c04aadbe0e..f9b2863a2c 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 a701c03790..3d9511ed6b 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 d847d9df59..1bc9985e5a 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 nullptr. 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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-nullptr, 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 nullptr!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("INIT: ParticleSystem all particles tail[%d] is not nullptr!", 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 nullptr!", i) ); + DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("RESET: ParticleSystem all particles tail[%d] is not nullptr!", 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 fb2a11ab69..8216c25ea5 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 5cf8868c99..eeb1800a4a 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 nullptr 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 1ac91b201c..de2b3f7667 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 e09a4f24a7..2f50b6ebbe 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 bf9f8b5934..66eb0abe71 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 c66bc9cfd1..6f8ce410e5 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 nullptr 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 nullptr 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 nullptr 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("*nullptr 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 nullptr 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 bc2eb2aed1..f72b7fe76a 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==0, ("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 74ed1cf47e..06210ec9f8 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 nullptr 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 nullptr, 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 nullptr, 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 nullptr 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 26db83cda7..018acdb1e2 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 63b3474662..21e60b2dcb 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 nullptr 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 nullptr 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(); @@ -2725,7 +2725,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) { @@ -2789,7 +2789,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 @@ -2844,7 +2844,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; } @@ -3020,7 +3020,7 @@ StateReturnType AIAttackPursueTargetState::updateInternal() if (getMachine()->isGoalObjectDestroyed()) { ai->notifyVictimIsDead(); - ai->setCurrentVictim(NULL); + ai->setCurrentVictim(nullptr); return STATE_FAILURE; } m_stopIfInRange = false; @@ -3250,7 +3250,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 @@ -3358,7 +3358,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; @@ -3558,7 +3558,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("*nullptr m_deployMachine"); return name; } #endif @@ -3631,7 +3631,7 @@ StateReturnType AIAttackMoveToState::update() Object* nextObjectToAttack; nextObjectToAttack = ai->getNextMoodTarget( !forceRetargetThisFrame, false ); - if (nextObjectToAttack != NULL) + if (nextObjectToAttack != nullptr) { ai->friend_endingMove(); m_attackMoveMachine->setGoalObject(nextObjectToAttack); @@ -3784,7 +3784,7 @@ const Waypoint * AIFollowWaypointPathState::getNextWaypoint(void) #else if (!hasNextWaypoint()) { m_priorWaypoint = m_currentWaypoint; - return NULL; + return nullptr; } Int skip = -1; Int i; @@ -3818,7 +3818,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) { @@ -3857,7 +3857,7 @@ Real AIFollowWaypointPathState::calcExtraPathDistance(void) //---------------------------------------------------------------------------------------------------------- void AIFollowWaypointPathState::computeGoal(Bool useGroupOffsets) { - if (m_currentWaypoint == NULL) + if (m_currentWaypoint == nullptr) return; Object *obj = getMachineOwner(); @@ -4006,11 +4006,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()); @@ -4052,7 +4052,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 @@ -4134,7 +4134,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); @@ -4205,7 +4205,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; @@ -4291,7 +4291,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()); @@ -4419,7 +4419,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("*nullptr m_attackFollowMachine"); return name; } #endif @@ -4476,7 +4476,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 ); @@ -4554,8 +4554,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(); @@ -4598,7 +4598,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); @@ -4788,7 +4788,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(); @@ -4839,7 +4839,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); @@ -4911,7 +4911,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; @@ -4928,7 +4928,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 @@ -5082,7 +5082,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) @@ -5163,7 +5163,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(); @@ -5177,7 +5177,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); } } @@ -5266,7 +5266,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 @@ -5277,7 +5277,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) @@ -5359,13 +5359,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 @@ -5381,7 +5381,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) @@ -5408,12 +5408,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 ); } @@ -5439,7 +5439,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 @@ -5449,7 +5449,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("*nullptr m_attackMachine"); return name; } #endif @@ -5531,7 +5531,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! @@ -5561,7 +5561,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 ) @@ -5599,7 +5599,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 @@ -5621,15 +5621,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; @@ -5643,9 +5643,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; @@ -5672,11 +5672,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; /** @@ -5696,12 +5696,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, @@ -5716,10 +5716,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); } } @@ -5774,7 +5774,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 ); } @@ -5814,11 +5814,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" ); } @@ -5842,7 +5842,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("*nullptr m_attackSquadMachine"); return name; } #endif @@ -5917,7 +5917,7 @@ void AIAttackSquadState::onExit( StateExitType status ) { // destroy the attack machine deleteInstance(m_attackSquadMachine); - m_attackSquadMachine = NULL; + m_attackSquadMachine = nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -5926,7 +5926,7 @@ Object *AIAttackSquadState::chooseVictim(void) Squad *victimSquad = ((AIStateMachine*)getMachine())->getGoalSquad(); if (!victimSquad) { - return NULL; + return nullptr; } Object *owner = getMachineOwner(); @@ -5937,20 +5937,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); @@ -5980,7 +5980,7 @@ Object *AIAttackSquadState::chooseVictim(void) Int numUnits = objects.size(); if (numUnits == 0) { - return NULL; + return nullptr; } Int unitToAttack = GameLogicRandomValue(0, numUnits - 1); @@ -5994,9 +5994,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; } @@ -6010,12 +6010,12 @@ Object *AIAttackSquadState::chooseVictim(void) return objects[0]; } - return NULL; + return nullptr; break; } }; - return NULL; + return nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -6048,11 +6048,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()); } @@ -6076,7 +6076,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("*nullptr m_dockMachine"); return name; } #endif @@ -6091,17 +6091,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; } @@ -6132,7 +6132,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")); } @@ -6142,7 +6142,7 @@ void AIDockState::onExit( StateExitType status ) if (ai) { ai->setCanPathThroughUnits(false); - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); } } @@ -6261,7 +6261,7 @@ void AIEnterState::onExit( StateExitType status ) if (ai) { - ai->ignoreObstacle( NULL ); + ai->ignoreObstacle( nullptr ); if (ai->getCurLocomotor()) { ai->getCurLocomotor()->setAllowInvalidPosition(false); @@ -6298,7 +6298,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; } @@ -6458,8 +6458,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() ) @@ -6553,8 +6553,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 ); @@ -6619,7 +6619,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("*nullptr guardMachine"); return name; } #endif @@ -6640,11 +6640,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()); } @@ -6718,7 +6718,7 @@ StateReturnType AIGuardState::onEnter() void AIGuardState::onExit( StateExitType status ) { deleteInstance(m_guardMachine); - m_guardMachine = NULL; + m_guardMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -6729,7 +6729,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. } @@ -6775,7 +6775,7 @@ AsciiString AIGuardRetaliateState::getName( ) const } else { - name.concat("*NULL guardRetaliateMachine"); + name.concat("*nullptr guardRetaliateMachine"); } return name; } @@ -6797,11 +6797,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()); @@ -6865,7 +6865,7 @@ StateReturnType AIGuardRetaliateState::onEnter() void AIGuardRetaliateState::onExit( StateExitType status ) { deleteInstance(m_guardRetaliateMachine); - m_guardRetaliateMachine = NULL; + m_guardRetaliateMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -6876,7 +6876,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. } @@ -6915,7 +6915,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("*nullptr guardMachine"); return name; } #endif @@ -6936,11 +6936,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()); } @@ -6996,7 +6996,7 @@ StateReturnType AITunnelNetworkGuardState::onEnter() void AITunnelNetworkGuardState::onExit( StateExitType status ) { deleteInstance(m_guardMachine); - m_guardMachine = NULL; + m_guardMachine = nullptr; Object *obj = getMachineOwner(); obj->getAI()->clearGuardTargetType(); @@ -7007,7 +7007,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. } @@ -7062,11 +7062,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"); } @@ -7120,7 +7120,7 @@ void AIHuntState::onExit( StateExitType status ) { // destroy the hunt machine deleteInstance(m_huntMachine); - m_huntMachine = NULL; + m_huntMachine = nullptr; Object *obj = getMachineOwner(); if (obj) @@ -7136,7 +7136,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("*nullptr huntMachine"); return name; } #endif @@ -7168,17 +7168,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; } @@ -7186,15 +7186,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; } @@ -7220,7 +7220,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. } } @@ -7269,11 +7269,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"); } @@ -7298,7 +7298,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("*nullptr m_attackMachine"); return name; } #endif @@ -7324,7 +7324,7 @@ void AIAttackAreaState::onExit( StateExitType status ) { // destroy the hunt machine deleteInstance(m_attackMachine); - m_attackMachine = NULL; + m_attackMachine = nullptr; } //---------------------------------------------------------------------------------------------------------- @@ -7348,10 +7348,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()); @@ -7363,7 +7363,7 @@ StateReturnType AIAttackAreaState::update() { m_attackMachine->setState( AI_ATTACK_OBJECT ); } - if (victim==NULL) { + if (victim==nullptr) { return STATE_SUCCESS; } } @@ -7424,7 +7424,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 070292cd65..53924787d4 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 291e622e71..79f6227d76 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 nullptr 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 073f5b4fd0..2d3c9cf465 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 nullptr.")); return STATE_FAILURE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/PolygonTrigger.cpp index 6059e774ea..5ae459da41 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 4824fa87b9..f6bfe7f90f 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 nullptr 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 6af3e05b1b..6e51abdfaf 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 nullptr 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 nullptr") ); // 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 6d4578d197..7cdc1d5ec2 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 35fd1c79f9..948120ac01 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 40e24c023f..14d6fbfd88 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 464e4f11b5..0d547fb842 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 aa3be3bdb9..f5988cfe25 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 ecdb0c41a8..d26f686b92 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 bfed83b3a9..3e6f1ce07a 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 53127c7271..01aa02cbc2 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 f53b524ee0..2753844751 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 3e910e6bef..f6f12b8569 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 673cdc7441..1ff88b7c19 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 731fb65b48..c0e9bf294a 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 0ca3590bec..54a40ee733 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 348c4ea325..b63b549a04 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 eddd748b5a..01a3d3aed1 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 f2abac47bb..a87d222b7a 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 048a90e69d..035b582e60 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 742fb6066c..05c05ab873 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 dc9402efb0..93a7a843bd 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 ed1cfc4137..5f83498228 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 3c32fe58a7..0e36811dcc 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 47b95ce8dd..1e305e9568 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 a2f1f509df..4bb892116f 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 0283d17197..0b0672aa9d 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 13ea128aa9..6cfac09bad 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 47832bfadc..6fe6ad02da 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 81ca57e86e..940a788aae 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 78b096c495..09dcb1b959 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 6f98771bbd..32a8f19856 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 6ea3f866f7..9125ed86e8 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 434d142053..85b4f4a358 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 cd5d795ef8..94326258df 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 44da72449d..2d8f4a3ffe 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 6e4cbf8d39..e81c884b83 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 047cc1d6d8..b819734f6a 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 bed736f817..d505d8c04c 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 0c35d459a9..efe0f78e80 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 0280700e07..4ed22b276d 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 e66b5eaf70..0914f3af70 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 cca17ecd0c..1dd7cfdec7 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 cebefa404a..b10b2437f2 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 6ad5180f88..7dc1f72d38 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 84f1f50988..115b18caa1 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 4e1e5f6a18..4e1e5eb47e 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 b6eca3e85e..90b2c6b756 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 2f2bbea878..5319d58cdd 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 )); @@ -288,7 +288,7 @@ void OpenContain::addToContain( Object *rider ) } // sanity - if( rider == NULL ) + if( rider == nullptr ) return; Drawable *riderDraw = rider->getDrawable(); @@ -311,12 +311,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():"nullptr", 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'", @@ -385,7 +385,7 @@ void OpenContain::removeFromContain( Object *rider, Bool exposeStealthUnits ) { // sanity - if( rider == NULL ) + if( rider == nullptr ) return; // @@ -453,7 +453,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 nullptr element")); if ( rider ) { onRemoving( rider ); @@ -475,7 +475,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 nullptr element")); if ( rider ) { removeFromContain( rider, true ); @@ -589,7 +589,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) @@ -786,7 +786,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. @@ -794,7 +794,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. @@ -982,8 +982,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(); @@ -1019,7 +1019,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); @@ -1101,8 +1101,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(); @@ -1124,7 +1124,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); @@ -1161,7 +1161,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. @@ -1239,7 +1239,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 @@ -1277,7 +1277,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 { @@ -1310,7 +1310,7 @@ void OpenContain::putObjAtNextFirePoint( Object *obj ) */ void OpenContain::onObjectWantsToEnterOrExit(Object* obj, ObjectEnterExitType wants) { - if (obj == NULL) + if (obj == nullptr) return; ObjectID id = obj->getID(); @@ -1333,7 +1333,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; @@ -1513,7 +1513,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 nullptr element") ); // Calculate the damage to be inflicted on each unit. Real damage = object->getBodyModule()->getMaxHealth() * percentDamage; @@ -1592,7 +1592,7 @@ const Coord3D *OpenContain::getRallyPoint( void ) const if (m_rallyPointExists) return &m_rallyPoint; - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -1606,7 +1606,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 { @@ -1870,7 +1870,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 ce039ed6f8..b099f2b884 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 f7dbe00973..f7aa9b345e 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 aca71d6d8b..3236397d09 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 ed9babbea3..efd442f380 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); } @@ -293,7 +293,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. @@ -434,7 +434,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 e024d449da..b4cf8b7b98 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 1f998a53ff..087967139b 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 nullptr 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 nullptr 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 2c4e347f27..9c566821e6 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 391f07d0b2..a64431636d 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 6100a0824d..9e53fced13 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 bfcb644e3e..f482cfa7ac 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 9ebe075356..bf0d13f57a 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 f6da3866e1..378ccba8f0 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 62082147f2..517ff6abf7 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 nullptr") ); 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 de3a54c8c2..a915a89e15 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 19db01c59b..a7c67f237f 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 2bb5cf33b0..e6eb157529 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 adbd99e57f..7ac20be642 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 0e74237067..5b993f4502 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 819d7451d3..7649ade54f 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 61969926d6..361c1b9b27 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 7c8dd524d6..d9bc1b5f92 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 9b2a9bba46..90d9494945 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 598e266bea..50fbb04d84 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 nullptr 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(("nullptr 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; } //============================================================================= @@ -1890,7 +1890,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 ); @@ -1989,7 +1989,7 @@ void Object::kill( DamageType damageType, DeathType deathType ) //------------------------------------------------------------------------------------------------- void Object::healCompletely() { - attemptHealing(HUGE_DAMAGE_AMOUNT, NULL); + attemptHealing(HUGE_DAMAGE_AMOUNT, nullptr); } //------------------------------------------------------------------------------------------------- @@ -2456,7 +2456,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(); @@ -2575,17 +2575,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 ) @@ -2728,7 +2728,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; @@ -2809,8 +2809,8 @@ void Object::removeFromList(Object **pListHead) else *pListHead = m_next; - m_prev = NULL; - m_next = NULL; + m_prev = nullptr; + m_next = nullptr; } //------------------------------------------------------------------------------------------------- @@ -2887,14 +2887,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; } @@ -3198,7 +3198,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; @@ -3310,7 +3310,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" @@ -3647,7 +3647,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 ) @@ -3661,8 +3661,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; @@ -3676,17 +3676,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 nullptr" ) ); + if ( baseInfo != nullptr ) { audioToModify = newInstance( DynamicAudioEventInfo )( *baseInfo ); } } - if ( audioToModify != NULL ) + if ( audioToModify != nullptr ) { valBool = properties->getBool( TheKey_objectSoundAmbientLooping, &exists ); if ( exists ) @@ -3746,7 +3746,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. @@ -3755,7 +3755,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. @@ -3770,7 +3770,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 ); @@ -3779,11 +3779,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 ) { @@ -3825,7 +3825,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. @@ -4119,7 +4119,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; @@ -4204,7 +4204,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; @@ -4327,7 +4327,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) { @@ -4347,7 +4347,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 @@ -4389,7 +4389,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; @@ -4439,7 +4439,7 @@ void Object::loadPostProcess() if( m_xferContainedByID != INVALID_ID ) m_containedBy = TheGameLogic->findObjectByID(m_xferContainedByID); else - m_containedBy = NULL; + m_containedBy = nullptr; } @@ -4565,7 +4565,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")); @@ -4624,7 +4624,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() ); @@ -4780,10 +4780,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; } //------------------------------------------------------------------------------------------------- @@ -4953,7 +4953,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 @@ -5317,8 +5317,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 ) @@ -5331,7 +5331,7 @@ SpecialPowerModuleInterface *Object::getSpecialPowerModule( const SpecialPowerTe return sp; } - return NULL; + return nullptr; } @@ -5476,7 +5476,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 ) { @@ -5485,7 +5485,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 ); @@ -5859,7 +5859,7 @@ ProductionUpdateInterface* Object::getProductionUpdateInterface( void ) } - return NULL; + return nullptr; } @@ -5867,15 +5867,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; } @@ -5896,7 +5896,7 @@ SpecialPowerModuleInterface* Object::findSpecialPowerModuleInterface( SpecialPow return sp; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5916,7 +5916,7 @@ SpecialPowerModuleInterface* Object::findAnyShortcutSpecialPowerModuleInterface( return sp; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5932,7 +5932,7 @@ SpawnBehaviorInterface* Object::getSpawnBehaviorInterface() const return sbi; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5946,7 +5946,7 @@ ProjectileUpdateInterface* Object::getProjectileUpdateInterface() const return pui; } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5965,7 +5965,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestinationA } } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -5984,7 +5984,7 @@ SpecialPowerUpdateInterface* Object::findSpecialPowerWithOverridableDestination( } } } - return NULL; + return nullptr; } @@ -6006,7 +6006,7 @@ SpecialAbilityUpdate* Object::findSpecialAbilityUpdate( SpecialPowerType type ) } } - return NULL; + return nullptr; } // ------------------------------------------------------------------------------------------------ @@ -6047,17 +6047,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 @@ -6079,7 +6079,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; @@ -6107,7 +6107,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; } @@ -6345,9 +6345,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 ); } } @@ -6382,7 +6382,7 @@ CountermeasuresBehaviorInterface* Object::getCountermeasuresBehaviorInterface() return cbi; } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------- @@ -6396,7 +6396,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 215763f9c5..a61e871853 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 e92ad16f32..20935c72cd 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 = ThePartitionManager->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 d31cb753e9..1e2156204b 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 999841efe8..66a4e46383 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 c0a9ba4bca..4ef023055a 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 1e5b9b75d9..f7cf07584d 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 5183b4e100..17817785d1 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 55f414cbf8..5aa0ccd886 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 7d3d18fb89..23987639e2 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 523f1e8955..0f2d731c3f 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 175a99b57d..59d2773bbb 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 a90ac83b69..39da76e94e 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 5ab7d48127..b36aec53c5 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 a9891985b9..bcf310cbd7 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 bfc97640c3..c08e81e72e 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 nullptr")); 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 nullptr */ 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()) { @@ -3097,7 +3097,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); } @@ -3159,7 +3159,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 ); @@ -3230,18 +3230,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); } @@ -3362,14 +3362,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 ); } } @@ -3511,7 +3511,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 @@ -3524,7 +3524,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 ) ); @@ -3562,9 +3562,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(); @@ -4192,14 +4192,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) @@ -4228,7 +4228,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. @@ -4242,7 +4242,7 @@ const Coord3D *AIUpdateInterface::getCurrentVictimPos( void ) const } } - return NULL; + return nullptr; } @@ -4296,7 +4296,7 @@ Object* AIUpdateInterface::getEnterTarget() if( stateType != AI_ENTER && stateType != AI_GUARD_TUNNEL_NETWORK && stateType != AI_GET_REPAIRED ) - return NULL; + return nullptr; return getStateMachine()->getGoalObject(); } @@ -4354,7 +4354,7 @@ UnsignedInt AIUpdateInterface::getMoodMatrixValue( void ) const } else { - if (m_turretAI[0] != NULL) + if (m_turretAI[0] != nullptr) { returnVal |= MM_UnitType_Turreted; } @@ -4498,10 +4498,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(); @@ -4510,14 +4510,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 @@ -4533,7 +4533,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; } } } @@ -4542,7 +4542,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(); @@ -4551,7 +4551,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] } } @@ -4565,7 +4565,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; @@ -4581,7 +4581,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 @@ -4597,7 +4597,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!!! @@ -4651,7 +4651,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 )); @@ -4680,7 +4680,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 ); } @@ -4696,7 +4696,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 ); } @@ -5121,7 +5121,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) { @@ -5200,7 +5200,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 32ec0f80af..a2993b1ea8 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 87f5b42d9d..1e394e12ea 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) { ExitInterface *exitInterface = obj->getObjectExitInterface(); ExitDoorType exitDoor = exitInterface ? exitInterface->reserveDoorForExit(rappeller->getTemplate(), rappeller) : DOOR_NONE_AVAILABLE; @@ -601,7 +601,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); @@ -620,7 +620,7 @@ class ChinookCombatDropState : public State } } - if (numRopesInUse == 0 && getPotentialRappeller(obj) == NULL) + if (numRopesInUse == 0 && getPotentialRappeller(obj) == nullptr) { // we're done! return STATE_SUCCESS; @@ -647,8 +647,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); } @@ -665,7 +665,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 } } @@ -725,7 +725,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; @@ -896,24 +896,24 @@ ChinookAIUpdateModuleData::ChinookAIUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "RappelSpeed", INI::parseVelocityReal, 0, offsetof(ChinookAIUpdateModuleData, m_rappelSpeed) }, - { "RopeDropSpeed", INI::parseVelocityReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeDropSpeed) }, - { "RopeName", INI::parseAsciiString, 0, offsetof(ChinookAIUpdateModuleData, m_ropeName) }, - { "RopeFinalHeight", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeFinalHeight) }, - { "RopeWidth", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeWidth) }, - { "RopeWobbleLen", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleLen) }, - { "RopeWobbleAmplitude", INI::parseReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleAmp) }, - { "RopeWobbleRate", INI::parseAngularVelocityReal, 0, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleRate) }, - { "RopeColor", INI::parseRGBColor, 0, offsetof(ChinookAIUpdateModuleData, m_ropeColor) }, - { "NumRopes", INI::parseUnsignedInt, 0, offsetof(ChinookAIUpdateModuleData, m_numRopes) }, - { "PerRopeDelayMin", INI::parseDurationUnsignedInt, 0, offsetof(ChinookAIUpdateModuleData, m_perRopeDelayMin) }, - { "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) }, - - { 0, 0, 0, 0 } + { "RappelSpeed", INI::parseVelocityReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_rappelSpeed) }, + { "RopeDropSpeed", INI::parseVelocityReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeDropSpeed) }, + { "RopeName", INI::parseAsciiString, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeName) }, + { "RopeFinalHeight", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeFinalHeight) }, + { "RopeWidth", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeWidth) }, + { "RopeWobbleLen", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleLen) }, + { "RopeWobbleAmplitude", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleAmp) }, + { "RopeWobbleRate", INI::parseAngularVelocityReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeWobbleRate) }, + { "RopeColor", INI::parseRGBColor, nullptr, offsetof(ChinookAIUpdateModuleData, m_ropeColor) }, + { "NumRopes", INI::parseUnsignedInt, nullptr, offsetof(ChinookAIUpdateModuleData, m_numRopes) }, + { "PerRopeDelayMin", INI::parseDurationUnsignedInt, nullptr, offsetof(ChinookAIUpdateModuleData, m_perRopeDelayMin) }, + { "PerRopeDelayMax", INI::parseDurationUnsignedInt, nullptr, offsetof(ChinookAIUpdateModuleData, m_perRopeDelayMax) }, + { "MinDropHeight", INI::parseReal, nullptr, offsetof(ChinookAIUpdateModuleData, m_minDropHeight) }, + { "WaitForRopesToDrop", INI::parseBool, nullptr, offsetof(ChinookAIUpdateModuleData, m_waitForRopesToDrop) }, + { "RotorWashParticleSystem", INI::parseAsciiString, nullptr, offsetof( ChinookAIUpdateModuleData, m_rotorWashParticleSystem ) }, + { "UpgradedSupplyBoost", INI::parseInt, nullptr, offsetof( ChinookAIUpdateModuleData, m_upgradedSupplyBoost) }, + + { nullptr, nullptr, nullptr, 0 } }; p.add(dataFieldParse); } @@ -947,13 +947,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; } @@ -967,7 +967,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); } @@ -1064,7 +1064,7 @@ Bool ChinookAIUpdate::chooseLocomotorSet(LocomotorSetType wst) UpdateSleepTime ChinookAIUpdate::update() { ParkingPlaceBehaviorInterface* pp = getPP(m_airfieldForHealing); - if (pp != NULL) + if (pp != nullptr) { if (m_flightStatus == CHINOOK_LANDED && !m_hasPendingCommand && @@ -1072,7 +1072,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 { @@ -1103,11 +1103,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); } } @@ -1133,7 +1133,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 ); } @@ -1219,7 +1219,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); } @@ -1231,12 +1231,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 @@ -1298,7 +1298,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 @@ -1306,7 +1306,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; } } @@ -1321,7 +1321,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; } } @@ -1335,7 +1335,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; } } @@ -1408,7 +1408,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 ) @@ -1435,7 +1435,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) @@ -1492,7 +1492,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(); @@ -1524,7 +1524,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) @@ -1601,7 +1601,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 f69f7004ad..b3424e0a46 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 e901fd9df8..cd1b842539 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 @@ -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/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp index b395edd50e..76b18d9035 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 4e3b24a426..f45913b8b2 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 385fadf28e..ba1a7899b7 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 2939167495..66c04776dd 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: nullptr 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 46de82863b..86951f5455 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 4551ebea2e..04a21d7cc3 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 0abfd3b127..ce7a8cc5af 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 849d663098..047072d58e 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 f36a83f720..0c31f82710 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(); @@ -332,8 +332,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, @@ -352,8 +352,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 @@ -361,7 +361,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, @@ -369,8 +369,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; } @@ -472,7 +472,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 @@ -493,14 +493,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" )); @@ -583,7 +583,7 @@ void WorkerAIUpdate::privateResumeConstruction( Object *obj, CommandSourceType c { // sanity - if( obj == NULL ) + if( obj == nullptr ) return; // make sure we can resume construction on this @@ -605,7 +605,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. @@ -627,7 +627,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 // @@ -814,7 +814,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); // } @@ -825,7 +825,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 ); @@ -885,7 +885,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); } @@ -922,18 +922,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; } @@ -1166,14 +1166,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. @@ -1250,7 +1250,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(); } @@ -1322,18 +1322,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 @@ -1348,18 +1348,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 0c91b46ac6..04c527d390 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 aacb8a3e7b..e75087bd79 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 ba7a465044..3e071a6619 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 2cf23405c6..c5f4681010 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 d2bd3ef3d1..efbb3e358b 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 0d04efe610..ccd456c370 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 82633a3892..14e0923eab 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 3ed8abdbdc..3b8eea2e89 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 e4d7dfb820..92645e696c 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 78e61ac97d..647bf40302 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 3ec47ffad9..5fdfc5b7fd 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 4fc9e293c6..ec124c5ca0 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 62f452f498..97b295c3f2 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 407b32a0dc..4423054e16 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 364da3d25d..24c91d1b99 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 4f7892ae6c..f3ea999c78 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 b7934fe544..11a12f92e5 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 8023998b8f..f45163b0d0 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 nullptr" ) ); 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 nullptr" ) ); 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 nullptr" ) ); 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 nullptr" ) ); 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 b752365d73..46a98979fa 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 c2d48595ea..35f9565bd7 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 e28c8238cd..86c81b0755 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 539288e56d..d9bc8fb3b5 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 3ea4604737..cb81e10d12 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 a665abaaa4..d8ab6260a3 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 18e1ceb890..f994e65250 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 40bc35633a..62800ab66c 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 03b7d9ed59..30885ca59d 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 1315d66176..b8fe6836d2 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 aac30b83c4..e5bfbcf3dc 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 60d0baf30e..5214a726b5 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 0edb6bb8a6..0d85f7f42f 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 1381439612..cb74afdd15 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 695c65a63a..b8362c82f2 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 a05d9ff2b3..a4e33d33eb 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 d2d1d07928..49abf17d26 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; @@ -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 nullptr")); //All human players have manual control and must "drive" the beam around! m_startAttackFrame = TheGameLogic->getFrame(); @@ -321,7 +321,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 nullptr")); //All computer controlled players have automatic control -- the "S" curve. UnsignedInt now = TheGameLogic->getFrame(); @@ -639,7 +639,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(); @@ -674,7 +674,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! @@ -698,7 +698,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 ); @@ -779,7 +779,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; } @@ -895,7 +895,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, "" ); } } } @@ -1003,7 +1003,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 ); } } } @@ -1042,7 +1042,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 ); } } } @@ -1534,11 +1534,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 ed6fc31c19..e58f80b5ee 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 fcf555c705..e5d2829b05 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 e1424a2da3..e413820208 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 f7748360ca..f931c039f1 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 469155cbe7..e6d782d259 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 9eb841a70b..94aaed79b2 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 96bb28994c..d5d172169a 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 78d66c0964..55c95ddced 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 eed6fa5f8b..40412b44e4 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 0d87c22f89..ebd65ef708 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 8282a29d2f..efac56d1a5 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 201a1580eb..17de4f0005 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 bd35bb5849..c56bf51934 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 15eb2a74eb..bfb7b2b497 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 a390bc943f..09dc2545ab 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 a94c348d04..7a69872664 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 11128be257..b498bd5221 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 005fa4a8af..d3609537bf 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 7af9b83cfc..17d1fd053a 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 a628657312..e3db1a41d9 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 d4d670b02d..a4aa006298 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 9b95be8397..f9773bdb59 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 56c7b3b76b..bb2f5ff9e4 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 5c6b7ed955..0287b7f3d9 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 2ec700db65..a0205737ec 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 4f35f73bdf..87a721fc80 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 f66a9db86a..dcbd4e5496 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 92a6b84b83..2ef8772f74 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 e486ff7a85..1bf9585271 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 4be2d345ac..d86105e06e 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 3406cc3545..761fcc61b6 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 18b889e7ba..beb6005fce 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 2c1fe9a235..67b5b7dd60 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 135f71b26a..da475a648c 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 69bcca6606..f968dc0022 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():"nullptr")); //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; @@ -941,7 +941,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")); @@ -956,7 +956,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 @@ -984,7 +984,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 ); @@ -1005,7 +1005,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; @@ -1033,7 +1033,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 ) { @@ -1125,10 +1125,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) @@ -1137,7 +1137,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 { @@ -1333,7 +1333,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... @@ -1343,7 +1343,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(); @@ -1352,7 +1352,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; @@ -1375,11 +1375,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; @@ -1398,10 +1398,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. @@ -1483,7 +1483,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 @@ -1549,7 +1549,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; @@ -1601,7 +1601,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 = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); @@ -1613,7 +1613,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 = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON); w->loadAmmoNow(source); @@ -1625,9 +1625,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; } @@ -1635,9 +1635,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; } @@ -1649,7 +1649,7 @@ WeaponTemplate *WeaponStore::findWeaponTemplatePrivate( NameKeyType key ) const if( m_weaponTemplateVector[ i ]->getNameKey() == key ) return m_weaponTemplateVector[i]; - return NULL; + return nullptr; } @@ -1659,7 +1659,7 @@ WeaponTemplate *WeaponStore::newWeaponTemplate(AsciiString name) // sanity if(name.isEmpty()) - return NULL; + return nullptr; // allocate a new weapon WeaponTemplate *wt = newInstance(WeaponTemplate); @@ -1674,7 +1674,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); @@ -2346,7 +2346,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)) { @@ -2452,7 +2452,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(); @@ -2491,12 +2491,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(); } @@ -2524,7 +2524,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. @@ -2688,7 +2688,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 ); @@ -2793,7 +2793,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 ); } //------------------------------------------------------------------------------------------------- @@ -2801,21 +2801,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 ); } //------------------------------------------------------------------------------------------------- @@ -2829,7 +2829,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 ); } @@ -2957,8 +2957,8 @@ class AssistanceRequestData //------------------------------------------------------------------------------------------------- AssistanceRequestData::AssistanceRequestData() { - m_requestingObject = NULL; - m_victimObject = NULL; + m_requestingObject = nullptr; + m_victimObject = nullptr; m_requestDistanceSquared = 0.0f; } @@ -2983,7 +2983,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 @@ -3044,7 +3044,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)); @@ -3085,7 +3085,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; @@ -3105,7 +3105,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; @@ -3142,7 +3142,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 @@ -3176,7 +3176,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); } //------------------------------------------------------------------------------------------------- @@ -3188,7 +3188,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); } //------------------------------------------------------------------------------------------------- @@ -3202,7 +3202,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); } //------------------------------------------------------------------------------------------------- @@ -3217,7 +3217,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); } //------------------------------------------------------------------------------------------------- @@ -3453,7 +3453,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; } } @@ -3550,7 +3550,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 79235cd92b..a8303e7760 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 753a0d57ce..7d24470877 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 23020d2159..a85f03d988 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 865d1bd2d8..b9ab0b9fa5 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 nullptr 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(("nullptr 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 nullptr 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()); TheScriptEngine->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 nullptr 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 nullptr) 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 31b589c905..ab4e28f81f 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 901ea818d5..ae5a84d361 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 878e3e7055..550a65b0ca 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 nullptr, 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 33eb9cef8e..b09946e6c4 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 15a07b0c60..88e6204e5d 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 a6001e2206..7164190c6c 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; @@ -273,7 +273,7 @@ void GameLogic::setDefaults( Bool loadingSaveGame ) 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 @@ -282,7 +282,7 @@ void GameLogic::setDefaults( Bool loadingSaveGame ) (*it)->friend_setIndexInLogic(-1); } m_sleepyUpdates.clear(); - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; // // only reset the next object ID allocater counter when we're not loading a save game. @@ -328,7 +328,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") ); } @@ -346,7 +346,7 @@ GameLogic::~GameLogic() { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } // destroy all remaining objects @@ -354,27 +354,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; } // ------------------------------------------------------------------------------------------------ @@ -455,7 +455,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; @@ -490,7 +490,7 @@ void GameLogic::reset( void ) m_forceGameStartByTimeOut = FALSE; delete TheStatsCollector; - TheStatsCollector = NULL; + TheStatsCollector = nullptr; // clear any table of contents we have m_objectTOC.clear(); @@ -594,8 +594,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; @@ -623,7 +623,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 @@ -672,7 +672,7 @@ LoadScreen *GameLogic::getLoadScreen( Bool loadingSaveGame ) break; case GAME_NONE: default: - return NULL; + return nullptr; } } @@ -1115,7 +1115,7 @@ void GameLogic::deleteLoadScreen( void ) { delete m_loadScreen; - m_loadScreen = NULL; + m_loadScreen = nullptr; } @@ -1196,13 +1196,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); } } @@ -1228,8 +1228,8 @@ 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 - GameInfo *game = NULL; - TheGameInfo = NULL; + GameInfo *game = nullptr; + TheGameInfo = nullptr; Int localSlot = 0; if (TheNetwork) { @@ -1296,7 +1296,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) } else { if (m_gameMode == GAME_SINGLE_PLAYER) { delete TheSkirmishGameInfo; - TheSkirmishGameInfo = NULL; + TheSkirmishGameInfo = nullptr; } } @@ -1323,7 +1323,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) { m_background->destroyWindows(); deleteInstance(m_background); - m_background = NULL; + m_background = nullptr; } setFPMode(); if(TheCampaignManager) @@ -1580,7 +1580,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; } @@ -1589,7 +1589,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) @@ -1738,7 +1738,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()) @@ -1844,7 +1844,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 ) @@ -1882,7 +1882,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()) @@ -2009,7 +2009,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. @@ -2196,7 +2196,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) { Player *pPlayer = ThePlayerList->getNthPlayer(i); if (pPlayer && pPlayer->getPlayerType() != PLAYER_HUMAN) - pPlayer = NULL; + pPlayer = nullptr; if (pPlayer) { @@ -2223,7 +2223,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()) @@ -2385,7 +2385,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(); @@ -2489,7 +2489,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. @@ -2499,7 +2499,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. @@ -2610,9 +2610,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()) @@ -2776,8 +2776,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) { @@ -3009,7 +3009,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); @@ -3290,7 +3290,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]; @@ -3358,7 +3358,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); @@ -3386,11 +3386,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; } @@ -3417,7 +3417,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++; @@ -3428,12 +3428,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; } @@ -3500,14 +3500,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])) @@ -3580,7 +3580,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); @@ -3773,7 +3773,7 @@ void GameLogic::update( void ) u->update(); #endif - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; } } } @@ -3812,7 +3812,7 @@ void GameLogic::update( void ) if (sleepLen < 1) sleepLen = UPDATE_SLEEP_NONE; - m_curUpdateModule = NULL; + m_curUpdateModule = nullptr; } @@ -3918,14 +3918,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; @@ -3939,12 +3939,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; } @@ -4025,7 +4025,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()) @@ -4194,7 +4194,7 @@ UnsignedInt GameLogic::getCRC( Int mode, AsciiString deepCRCFileName ) UnsignedInt theCRC = xferCRC->getCRC(); delete xferCRC; - xferCRC = NULL; + xferCRC = nullptr; if (isInGameLogicUpdate()) { @@ -4244,7 +4244,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 @@ -4255,7 +4255,7 @@ void GameLogic::sendObjectDestroyed( Object *obj ) } // erase the binding of the drawable to this object - obj->friend_bindToDrawable( NULL ); + obj->friend_bindToDrawable( nullptr ); } @@ -4651,7 +4651,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryByName( AsciiString name ) if( (*it).name == name ) return &(*it); - return NULL; + return nullptr; } @@ -4665,7 +4665,7 @@ GameLogic::ObjectTOCEntry *GameLogic::findTOCEntryById( UnsignedShort id ) if( (*it).id == id ) return &(*it); - return NULL; + return nullptr; } @@ -4710,7 +4710,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 @@ -4831,7 +4831,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()) ); @@ -4893,7 +4893,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() )); @@ -4933,7 +4933,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 )); @@ -4946,7 +4946,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!", @@ -5045,7 +5045,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'", @@ -5151,11 +5151,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 23d726911a..0965eacbb2 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; TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 = TheGameLogic->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 ) return; // 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 f7435bcd74..7ec48b5c37 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 40eab1badf..f5ef398b0f 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 5cfe1211d0..f8c8b5bcce 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 nullptr 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 nullptr when it should be")); + DEBUG_ASSERTCRASH(TheNAT == nullptr, ("TheNAT is not nullptr 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 1d33cb947e..bd0109ce24 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 e987096c35..d7080a933e 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 dbe3f4c491..6364365073 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 64124a64a1..1e658a1d53 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h @@ -23,6 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// #pragma once +#include #include "matrix4.h" #include "GameClient/Shadow.h" @@ -42,7 +43,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;} /// #include "WW3D2/matpass.h" #include "WW3D2/dx8wrapper.h" @@ -59,7 +60,7 @@ class W3DShroudMaterialPassClass : public MaterialPassClass class W3DMaskMaterialPassClass : public MaterialPassClass { public: - W3DMaskMaterialPassClass(void) : m_texture(NULL), m_allowUninstall(TRUE) {} + W3DMaskMaterialPassClass(void) : m_texture(nullptr), m_allowUninstall(TRUE) {} virtual void Install_Materials(void) const; virtual void UnInstall_Materials(void) const; void setTexture(TextureClass *texture) {m_texture=texture;} diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h index 2208d9e6fb..728180b8f6 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h @@ -115,7 +115,7 @@ class W3DVolumetricShadow : public Shadow void setOptimalExtrusionPadding(Real value) {m_extraExtrusionPadding=value;} const W3DShadowGeometry *getGeometry(void) {return m_geometry;} - void setRenderObject( RenderObjClass *robj) {assert(m_robj==NULL); m_robj=robj;} + void setRenderObject( RenderObjClass *robj) {assert(m_robj==nullptr); m_robj=robj;} void setRenderObjExtent ( Real extent) { m_robjExtent = extent; } // called once per frame, updates shadow volume when necessary diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DTerrainLogic.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DTerrainLogic.h index 3ca892e818..a924cc687e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DTerrainLogic.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameLogic/W3DTerrainLogic.h @@ -53,11 +53,11 @@ class W3DTerrainLogic : public TerrainLogic 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 getGroundHeight( Real x, Real y, Coord3D* normal = nullptr ) const; virtual Bool isCliffCell( Real x, Real y) const; ///< is point cliff cell. - virtual Real getLayerHeight(Real x, Real y, PathfindLayerEnum layer, Coord3D* normal = NULL, Bool clip = true) const; + virtual Real getLayerHeight(Real x, Real y, PathfindLayerEnum layer, Coord3D* normal = nullptr, Bool clip = true) const; virtual void getExtent( Region3D *extent ) const ; ///< Get the 3D extent of the terrain in world coordinates diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp index a1bee4fbed..17f1b6cbdf 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DFunctionLexicon.cpp @@ -95,7 +95,7 @@ static FunctionLexicon::TableEntry gameWinDrawTable [] = { NAMEKEY_INVALID, "W3DNoDraw", W3DNoDraw }, { NAMEKEY_INVALID, "W3DDrawMapPreview", W3DDrawMapPreview }, - { NAMEKEY_INVALID, NULL, NULL }, + { NAMEKEY_INVALID, nullptr, nullptr }, }; @@ -105,7 +105,7 @@ static FunctionLexicon::TableEntry layoutInitTable [] = { NAMEKEY_INVALID, "W3DMainMenuInit", W3DMainMenuInit }, - { NAMEKEY_INVALID, NULL, NULL }, + { NAMEKEY_INVALID, nullptr, nullptr }, }; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp index dc32633ad0..bf641e4407 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp @@ -52,13 +52,13 @@ //------------------------------------------------------------------------------------------------- W3DDebrisDraw::W3DDebrisDraw(Thing *thing, const ModuleData* moduleData) : DrawModule(thing, moduleData) { - m_renderObject = NULL; + m_renderObject = nullptr; for (int i = 0; i < STATECOUNT; ++i) - m_anims[i] = NULL; - m_fxFinal = NULL; + m_anims[i] = nullptr; + m_fxFinal = nullptr; m_state = INITIAL; m_frames = 0; - m_shadow = NULL; + m_shadow = nullptr; m_finalStop = false; } @@ -69,19 +69,19 @@ W3DDebrisDraw::~W3DDebrisDraw(void) if (TheW3DShadowManager && m_shadow) { TheW3DShadowManager->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 471494eab8..c6b30a4fdf 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 8582b2e5b1..3b5a5b5b9b 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 fccd5c32e0..75c5fe9058 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 nullptr 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 nullptr 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 nullptr")); 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 fb3d7795d5..47d73176dd 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 0a4c356cc0..994370e5c0 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 e748a8e167..2d8cac63d1 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 5dd2dcf89e..c80cb4aa7d 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 6aa69be1c0..67394ae6e8 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 d94d3ced65..61afe05937 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 bde8a4cadd..105de57b6f 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 56af0e77ca..1d5387e7bf 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 83945bf5f3..4a17f4083c 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 8398f8c0ec..15554b3a5b 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 49625d6628..74821c5167 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 5cf8d3c4f6..3310b688c5 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 a81ccef2ac..51e0b0f76c 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 eeb266b208..4d36ff040d 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 adc27efe9d..804b0c2b9d 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 23099a7226..39c989c585 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 dbb3c3e54b..2b89eb1e56 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 f3dd9dde95..d913a57bb0 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 2c837c4574..8640566ccc 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 6ea10bd26a..f140101186 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 9a34a5ee15..cf11ddebf9 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 56545f26a0..38f6d0b33f 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 0352b2301a..b91335f4e8 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 dbabe8bfe5..b4bc7550d2 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 62eb49594a..874145bac2 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 350082ebac..0ca2e081c5 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 4f2096efa7..e5f828619e 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 9bcf74d80e..d05e9814a6 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 nullptr!")); 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 a27412e974..80dd1ad076 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 f9951feac9..4b87cf9abd 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 655f5e484d..21a655bf77 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 nullptr") ); 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 nullptr") ); 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 3c259eedf5..afc9888d56 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 c3d8252337..014c34464e 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 27cdd3c0ea..ed68758894 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 6f3c9ba6eb..2f60e418a9 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 1636c46f24..88e7bb3cb8 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 fe6294679b..40a70da88d 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 054cc27966..ad713be228 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 4f5dbd6dd6..d2f394e158 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 0c72dbf244..f482b3ebb4 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 b9c75e7837..9ece5013c3 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 8920c2338d..7f311c1aa3 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 3e3ef84d7f..3a51b25861 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 66a19d43b9..2cb1c0bfd7 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 1c120148b7..ab251dfbe0 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 nullptr 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 11e6747038..6d20001189 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 b7ee59abd3..2239a0b230 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 6c073b501d..a49fa80078 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 7ef77aff29..890068160b 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 nullptr 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 0b7a8ef24a..6161951a55 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 4b0f2b791e..75e0fb827d 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 02597c4567..286f442ae9 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 085edf99f4..4296ef53d1 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 027a95f479..bbd80231aa 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" )); } @@ -341,8 +341,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 ) @@ -407,7 +407,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 e5b195fe6c..45fc8ae340 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" )); } @@ -323,8 +321,8 @@ void DirectInputMouse::mapDirectInputMouse( MouseIO *mouse, DirectInputMouse::DirectInputMouse( void ) { - m_pDirectInput = NULL; - m_pMouseDevice = NULL; + m_pDirectInput = nullptr; + m_pMouseDevice = nullptr; } @@ -469,20 +467,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 9b89deba00..08c4671532 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp @@ -275,7 +275,7 @@ Win32Mouse::Win32Mouse( void ) m_currentWin32Cursor = NONE; for (Int i=0; i #include "aabtreebuilder.h" #include "chunkio.h" #include "w3d_file.h" @@ -80,12 +81,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,13 +124,13 @@ AABTreeBuilderClass::~AABTreeBuilderClass(void) void AABTreeBuilderClass::Reset(void) { delete Root; - Root = NULL; + Root = nullptr; delete[] Verts; - Verts = NULL; + Verts = nullptr; delete[] Polys; - Polys = NULL; + Polys = nullptr; } /*********************************************************************************************** @@ -148,8 +149,8 @@ void AABTreeBuilderClass::Build_AABTree(int polycount,TriIndex * 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 @@ -185,7 +186,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 +214,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 +253,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 +333,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 +344,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 +369,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 +957,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 b3b2584263..4823d36bcd 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/aabtreebuilder.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector3.h" @@ -86,7 +87,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 +136,8 @@ class AABTreeBuilderClass SplitArraysStruct(void) : FrontCount(0), BackCount(0), - FrontPolys(NULL), - BackPolys(NULL) + FrontPolys(nullptr), + BackPolys() { } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 910f1f7d2f..b83b1c8f8f 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 2168a3f37a..daff22add8 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "composite.h" @@ -123,7 +124,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 597db9f6bc..cabd7df4b6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -77,6 +77,7 @@ * WW3DAssetManager::Get_Streaming_Texture -- Gets a streaming texture. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "assetmgr.h" #include @@ -123,7 +124,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 +180,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 +209,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 +259,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 +454,7 @@ void WW3DAssetManager::Free_Assets(void) PrototypeClass * proto = Prototypes[count]; Prototypes.Delete(count); - if (proto != NULL) { + if (proto != nullptr) { proto->DeleteSelf(); } } @@ -532,7 +533,7 @@ void WW3DAssetManager::Free_Assets_With_Exclusion_List(const DynamicVectorClass< for (; iGet_Name())); proto->DeleteSelf(); } - Prototypes[i] = NULL; + Prototypes[i] = nullptr; } } @@ -594,7 +595,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 +713,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 +736,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 +753,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 +794,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 +816,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 +825,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 +846,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 +887,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 +972,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 +980,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 +995,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 +1026,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 +1042,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 +1085,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 +1109,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 +1404,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 +1472,7 @@ FontCharsClass * WW3DAssetManager::Get_FontChars( const char * name, int point_s } font->Release_Ref(); - return NULL; + return nullptr; } @@ -1516,7 +1517,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 +1529,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 nullptr if one wasn't found * * * * WARNINGS: * * * @@ -1543,7 +1544,7 @@ PrototypeLoaderClass * WW3DAssetManager::Find_Prototype_Loader(int chunk_id) return loader; } } - return NULL; + return nullptr; } @@ -1563,7 +1564,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 +1586,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 +1640,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 +1681,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 +1707,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 82f5b6b763..5c9d36d340 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "Vector.h" @@ -201,7 +202,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 f2bb6637b5..2ec85f7efd 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/boxrobj.cpp @@ -88,6 +88,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "boxrobj.h" #include "w3d_util.h" #include "wwdebug.h" @@ -158,7 +159,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 +307,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 +352,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 +507,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 +725,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 +1109,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 ba12206dea..83ff9bd555 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.cpp @@ -71,6 +71,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "camera.h" #include "ww3d.h" #include "matrix4.h" @@ -771,7 +772,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 +780,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 +801,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 8766dea3a1..3bce529c05 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/camera.h @@ -44,6 +44,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "rendobj.h" @@ -287,10 +288,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 6b0b4d736e..2969f7c767 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "dazzle.h" #include "simplevec.h" #include "vector2.h" @@ -232,7 +233,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 +301,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 +315,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 +329,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 +346,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 +435,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 +591,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 +1332,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 nullptr. // // ---------------------------------------------------------------------------- -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 nullptr if not found { - if (id>=lensflare_count) return NULL; + if (id>=lensflare_count) return nullptr; return lensflares[id]; } @@ -1351,7 +1352,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 +1454,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 +1494,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 nullptr 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 +1549,7 @@ const PersistFactoryClass & DazzleRenderObjClass::Get_Factory (void) const ** **********************************************************************************************/ DazzleLayerClass::DazzleLayerClass(void) : - visible_lists(NULL) + visible_lists(nullptr) { if (type_count != 0) { @@ -1559,7 +1560,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 +1583,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 +1661,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 +1669,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 24d3877940..1d8041283a 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 nullptr 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 nullptr 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 58f13203c0..f88a59f2cc 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 936d25c396..97d5c0ea0b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/decalmsh.cpp @@ -51,6 +51,7 @@ * SkinDecalMeshClass::Process_Material_Run -- scans the mesh for material runs * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "decalmsh.h" #include "decalsys.h" #include "rinfo.h" @@ -199,8 +200,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 12bd6d0068..3b29c91ca5 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -38,6 +38,7 @@ //#define INDEX_BUFFER_LOG +#include #include "dx8indexbuffer.h" #include "dx8wrapper.h" #include "dx8caps.h" @@ -53,7 +54,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 +374,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 +401,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 ae773e3607..317cef4d91 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp @@ -40,6 +40,7 @@ //#define ENABLE_CATEGORY_LOG //#define ENABLE_STRIPING +#include #include "dx8renderer.h" #include "dx8wrapper.h" #include "dx8polygonrenderer.h" @@ -103,10 +104,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 +145,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 +195,7 @@ DX8TextureCategoryClass::DX8TextureCategoryClass( : pass(pass_), shader(shd), - render_task_head(NULL), + render_task_head(nullptr), material(mat), container(container_) { @@ -203,7 +204,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 +270,7 @@ void DX8FVFCategoryContainer::Remove_Texture_Category(DX8TextureCategoryClass* t } for (pass=0; passSet_Next_Visible(new_mpr); } @@ -294,10 +295,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 +315,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 +325,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 +356,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 +365,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 +405,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 +425,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 +466,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 +486,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category } dest_it.Next(); } - return NULL; + return nullptr; } DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category( @@ -494,7 +495,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 +511,7 @@ DX8TextureCategoryClass* DX8FVFCategoryContainer::Find_Matching_Texture_Category } dest_it.Next(); } - return NULL; + return nullptr; } void DX8FVFCategoryContainer::Change_Polygon_Renderer_Texture( @@ -743,10 +744,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 +1256,8 @@ DX8SkinFVFCategoryContainer::DX8SkinFVFCategoryContainer(bool sorting) : DX8FVFCategoryContainer(DX8_FVF_XYZNUV1,sorting), VisibleVertexCount(0), - VisibleSkinHead(NULL), - VisibleSkinTail(NULL) + VisibleSkinHead(nullptr), + VisibleSkinTail(nullptr) { } @@ -1304,7 +1305,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 +1330,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 +1340,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 +1456,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 +1695,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() : "nullptr")); DX8Wrapper::Set_Texture(i,Peek_Texture(i)); } @@ -1702,7 +1703,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() : "nullptr")); 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 +1735,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 +1767,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 +1781,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 +1792,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 +1811,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 +1901,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 +1927,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 +1949,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 +1968,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 +1979,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 +2000,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 +2025,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 +2055,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 +2211,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 +2230,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 +2280,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 c040eee6ea..7b441b76f8 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.h @@ -38,6 +38,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "wwstring.h" @@ -93,7 +94,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 +112,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 +209,7 @@ class DX8FVFCategoryContainer : public MultiListObjectClass void Add_Visible_Texture_Category(DX8TextureCategoryClass * tex_category,int pass) { WWASSERT(pass #include "dx8vertexbuffer.h" #include "dx8wrapper.h" #include "dx8fvf.h" @@ -50,13 +51,13 @@ #define DEFAULT_VB_SIZE 5000 static bool _DynamicSortingVertexArrayInUse=false; -//static VertexFormatXYZNDUV2* _DynamicSortingVertexArray=NULL; -static SortingVertexBufferClass* _DynamicSortingVertexArray=NULL; +//static VertexFormatXYZNDUV2* _DynamicSortingVertexArray=nullptr; +static SortingVertexBufferClass* _DynamicSortingVertexArray=nullptr; static unsigned short _DynamicSortingVertexArraySize=0; static unsigned short _DynamicSortingVertexArrayOffset=0; static bool _DynamicDX8VertexBufferInUse=false; -static DX8VertexBufferClass* _DynamicDX8VertexBuffer=NULL; +static DX8VertexBufferClass* _DynamicDX8VertexBuffer=nullptr; static unsigned short _DynamicDX8VertexBufferSize=DEFAULT_VB_SIZE; static unsigned short _DynamicDX8VertexBufferOffset=0; @@ -310,7 +311,7 @@ SortingVertexBufferClass::~SortingVertexBufferClass() DX8VertexBufferClass::DX8VertexBufferClass(unsigned FVF, unsigned short vertex_count_, UsageType usage, unsigned vertex_size) : VertexBufferClass(BUFFER_TYPE_DX8, FVF, vertex_count_, vertex_size), - VertexBuffer(NULL) + VertexBuffer(nullptr) { Create_Vertex_Buffer(usage); } @@ -325,7 +326,7 @@ DX8VertexBufferClass::DX8VertexBufferClass( UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_NORMAL, VertexCount), - VertexBuffer(NULL) + VertexBuffer(nullptr) { WWASSERT(vertices); WWASSERT(normals); @@ -346,7 +347,7 @@ DX8VertexBufferClass::DX8VertexBufferClass( UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_NORMAL|D3DFVF_DIFFUSE, VertexCount), - VertexBuffer(NULL) + VertexBuffer(nullptr) { WWASSERT(vertices); WWASSERT(normals); @@ -367,7 +368,7 @@ DX8VertexBufferClass::DX8VertexBufferClass( UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, D3DFVF_XYZ|D3DFVF_TEX1|D3DFVF_DIFFUSE, VertexCount), - VertexBuffer(NULL) + VertexBuffer(nullptr) { WWASSERT(vertices); WWASSERT(tex_coords); @@ -386,7 +387,7 @@ DX8VertexBufferClass::DX8VertexBufferClass( UsageType usage) : VertexBufferClass(BUFFER_TYPE_DX8, D3DFVF_XYZ|D3DFVF_TEX1, VertexCount), - VertexBuffer(NULL) + VertexBuffer(nullptr) { WWASSERT(vertices); WWASSERT(tex_coords); @@ -721,7 +722,7 @@ DynamicVBAccessClass::DynamicVBAccessClass(unsigned t,unsigned fvf,unsigned shor Type(t), FVFInfo(_DynamicFVFInfo), VertexCount(vertex_count_), - VertexBuffer(0) + VertexBuffer(nullptr) { WWASSERT(fvf==dynamic_fvf_type); WWASSERT(Type==BUFFER_TYPE_DYNAMIC_DX8 || Type==BUFFER_TYPE_DYNAMIC_SORTING); @@ -752,13 +753,13 @@ DynamicVBAccessClass::~DynamicVBAccessClass() void DynamicVBAccessClass::_Deinit() { - WWASSERT ((_DynamicDX8VertexBuffer == NULL) || (_DynamicDX8VertexBuffer->Num_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 9fa4fa0686..4935cdb89c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp @@ -50,6 +50,7 @@ #define WINVER 0x0500 // Required to access GetMonitorInfo in VC6. #endif +#include #include "dx8wrapper.h" #include "dx8webbrowser.h" #include "dx8fvf.h" @@ -103,7 +104,7 @@ int DX8Wrapper_PreserveFPU = 0; ** ***********************************************************************************/ -static HWND _Hwnd = NULL; +static HWND _Hwnd = nullptr; bool DX8Wrapper::IsInitted = false; bool DX8Wrapper::_EnableTriangleDraw = true; @@ -126,8 +127,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 +146,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 +172,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 +204,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 +311,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 +322,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 +338,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 +358,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 +376,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 +469,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 nullptr, 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 nullptr. MW Release_Render_State(); // (gth) clear the matrix shadows too @@ -522,14 +523,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 +657,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 +712,11 @@ void DX8Wrapper::Release_Device(void) for (int a=0;aRelease(); - D3DDevice=NULL; + D3DDevice=nullptr; } } @@ -968,7 +969,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 +1021,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 +1260,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 +1296,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 +1478,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 +1742,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 +1778,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 +1818,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 +1877,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 +1949,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 +2039,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 +2283,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() : "nullptr")); if (render_state.Textures[i]) { @@ -2333,7 +2334,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 +2376,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 +2401,7 @@ void DX8Wrapper::Apply_Render_State_Changes() } else { DX8CALL(SetIndices( - NULL, + nullptr, 0)); DX8_RECORD_INDEX_BUFFER_CHANGE(); } @@ -2423,7 +2424,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 +2433,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 nullptr. if (rendertarget) { unsigned ret=D3DXCreateTexture( DX8Wrapper::_Get_D3D_Device8(), @@ -2446,7 +2447,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 +2477,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture } if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } } @@ -2540,7 +2541,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 +2560,8 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_Texture D3DX_FILTER_BOX, D3DX_FILTER_BOX, 0, - NULL, - NULL, + nullptr, + nullptr, &texture); if (result != D3D_OK) { @@ -2585,7 +2586,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 +2598,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 +2627,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 +2645,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 +2680,7 @@ IDirect3DTexture8 * DX8Wrapper::_Create_DX8_ZTexture if (ret==D3DERR_OUTOFVIDEOMEMORY) { Non_Fatal_Log_DX8_ErrorCode(ret,__FILE__,__LINE__); - return NULL; + return nullptr; } } @@ -2709,7 +2710,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 +2719,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 nullptr. if (rendertarget) { unsigned ret=D3DXCreateCubeTexture @@ -2735,7 +2736,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 +2771,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 +2847,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 +2917,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 +2941,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 +3168,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 +3186,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 +3199,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 +3225,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 nullptr 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 +3257,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 +3287,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 nullptr if (!Get_Current_Caps()->Support_Render_To_Texture_Format(format) || !Get_Current_Caps()->Support_Depth_Stencil_Format(zformat)) { @@ -3328,7 +3329,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 +3361,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 +3387,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 +3403,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 +3423,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 nullptr. 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 +3486,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 +3516,7 @@ DX8Wrapper::Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default } else { - DX8CALL(SetRenderTarget (CurrentRenderTarget, NULL)); + DX8CALL(SetRenderTarget (CurrentRenderTarget, nullptr)); } } } @@ -3523,9 +3524,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 +3552,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 nullptr. 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 +3614,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 +3631,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 +3673,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 +3869,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 db5b93030c..cdf0471939 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h @@ -40,6 +40,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "dllist.h" @@ -468,9 +469,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 +497,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 +838,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 +1193,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() : "nullptr")); } 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 8d3faef520..7bd0fec0fb 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp @@ -46,6 +46,7 @@ * HAnimManagerClass::Add_Anim -- Adds an externally created animation to the manager * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hanimmgr.h" #include "hanim.h" #include "hrawanim.h" @@ -95,11 +96,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 +155,7 @@ int HAnimManagerClass::Load_Morph_Anim(ChunkLoadClass & cload) { HMorphAnimClass * newanim = W3DNEW HMorphAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -164,7 +165,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 +198,7 @@ int HAnimManagerClass::Load_Raw_Anim(ChunkLoadClass & cload) { HRawAnimClass * newanim = W3DNEW HRawAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -207,7 +208,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 +241,7 @@ int HAnimManagerClass::Load_Compressed_Anim(ChunkLoadClass & cload) { HCompressedAnimClass * newanim = W3DNEW HCompressedAnimClass; - if (newanim == NULL) { + if (newanim == nullptr) { goto Error; } @@ -250,7 +251,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 +300,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 +386,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 +407,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 +421,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 +431,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 383a03d282..609dd039d1 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 * @@ -126,6 +126,7 @@ +#include #include "hlod.h" #include "assetmgr.h" #include "hmdldef.h" @@ -213,21 +214,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 +271,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 +293,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 +338,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 +373,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 +399,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 +724,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 +764,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 +1008,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 +1079,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 +1113,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 +1126,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 +1168,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 +1249,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 +1350,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 +1362,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 +1425,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 +1708,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 +1740,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 +1751,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 +1825,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 +1856,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 +1866,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 +1908,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 +1924,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 +1934,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 +1949,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 +1985,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 +2010,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 nullptr object to the start of the lod list Add_Lod_Model (0, null_object, 0); null_object->Release_Ref (); } @@ -2039,7 +2040,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 +2064,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 +2377,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 +2414,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 +2500,7 @@ RenderObjClass * HLodClass::Get_Sub_Object_On_Bone(int index,int boneindex) cons count++; } } - return NULL; + return nullptr; } @@ -3206,7 +3207,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 +3319,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 +3419,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 +3434,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 +3510,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 af10ea6633..0dad9712e5 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp @@ -36,6 +36,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hmorphanim.h" #include "w3d_file.h" #include "chunkio.h" @@ -195,9 +196,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 +212,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 +350,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 +363,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 +395,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 +428,7 @@ bool HMorphAnimClass::Import(const char *hierarchy_name, TextFileClass &text_des // Cleanup // delete [] channel_list; - channel_list = NULL; + channel_list = nullptr; } // @@ -441,7 +442,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 +450,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 +483,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 +511,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 +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(); @@ -606,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); @@ -654,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/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp index 17875705d1..31f2204166 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hrawanim.cpp @@ -50,6 +50,7 @@ * HRawAnimClass::Get_Visibility -- return visibility state for given pivot/frame * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "hrawanim.h" #include "motchan.h" #include "chunkio.h" @@ -68,14 +69,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 +122,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 +162,7 @@ HRawAnimClass::~HRawAnimClass(void) void HRawAnimClass::Free(void) { delete[] NodeMotion; - NodeMotion = NULL; + NodeMotion = nullptr; } @@ -220,7 +221,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 +230,7 @@ int HRawAnimClass::Load_W3D(ChunkLoadClass & cload) FrameRate = aheader.FrameRate; NodeMotion = W3DNEWARRAY NodeMotionStruct[ NumNodes ]; - if (NodeMotion == NULL) { + if (NodeMotion == nullptr) { goto Error; } @@ -430,7 +431,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 +450,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 +467,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 +511,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 +539,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 +550,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 +575,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 +593,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 +617,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 +646,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 +671,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 +686,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 fde4a853fa..5cd52a2da5 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 b42a36c3fd..7672eb7543 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-nullptr 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 1e37ea0cd4..92560b86d8 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/linegrp.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "shader.h" #include "vector4.h" @@ -72,11 +73,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 +107,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; // (nullptr if not used) RGBA values + ShareBufferClass * TailDiffuse; // (nullptr if not used) RGBA values + ShareBufferClass * ALT; // (nullptr if not used) active line table + ShareBufferClass * LineSize; // (nullptr if not used) size override table + ShareBufferClass * LineUCoord; // (nullptr 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 005b2567f1..d7dde3f2a6 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 13d2f8c846..649eb11488 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 nullptr, 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 f96e6a8c04..f5a7df119a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp @@ -86,6 +86,7 @@ * MeshClass::Make_Unique -- Makes mesh unique in the renderer, but still shares system ram * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "mesh.h" #include #include "w3d_file.h" @@ -157,11 +158,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 +187,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 +225,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 +399,7 @@ MaterialInfoClass * MeshClass::Get_Material_Info(void) return Model->MatInfo; } } - return NULL; + return nullptr; } @@ -416,7 +417,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 +518,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 +562,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 +590,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 +613,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 +784,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 +827,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 +878,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 +1028,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 +1057,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 +1145,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 +1470,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 +1481,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 +1575,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 +1583,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 2a6697a7b1..6221fcdf57 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.h @@ -36,6 +36,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "rendobj.h" @@ -136,7 +137,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 572aa03d38..8dfe4f4650 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp @@ -58,6 +58,7 @@ * MeshBuilderClass::Sort_Vertices_By_Vertex_Material -- sorts verts by vertex mtl in pass0 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshbuild.h" #include "uarray.h" #include @@ -160,7 +161,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 +407,7 @@ void MeshBuilderClass::VertClass::Reset(void) Attribute1 = 0; UniqueIndex = 0; ShadeIndex = 0; - NextHash = NULL; + NextHash = nullptr; } @@ -557,16 +558,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 +587,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 +606,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 +824,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 +1011,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 242f66da06..58c608a445 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp @@ -85,6 +85,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshgeometry.h" #include "aabtree.h" #include "chunkio.h" @@ -125,25 +126,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 +162,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 +324,7 @@ const char * MeshGeometryClass::Get_Name(void) const if (MeshName) { return MeshName->Get_Array(); } - return NULL; + return nullptr; } @@ -368,7 +369,7 @@ const char * MeshGeometryClass::Get_User_Text(void) if (UserText) { return UserText->Get_Array(); } - return NULL; + return nullptr; } @@ -410,7 +411,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 +431,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 +486,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 +525,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 +1260,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 +1297,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 +1389,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 +1478,7 @@ Vector4 * MeshGeometryClass::get_planes(bool create) if (PlaneEq) { return PlaneEq->Get_Array(); } - return NULL; + return nullptr; #endif } @@ -1552,7 +1553,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 +1624,7 @@ WW3DErrorType MeshGeometryClass::Load_W3D(ChunkLoadClass & cload) Set_Name(tmpname); delete[] tmpname; - tmpname = NULL; + tmpname = nullptr; /* ** Set Bounding Info @@ -1683,7 +1684,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 +1905,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 beced9e158..10385e2865 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "bittype.h" @@ -151,7 +152,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 +271,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 +282,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 f901d66903..23ee9fd6e6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp @@ -36,6 +36,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshmatdesc.h" #include "texture.h" #include "vertmaterial.h" @@ -181,26 +182,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 +524,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 +551,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 +559,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 +567,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 +589,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 +625,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 +654,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 +746,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 +762,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 +896,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 +922,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 d0bbc93eec..5a41e196d2 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.h @@ -37,6 +37,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector2.h" @@ -145,11 +146,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 +179,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 +226,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-nullptr pointers will be released when the buffer ** is destroyed. */ class MatBufferClass : public ShareBufferClass < VertexMaterialClass * > @@ -303,12 +304,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 +333,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 +346,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 +358,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 +387,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 +438,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 +466,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 b83cbd89c1..b292172206 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 c94234d9e1..cf1c2e9602 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 nullptr 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 e4c76ef83e..c6f58ad0ef 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp @@ -75,6 +75,7 @@ * MeshSaveContextClass::~MeshSaveContextClass -- destructor * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "meshmdl.h" #include "aabtree.h" #include "matinfo.h" @@ -236,7 +237,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 +281,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 +399,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 +585,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 +644,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 +766,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 +886,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 +1554,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 +1661,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 +1880,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 +1919,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 +1944,7 @@ MeshLoadContextClass::MeshLoadContextClass(void) PrelitChunkID = 0xffffffff; CurPass = 0; CurTexStage = 0; - TexCoords = NULL; + TexCoords = nullptr; LoadedDIG = false; } @@ -1965,7 +1966,7 @@ MeshLoadContextClass::~MeshLoadContextClass(void) int i; delete TexCoords; - TexCoords = NULL; + TexCoords = nullptr; for (i=0; iRelease_Ref(); @@ -1995,7 +1996,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 +2037,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 +2059,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 +2099,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 +2117,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 +2180,7 @@ VertexMaterialClass * MeshLoadContextClass::Peek_Legacy_Vertex_Material(int lega if (vi != -1) { return Peek_Vertex_Material(vi); } else { - return NULL; + return nullptr; } } @@ -2204,7 +2205,7 @@ TextureClass * MeshLoadContextClass::Peek_Legacy_Texture(int legacy_material_ind if (ti != -1) { return Peek_Texture(ti); } else { - return NULL; + return nullptr; } } @@ -2321,7 +2322,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 +2365,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 +2382,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 +2510,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 +2632,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 +2662,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 +2682,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 +2698,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 +2713,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 +2728,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 +2745,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 +2765,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 79099864f7..68401bfb05 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 6f8e52b0d5..cb38272e80 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp @@ -33,6 +33,8 @@ *-------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +#include #include "part_buf.h" #include "part_emt.h" #include "ww3d.h" @@ -102,7 +104,7 @@ ParticleBufferClass::ParticleBufferClass int frame_mode, const W3dEmitterLinePropertiesStruct * line_props ) : - NewParticleQueue(NULL), + NewParticleQueue(nullptr), NewParticleQueueStart(0U), NewParticleQueueEnd(0U), NewParticleQueueCount(0U), @@ -122,36 +124,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 +161,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 +194,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 +257,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 +325,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 +341,7 @@ ParticleBufferClass::ParticleBufferClass ParticleBufferClass::ParticleBufferClass(const ParticleBufferClass & src) : RenderObjClass(src), - NewParticleQueue(NULL), + NewParticleQueue(nullptr), NewParticleQueueStart(0U), NewParticleQueueEnd(0U), NewParticleQueueCount(0U), @@ -359,33 +361,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 +395,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 +553,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 +790,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 +935,7 @@ void ParticleBufferClass::Combine_Color_And_Alpha() } else if (Diffuse) { Diffuse->Release_Ref(); - Diffuse=NULL; + Diffuse=nullptr; } } @@ -941,7 +943,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 +1002,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 +1094,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 +1444,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 +1592,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 +1737,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 +1888,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 +1899,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 +2089,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 +2237,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 +2360,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 +2372,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 +2484,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 +2561,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 +2577,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 +2661,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 +2677,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 +2787,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 +2971,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 +2982,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 +3029,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 +3038,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 +3086,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 +3095,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 +3147,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 +3157,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 +3205,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 +3214,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 +3261,7 @@ void ParticleBufferClass::Get_Blur_Time_Key_Frames (ParticlePropertyStructGet_Texture_Mapping_Mode(); } return SegLineRendererClass::UNIFORM_WIDTH_TEXTURE_MAP; @@ -3335,7 +3337,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 +3345,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 +3353,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 +3361,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 +3369,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 +3377,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 +3385,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 +3393,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 +3401,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 +3449,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 95053db630..5c3862a8f0 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 nullptr (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 nullptr 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 735610ee76..53817a5ba7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.cpp @@ -37,6 +37,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "part_emt.h" #include "wwdebug.h" #include "ww3d.h" @@ -99,11 +100,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 +131,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 +150,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 +177,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 +200,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 +354,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-nullptr Scene), and then adds the particle // buffer to it. if ( BufferSceneNeeded ) { @@ -460,8 +461,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 +472,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 +640,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 +699,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 +824,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 +837,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 +874,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 bbd31a4975..dae26935a6 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_emt.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "rendobj.h" #include "RANDOM.h" @@ -77,8 +78,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 +118,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 +180,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 +221,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 +303,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 +311,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 nullptr). Vector3 BaseVel; // Base initial emission velocity. - Vector3Randomizer * VelRand; // Velocity randomizer pointer (may be NULL). + Vector3Randomizer * VelRand; // Velocity randomizer pointer (may be nullptr). 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 9b19d924f2..8090e59eed 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 5272e27f40..494ec89536 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(); } @@ -705,7 +705,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) @@ -736,7 +736,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 8b485725e7..5de821583f 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" //#include "simplevec.h" @@ -95,7 +96,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 +198,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 66ac05f379..d21731a8be 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 c18624f26f..8348612b4d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp @@ -61,6 +61,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "scene.h" #include "plane.h" #include "camera.h" @@ -361,7 +362,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 +555,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 a711dbdfa1..619a9c364b 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 68a58c327f..a80b3fffb1 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp @@ -38,6 +38,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "sortingrenderer.h" #include "dx8vertexbuffer.h" #include "dx8indexbuffer.h" @@ -272,7 +273,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 +383,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 +427,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 +445,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 +627,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 +644,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 +657,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 288d4cec6f..998614ad6c 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/vertmaterial.cpp @@ -37,6 +37,7 @@ * Get_Preset -- retrieve presets * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include #include "vertmaterial.h" #include "realcrc.h" #include "wwdebug.h" @@ -71,9 +72,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 +88,7 @@ VertexMaterialClass::VertexMaterialClass(void): for (i=0; iClone(); @@ -156,7 +157,7 @@ VertexMaterialClass::~VertexMaterialClass(void) if (Mapper[i]) { REF_PTR_RELEASE(Mapper[i]); - Mapper[i]=NULL; + Mapper[i]=nullptr; } } @@ -181,9 +182,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;stage #include "ww3d.h" #include "rinfo.h" #include "assetmgr.h" @@ -184,7 +185,7 @@ bool WW3D::MungeSortOnLoad = false; bool WW3D::OverbrightModifyOnLoad = false; -FrameGrabClass * WW3D::Movie = NULL; +FrameGrabClass * WW3D::Movie = nullptr; bool WW3D::PauseRecord; bool WW3D::RecordNextFrame; @@ -195,11 +196,11 @@ long WW3D::UserStat2 = 0; float WW3D::DefaultNativeScreenSize = 1.0f; -StaticSortListClass * WW3D::DefaultStaticSortLists = NULL; -StaticSortListClass * WW3D::CurrentStaticSortLists = NULL; +StaticSortListClass * WW3D::DefaultStaticSortLists = nullptr; +StaticSortListClass * WW3D::CurrentStaticSortLists = nullptr; -VertexMaterialClass * WW3D::DefaultDebugMaterial = NULL; +VertexMaterialClass * WW3D::DefaultDebugMaterial = nullptr; ShaderClass WW3D::DefaultDebugShader(DEFAULT_DEBUG_SHADER_BITS); ShaderClass WW3D::LightmapDebugShader(LIGHTMAP_DEBUG_SHADER_BITS); @@ -215,7 +216,7 @@ unsigned WW3D::NPatchesLevel=1; bool WW3D::IsTexturingEnabled=true; bool WW3D::IsColoringEnabled=false; -static HWND _Hwnd = NULL; // Not a member to hide windows from WW3D users +static HWND _Hwnd = nullptr; // Not a member to hide windows from WW3D users static int _TextureReduction = 0; static int _TextureMinDim = 1; static bool _LargeTextureExtraReductionEnabled = false; @@ -1017,7 +1018,7 @@ WW3DErrorType WW3D::Render( DX8Wrapper::Set_DX8_Render_State(D3DRS_FILLMODE,D3DFILL_SOLID); // Install the lighting environment if one is supplied - if (rinfo.light_environment != NULL) { + if (rinfo.light_environment != nullptr) { DX8Wrapper::Set_Light_Environment(rinfo.light_environment); } @@ -1359,10 +1360,10 @@ void WW3D::Make_Screen_Shot( const char * filename_base , const float gamma, con 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 { @@ -1371,7 +1372,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 +1402,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 +1508,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 +1543,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 +1659,7 @@ bool WW3D::Is_Movie_Paused() *=============================================================================================*/ bool WW3D::Is_Recording_Next_Frame() { - return (Movie != 0) && (!PauseRecord || RecordNextFrame); + return (Movie != nullptr) && (!PauseRecord || RecordNextFrame); } @@ -1676,7 +1677,7 @@ bool WW3D::Is_Recording_Next_Frame() *=============================================================================================*/ bool WW3D::Is_Movie_Ready() { - return Movie != 0; + return Movie != nullptr; } @@ -1709,10 +1710,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 +1722,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 +1752,7 @@ void WW3D::Update_Movie_Capture( void ) surfaceCopy->Unlock(); surfaceCopy->Release_Ref(); - surfaceCopy = NULL; + surfaceCopy = nullptr; Movie->Grab(image); #endif @@ -1880,7 +1881,7 @@ VertexMaterialClass * WW3D::Peek_Default_Debug_Material(void) WWASSERT(DefaultDebugMaterial); return DefaultDebugMaterial; #else - return NULL; + return nullptr; #endif } @@ -1933,7 +1934,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 533396f1de..5c4a73bb7a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ww3d.h @@ -35,6 +35,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include "always.h" #include "vector3.h" @@ -100,7 +101,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 +144,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 8d0dc1aa6c..7cd993f04c 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 e7741c4016..45356e4ee1 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 98e6f0f310..f47ef900e9 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 nullptr, 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 7a1ef8e37a..7fe1a95581 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, ("nullptr 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 d1751313cb..767796931b 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 c60c72551d..57a0b8e0bf 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 e15c2950e2..cb323c6d55 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 fbd5fef545..67de9b50bd 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 e6bb26af6c..fa10b0990d 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 569de7ba74..30fa339560 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 32c8ae1732..0adc7fef90 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 065b782254..9c28c846f4 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 524f483be8..e9a3a12fce 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 23ec57af6e..2456ebdd64 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 2cf73abfe8..9feabb143a 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 d11224b79a..97fe8fd988 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 3d9ef8bd4d..f8cfd235f1 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 9f43480cf3..b561224745 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 401e29e834..6cefa8e5a8 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 efc03f6691..1459ff7ff0 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 nullptr 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 1945184152..f5c7f99e39 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 nullptr 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 nullptr 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( TheHierarchyView->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 bb83dbe0d3..754074ea2a 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 1b6c26daf0..5382321549 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 7849582e6b..26f73de384 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 52ea538ae1..68d90a2c2c 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 1c8801e14b..4d4ef45797 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 bc93293579..9de012a2a4 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h @@ -17,12 +17,13 @@ */ #pragma once +#include 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 5b467b0c2b..35adbf77c2 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 347c65f152..e97844dc63 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------------*/ #pragma once +#include // INCLUDES /////////////////////////////////////////////////////////////////// #include "Resource.h" @@ -49,7 +50,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 +68,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 +86,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 +104,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 +122,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 96b1255898..2461474bcc 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 a8be3b1cd4..06555e88b8 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 00e8a591c9..781b4f66a6 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 b41df2cc2f..f0333c9bb2 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 b38afd9d18..52a5783c4e 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 3858e1256a..681fd8e02d 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------------*/ #pragma once +#include #include "Resource.h" #include "ISwapablePanel.h" @@ -48,7 +49,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 +67,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 +86,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 ecc4ac0738..286e75e7ad 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h +++ b/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------------*/ #pragma once +#include // INCLUDES /////////////////////////////////////////////////////////////////// #include "Resource.h" @@ -49,7 +50,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 +68,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 +86,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 +104,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 +122,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 309efe287f..a9965590e8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BaseBuildProps.h @@ -17,6 +17,7 @@ */ #pragma once +#include // BaseBuildProps.h : header file // @@ -28,7 +29,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 713b517da4..4d3148361c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/BlendMaterial.h @@ -17,6 +17,7 @@ */ #pragma once +#include // BlendMaterial.h : header file // @@ -32,7 +33,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 5136504304..9d56724218 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 b0f88d8f2d..4a119cb080 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 32c27ecd8b..697292ee83 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 3ba623f52d..cb9ab357cc 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CameraOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // CameraOptions.h : header file // @@ -31,7 +32,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 8dd420e5c1..22e653c13c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CellWidth.h @@ -17,6 +17,7 @@ */ #pragma once +#include // CellWidth.h : header file // @@ -28,7 +29,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 974aeca6f8..e60dd3c418 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ContourOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ContourOptions.h : header file // @@ -35,7 +36,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 67c8affbb2..6ec947d491 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EditAction.h : header file // @@ -32,7 +33,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 56dd2efe3a..966f23402c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditCondition.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EditCondition.h : header file // @@ -38,7 +39,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 1f007f9b47..c4050f7e64 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 b75952dfef..d7b2ad9403 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditGroup.h @@ -17,6 +17,7 @@ */ #pragma once +#include // EditGroup.h : header file // @@ -29,7 +30,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 2f4c11394d..0544cf79de 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 8141ef0df3..d5143cc538 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 30a2a22e6c..f54b77e071 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ExportScriptsOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ExportScriptsOptions.h : header file // @@ -28,7 +29,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 66ef13d917..7b85bbeaa7 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/FeatherOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // brushoptions.h : header file // @@ -37,7 +38,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 dff1241e7a..d15832745c 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 7ea4d1f37b..7d4651a21e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/GlobalLightOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // GLOBALLIGHTOPTIONS.h : header file // @@ -40,7 +41,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 27101c9733..d574ccea48 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 ad3cbad52a..4c8a360ab9 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ImpassableOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include class ImpassableOptions : public CDialog { @@ -24,7 +25,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 00a8c5f5aa..1cfa2c943e 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 3e15583256..2c6a26591c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/LightOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // LightOptions.h : header file // @@ -31,7 +32,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 d6e1517d69..2fa73318e4 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MapSettings.h @@ -17,6 +17,7 @@ */ #pragma once +#include // MapSettings.h : header file // @@ -28,7 +29,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 973c9c285e..623164d30e 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 2d0ef585e2..64b80d21df 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/MoundOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // MoundOptions.h : header file // @@ -41,7 +42,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 3a37645625..42fa791d43 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 94af9739d8..b3061ad29b 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 f43de286e7..35317e6a22 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/OpenMap.h @@ -17,6 +17,7 @@ */ #pragma once +#include // OpenMap.h : header file // @@ -35,7 +36,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 b105a97c9f..42e4ac62d5 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/OptionsPanel.h @@ -17,6 +17,7 @@ */ #pragma once +#include // OptionsPanel.h : header file // @@ -32,7 +33,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 18ee6f3dd2..adc8c759f8 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 8137f0a91c..435d6091ff 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RampOptions.h @@ -32,6 +32,7 @@ /*---------------------------------------------------------------------------*/ #pragma once +#include // INCLUDES /////////////////////////////////////////////////////////////////// #include "OptionsPanel.h" @@ -47,7 +48,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 939e00a619..c1444bd924 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 38cf6e0ba8..c639ea274c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/RulerOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // RulerOptions.h : header file // @@ -31,7 +32,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 553e42c649..9b9be2c696 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/SaveMap.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SaveMap.h : header file // @@ -36,7 +37,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 8746d03995..998af495aa 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 3bebff4376..b18a6d978c 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 1b6c2cba68..c1194c96e8 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/SelectMacrotexture.h @@ -17,6 +17,7 @@ */ #pragma once +#include // SelectMacrotexture.h : header file // @@ -28,7 +29,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 a4b742afa2..f96e659e2c 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/ShadowOptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // ShadowOptions.h : header file // @@ -28,7 +29,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 95d4e713e7..e37b36f015 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TeamObjectProperties.h @@ -22,6 +22,7 @@ // (c) Electronic Arts 2003 #pragma once +#include #include "resource.h" @@ -35,7 +36,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 98349d4ef4..47a01cddcf 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/TerrainMaterial.h @@ -17,6 +17,7 @@ */ #pragma once +#include // terrainmaterial.h : header file // @@ -32,7 +33,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 e2f5f6cca1..0154e39278 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 dcb2b9ead4..e997529e2b 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 f67256a84f..351959a7ee 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/WBFrameWnd.h @@ -17,6 +17,7 @@ */ #pragma once +#include // WBFrameWnd.h : header file // @@ -41,8 +42,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 +71,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 c748ad6fe1..1dafc96d30 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 nullptr, 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 7d55f6c785..5a29ed8222 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 6934e7f6ba..bd7e745dae 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 90159d4c73..b57edef72d 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 5ee67174cc..6189ca5cf7 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 nullptr, 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 3ed7c35482..cf74b96a40 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 nullptr 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 88d7b0ad09..66d5e2775f 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 251eceee38..e9a737b8c1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/brushoptions.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/brushoptions.h @@ -17,6 +17,7 @@ */ #pragma once +#include // brushoptions.h : header file // @@ -37,7 +38,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 1e9d912fad..41d2821c29 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/euladialog.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/euladialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // euladialog.h : header file // @@ -28,7 +29,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 7494200872..8cdab83a94 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 37f4a3c9f4..f7dcb5e8cf 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 a6a1781381..d11141d745 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/propedit.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/propedit.h @@ -17,6 +17,7 @@ */ #pragma once +#include // propedit.h : header file // @@ -28,7 +29,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 ea4e3419f1..9f6fe5c9ec 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 60f9cdd642..661cdb774c 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 nullptr 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 95d71082e5..b3cde696d3 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 nullptr 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 31f7891263..1fe9c60f0a 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 6dc85eadc1..a6b5e6f9a3 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 7cbef8f854..1b667cc96b 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/BrushTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/BrushTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -46,8 +48,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 99ff8ccd63..8ba092b463 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 77e054a11f..5965a0217d 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 406793275f..de89b87293 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 9a5e47225c..dc69151fdf 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CameraOptions.cpp @@ -19,6 +19,8 @@ // CameraOptions.cpp : implementation file // +#include + #include "StdAfx.h" #include "resource.h" #include "WorldBuilder.h" @@ -34,7 +36,7 @@ // CameraOptions dialog -CameraOptions::CameraOptions(CWnd* pParent /*=NULL*/) +CameraOptions::CameraOptions(CWnd* pParent /*=nullptr*/) : CDialog(CameraOptions::IDD, pParent) { m_updating = false; @@ -94,8 +96,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 +109,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 07aded667c..35277afd30 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 dba345f508..a93020a5c1 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 b5b794ba00..4997b8a704 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 nullptr! 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 nullptr! 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 nullptr. 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 bae26db5da..bf44491834 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 6df3962f51..85cd400fb2 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 7176f65ce4..67bdbd4803 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 b0020a3f38..eb422984a6 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 4612838395..63f0d45f1c 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(), ("nullptr 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 94fb3dad93..1e9a6933c8 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 605fd766cf..0814e7f5a5 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 d1eb509c7c..227df71845 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 806d74b602..09a269a970 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 b50fbd0d40..7f74bd2140 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FeatherTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -42,9 +44,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 c49e0a24b6..f7f846bedb 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(), ("nullptr 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 339dd71c60..28e7920b3f 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 1bcc725ee7..30e00d5c72 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/FloodFillTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/FloodFillTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -40,7 +42,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 +68,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 31a8dbbc33..897d6326a6 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 7be64efb17..00c99ccb7f 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 753714f457..75e1afabe3 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 edd9ebd3e8..d6a8c1d98d 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 nullptr 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 6fbbe7267f..ee3a6de20d 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 8c45d2599c..f86005ddfa 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 c6ea342ee1..c4ef56b462 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 cd020a3b98..3c1b832903 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 7dd0407756..d97e2bfc42 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 08a9d1dcee..64acff467e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldTool.cpp @@ -20,6 +20,8 @@ // Terrain shaping tool for worldbuilder. // Author: John Ahlquist, Oct 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -41,7 +43,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 +97,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 +188,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 daf3d40e10..c996ece7d5 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 174395e4b6..dd77973daa 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/MoundTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/MoundTool.cpp @@ -20,6 +20,8 @@ // Texture tiling tool for worldbuilder. // Author: John Ahlquist, April 2001 +#include + #include "StdAfx.h" #include "resource.h" @@ -45,8 +47,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 d7f5918ed4..8633cf1e09 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 fc866e5ea6..5a7172d735 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 dc1dc5b7f5..7c56a45994 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(), ("nullptr 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 477a307a3a..ecbeace38e 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 bba4bb2003..c8ba5bbfab 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 9910154332..c003e493bd 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 d89ca14342..c9973f8146 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 480ede7b2e..0257f046a1 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(), ("nullptr 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 84704c37a0..42df76f43e 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 32d54a6793..b579c587f2 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 0971a77738..ef17f5624f 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RampOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RampOptions.cpp @@ -31,6 +31,7 @@ /* 4/23/2002 : Initial creation */ /*---------------------------------------------------------------------------*/ +#include #include "StdAfx.h" #include "RampOptions.h" @@ -48,7 +49,7 @@ RampOptions::RampOptions(CWnd* pParent) : COptionsPanel(RampOptions::IDD, pParen RampOptions::~RampOptions() { - TheRampOptions = NULL; + TheRampOptions = nullptr; } Bool RampOptions::shouldApplyTheRamp() @@ -79,7 +80,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 1c97fd6879..05fc0c78a3 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RampTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RampTool.cpp @@ -30,6 +30,9 @@ /* Revision History: */ /* 4/19/2002 : Initial creation */ /*---------------------------------------------------------------------------*/ + +#include + #include "StdAfx.h" #include "RampTool.h" @@ -83,7 +86,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 +102,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 +117,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 +166,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 769a02996c..f3c0d23d12 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 90e5f9d808..b9b083b54a 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 a8e0b2adf6..98ee923eb8 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 bb1a6dc8bf..5f1198fa67 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/RulerTool.cpp @@ -19,6 +19,8 @@ // RulerTool.cpp // Author: Mike Lytle, January 2003 +#include + #include "StdAfx.h" #include "resource.h" @@ -31,7 +33,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 +41,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 +55,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 +66,7 @@ void RulerTool::deactivate() { Tool::deactivate(); - if (m_View != NULL) { + if (m_View != nullptr) { m_View->doRulerFeedback(RULER_NONE); } @@ -82,7 +84,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 +101,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 +162,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 22e6a197c7..dd6ea4751f 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 dd802ca1cb..a1eb231b75 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 311897b00f..4b258bf395 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 f57862fcbf..1a7372564c 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; @@ -126,13 +126,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()); @@ -144,7 +144,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(); @@ -218,7 +218,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 250f6d5815..3d306ce6dc 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; @@ -126,13 +126,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()); @@ -144,7 +144,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(); @@ -218,7 +218,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 9588833516..69a5752e43 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; @@ -143,10 +143,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); @@ -154,15 +154,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; @@ -186,8 +186,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(); @@ -232,7 +232,7 @@ void ScriptConditionsDlg::OnOr() m_script->setOrCondition(pOr); } loadList(); - setSel(pOr, NULL); + setSel(pOr, nullptr); } void ScriptConditionsDlg::OnNew() @@ -246,7 +246,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); @@ -290,7 +290,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); @@ -306,7 +306,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(); @@ -326,9 +326,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(); @@ -356,14 +356,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 c45f8ef396..e98375ed77 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 a6d0c4c773..4f5cda9d1d 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 b5a2d134a2..9bb7546994 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 d900c87204..bcd9904259 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 f3caf2281e..ba08c55981 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 d577f9c7a9..77f2a89f60 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 4f11bd2674..0ecee530b2 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 nullptr")); 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 nullptr")); 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 5582a7bbac..ac5045b099 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 1d2c46b312..3ba4c7d028 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 ad41eebdd3..e27851b0b9 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 4c2be616c0..8ccf017328 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 4ad1b4353f..d0d75ccfd2 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 b629522442..878a03f190 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 be5ce2158b..9f0d9218dd 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 fb744e422c..a09aa84437 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 nullptr!")); 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 186fbd80e7..a5b132a310 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 nullptr 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 d69fce7bd9..b49edde496 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 d2fb28cf31..f1c22892fe 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 cf0000da9a..e2619e2076 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 72a2506c65..fa6b63185e 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 ba2930f30a..675485c5cf 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 nullptr. 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 nullptr, 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 dae135ea3e..91121c61a0 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 nullptr 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 2f9c4a74bc..880f70a412 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 21e6149dc0..f1ca63b41b 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 f8c50586f1..357786b627 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 2b0bab8720..b7ca0e199e 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-nullptr 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 a7e33d0ab9..d53ac17c20 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 17a197dd83..98ec4a7f1b 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 c0e65b35e2..5796898fd7 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 c33edb6fee..5a73e77471 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 a434d48516..6ff9215099 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 07e3f616b9..da1f643d88 100644 --- a/GeneralsMD/Code/Tools/wdump/FindDialog.h +++ b/GeneralsMD/Code/Tools/wdump/FindDialog.h @@ -17,6 +17,7 @@ */ #pragma once +#include // FindDialog.h : header file // @@ -31,7 +32,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 +41,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 9480b5ae11..1f645f923e 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 6e551ac90b..cad76b4947 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; } @@ -268,7 +268,7 @@ int RawFileMClass::Open(int rights) ** For the case of the file cannot be found, then allow a retry. All other cases ** are fatal. */ - if (Handle == NULL_HANDLE) { + if (Handle == nullptr) { return(false); // Error(GetLastError(), false, Filename); @@ -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,8 +326,8 @@ bool RawFileMClass::Is_Available(int forced) for (;;) { Handle = CreateFileA(Filename, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (Handle == NULL_HANDLE) { + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + if (Handle == nullptr) { return(false); } break; @@ -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 9edd63a6a8..7c1a907f07 100644 --- a/GeneralsMD/Code/Tools/wdump/rawfilem.h +++ b/GeneralsMD/Code/Tools/wdump/rawfilem.h @@ -39,6 +39,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #pragma once +#include #include #include @@ -160,7 +161,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 +227,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 nullptr. * * * * 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 +295,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 0e5044b723..2b4308c32c 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 e15f38eee4..a7e720b9e7 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 b1d112364f..55dee7370b 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 6e704fdcc5..3eeb0afd76 100644 --- a/GeneralsMD/Code/Tools/wdump/wdump.cpp +++ b/GeneralsMD/Code/Tools/wdump/wdump.cpp @@ -19,6 +19,7 @@ // wdump.cpp : Defines the class behaviors for the application. // +#include #include "stdafx.h" #include "wdump.h" @@ -35,10 +36,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 +65,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 +147,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 +159,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 +180,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 +203,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 c5f276b287..2a8c35a73d 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); }