diff --git a/Code/Legacy/CryCommon/IConsole.h b/Code/Legacy/CryCommon/IConsole.h index f68a82f9dc..b99d4c84b9 100644 --- a/Code/Legacy/CryCommon/IConsole.h +++ b/Code/Legacy/CryCommon/IConsole.h @@ -84,7 +84,7 @@ enum EVarFlags struct ICVarDumpSink { // - virtual ~ICVarDumpSink(){} + virtual ~ICVarDumpSink()= default; virtual void OnElementFound(ICVar* pCVar) = 0; // }; @@ -92,7 +92,7 @@ struct ICVarDumpSink struct IKeyBindDumpSink { // - virtual ~IKeyBindDumpSink(){} + virtual ~IKeyBindDumpSink()= default; virtual void OnKeyBindFound(const char* sBind, const char* sCommand) = 0; // }; @@ -100,7 +100,7 @@ struct IKeyBindDumpSink struct IOutputPrintSink { // - virtual ~IOutputPrintSink(){} + virtual ~IOutputPrintSink()= default; virtual void Print(const char* inszText) = 0; // }; @@ -109,7 +109,7 @@ struct IOutputPrintSink struct IConsoleVarSink { // - virtual ~IConsoleVarSink(){} + virtual ~IConsoleVarSink()= default; // Called by Console before changing console var value, to validate if var can be changed. // Return value: true if ok to change value, false if should not change value. virtual bool OnBeforeVarChange(ICVar* pVar, const char* sNewValue) = 0; @@ -122,7 +122,7 @@ struct IConsoleVarSink struct IConsoleCmdArgs { // - virtual ~IConsoleCmdArgs(){} + virtual ~IConsoleCmdArgs()= default; // Gets number of arguments supplied to the command (including the command itself) virtual int GetArgCount() const = 0; // Gets argument by index, nIndex must be in 0 <= nIndex < GetArgCount() @@ -136,7 +136,7 @@ struct IConsoleCmdArgs struct IConsoleArgumentAutoComplete { // - virtual ~IConsoleArgumentAutoComplete(){} + virtual ~IConsoleArgumentAutoComplete()= default; // Gets number of matches for the argument to auto complete. virtual int GetCount() const = 0; // Gets argument value by index, nIndex must be in 0 <= nIndex < GetCount() @@ -145,10 +145,10 @@ struct IConsoleArgumentAutoComplete }; // This a definition of the console command function that can be added to console with AddCommand. -typedef void (* ConsoleCommandFunc)(IConsoleCmdArgs*); +using ConsoleCommandFunc = void (*)(IConsoleCmdArgs*); // This a definition of the callback function that is called when variable change. -typedef void (* ConsoleVarFunc)(ICVar*); +using ConsoleVarFunc = void (*)(ICVar*); /* Summary: Interface to the engine console. @@ -165,7 +165,7 @@ typedef void (* ConsoleVarFunc)(ICVar*); struct IConsole { // - virtual ~IConsole(){} + virtual ~IConsole()= default; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Deletes the console virtual void Release() = 0; @@ -182,7 +182,7 @@ struct IConsole // help - help text that is shown when you use ? in the console // Return: // pointer to the interface ICVar - virtual ICVar* RegisterString(const char* sName, const char* sValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = 0) = 0; + virtual ICVar* RegisterString(const char* sName, const char* sValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr) = 0; // Create a new console variable that store the value in a int // Arguments: // sName - console variable name @@ -191,7 +191,7 @@ struct IConsole // help - help text that is shown when you use ? in the console // Return: // pointer to the interface ICVar - virtual ICVar* RegisterInt(const char* sName, int iValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = 0) = 0; + virtual ICVar* RegisterInt(const char* sName, int iValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr) = 0; // Create a new console variable that store the value in a int64 // Arguments: // sName - console variable name @@ -200,7 +200,7 @@ struct IConsole // help - help text that is shown when you use ? in the console // Return: // pointer to the interface ICVar - virtual ICVar* RegisterInt64(const char* sName, int64 iValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = 0) = 0; + virtual ICVar* RegisterInt64(const char* sName, int64 iValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr) = 0; // Create a new console variable that store the value in a float // Arguments: // sName - console variable name @@ -209,7 +209,7 @@ struct IConsole // help - help text that is shown when you use ? in the console // Return: // pointer to the interface ICVar - virtual ICVar* RegisterFloat(const char* sName, float fValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = 0) = 0; + virtual ICVar* RegisterFloat(const char* sName, float fValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr) = 0; // Create a new console variable that will update the user defined float // Arguments: @@ -220,7 +220,7 @@ struct IConsole // allowModify - allow modification through config vars, prevents missing modifications in release mode // Return: // pointer to the interface ICVar - virtual ICVar* Register(const char* name, float* src, float defaultvalue, int nFlags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true) = 0; + virtual ICVar* Register(const char* name, float* src, float defaultvalue, int nFlags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr, bool allowModify = true) = 0; // Create a new console variable that will update the user defined integer // Arguments: // sName - console variable name @@ -230,7 +230,7 @@ struct IConsole // allowModify - allow modification through config vars, prevents missing modifications in release mode // Return: // pointer to the interface ICVar - virtual ICVar* Register(const char* name, int* src, int defaultvalue, int nFlags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true) = 0; + virtual ICVar* Register(const char* name, int* src, int defaultvalue, int nFlags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr, bool allowModify = true) = 0; // Create a new console variable that will update the user defined pointer to null terminated string // Arguments: @@ -241,7 +241,7 @@ struct IConsole // allowModify - allow modification through config vars, prevents missing modifications in release mode // Return: // pointer to the interface ICVar - virtual ICVar* Register(const char* name, const char** src, const char* defaultvalue, int nFlags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true) = 0; + virtual ICVar* Register(const char* name, const char** src, const char* defaultvalue, int nFlags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr, bool allowModify = true) = 0; // Registers an existing console variable // Should only be used with static duration objects, object is never freed @@ -367,7 +367,7 @@ struct IConsole // sHelp - Help string, will be displayed when typing in console "command ?". // Return // True if successful, false otherwise. - virtual bool AddCommand(const char* sCommand, ConsoleCommandFunc func, int nFlags = 0, const char* sHelp = NULL) = 0; + virtual bool AddCommand(const char* sCommand, ConsoleCommandFunc func, int nFlags = 0, const char* sHelp = nullptr) = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Description: @@ -382,7 +382,7 @@ struct IConsole // Return // True if successful, false otherwise. //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - virtual bool AddCommand(const char* sName, const char* sScriptFunc, int nFlags = 0, const char* sHelp = NULL) = 0; + virtual bool AddCommand(const char* sName, const char* sScriptFunc, int nFlags = 0, const char* sHelp = nullptr) = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Description: @@ -421,7 +421,7 @@ struct IConsole // szPrefix - 0 or prefix e.g. "sys_spec_" // Return // used size - virtual size_t GetSortedVars(AZStd::vector& pszArray, const char* szPrefix = 0) = 0; + virtual size_t GetSortedVars(AZStd::vector& pszArray, const char* szPrefix = nullptr) = 0; virtual const char* AutoComplete(const char* substr) = 0; virtual const char* AutoCompletePrev(const char* substr) = 0; virtual const char* ProcessCompletion(const char* szInputBuffer) = 0; @@ -488,7 +488,7 @@ struct IConsole // This interface for the remote console struct IRemoteConsoleListener { - virtual ~IRemoteConsoleListener() {} + virtual ~IRemoteConsoleListener() = default; virtual void OnConsoleCommand([[maybe_unused]] const char* cmd) {}; virtual void OnGameplayCommand([[maybe_unused]] const char* cmd) {}; @@ -496,7 +496,7 @@ struct IRemoteConsoleListener struct IRemoteConsole { - virtual ~IRemoteConsole() {}; + virtual ~IRemoteConsole() = default;; virtual void RegisterConsoleVariables() = 0; virtual void UnregisterConsoleVariables() = 0; @@ -535,7 +535,7 @@ struct ICVar // // TODO make protected; - virtual ~ICVar() {} + virtual ~ICVar() = default; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // delete the variable // NOTE: the variable will automatically unregister itself from the console diff --git a/Code/Legacy/CryCommon/ILocalizationManager.h b/Code/Legacy/CryCommon/ILocalizationManager.h index 0f0ba88250..8646906dfe 100644 --- a/Code/Legacy/CryCommon/ILocalizationManager.h +++ b/Code/Legacy/CryCommon/ILocalizationManager.h @@ -28,7 +28,7 @@ class XmlNodeRef; struct SLocalizedInfoGame { SLocalizedInfoGame () - : szCharacterName(NULL) + : szCharacterName(nullptr) , bUseSubtitle(false) { } @@ -54,15 +54,15 @@ struct SLocalizedSoundInfoGame : public SLocalizedInfoGame { SLocalizedSoundInfoGame() - : sSoundEvent(NULL) + : sSoundEvent(nullptr) , fVolume(0.f) , fRadioRatio (0.f) , bIsDirectRadio(false) , bIsIntercepted(false) , nNumSoundMoods(0) - , pSoundMoods (NULL) + , pSoundMoods (nullptr) , nNumEventParameters(0) - , pEventParameters(NULL) + , pEventParameters(nullptr) { } @@ -86,10 +86,10 @@ struct SLocalizedInfoEditor : public SLocalizedInfoGame { SLocalizedInfoEditor() - : sKey(NULL) - , sOriginalCharacterName(NULL) - , sOriginalActorLine(NULL) - , sUtf8TranslatedActorLine(NULL) + : sKey(nullptr) + , sOriginalCharacterName(nullptr) + , sOriginalActorLine(nullptr) + , sUtf8TranslatedActorLine(nullptr) , nRow(0) { } @@ -137,21 +137,21 @@ struct ILocalizationManager ePILID_MAX_OR_INVALID, //Not a language, denotes the maximum number of languages or an unknown language }; - typedef uint32 TLocalizationBitfield; + using TLocalizationBitfield = uint32; // - virtual ~ILocalizationManager(){} + virtual ~ILocalizationManager()= default; virtual const char* LangNameFromPILID(const ILocalizationManager::EPlatformIndependentLanguageID id) = 0; virtual ILocalizationManager::EPlatformIndependentLanguageID PILIDFromLangName(AZStd::string langName) = 0; virtual ILocalizationManager::EPlatformIndependentLanguageID GetSystemLanguage() { return ILocalizationManager::EPlatformIndependentLanguageID::ePILID_English_US; } virtual ILocalizationManager::TLocalizationBitfield MaskSystemLanguagesFromSupportedLocalizations(const ILocalizationManager::TLocalizationBitfield systemLanguages) = 0; virtual ILocalizationManager::TLocalizationBitfield IsLanguageSupported(const ILocalizationManager::EPlatformIndependentLanguageID id) = 0; - virtual bool SetLanguage([[maybe_unused]] const char* sLanguage) override { return false; } - virtual const char* GetLanguage() override { return nullptr; } + bool SetLanguage([[maybe_unused]] const char* sLanguage) override { return false; } + const char* GetLanguage() override { return nullptr; } - virtual int GetLocalizationFormat() const { return -1; } - virtual AZStd::string GetLocalizedSubtitleFilePath([[maybe_unused]] const AZStd::string& localVideoPath, [[maybe_unused]] const AZStd::string& subtitleFileExtension) const { return ""; } - virtual AZStd::string GetLocalizedLocXMLFilePath([[maybe_unused]] const AZStd::string& localXmlPath) const { return ""; } + int GetLocalizationFormat() const override { return -1; } + AZStd::string GetLocalizedSubtitleFilePath([[maybe_unused]] const AZStd::string& localVideoPath, [[maybe_unused]] const AZStd::string& subtitleFileExtension) const override { return ""; } + AZStd::string GetLocalizedLocXMLFilePath([[maybe_unused]] const AZStd::string& localXmlPath) const override { return ""; } // load the descriptor file with tag information virtual bool InitLocalizationData(const char* sFileName, bool bReload = false) = 0; // request to load loca data by tag. Actual loading will happen during next level load begin event. @@ -161,8 +161,8 @@ struct ILocalizationManager virtual bool ReleaseLocalizationDataByTag(const char* sTag) = 0; virtual bool LoadAllLocalizationData(bool bReload = false) = 0; - virtual bool LoadExcelXmlSpreadsheet([[maybe_unused]] const char* sFileName, [[maybe_unused]] bool bReload = false) override { return false; } - virtual void ReloadData() override {}; + bool LoadExcelXmlSpreadsheet([[maybe_unused]] const char* sFileName, [[maybe_unused]] bool bReload = false) override { return false; } + void ReloadData() override {}; // Summary: // Free localization data. @@ -178,15 +178,15 @@ struct ILocalizationManager // bEnglish - if true, translates the string into the always present English language. // Returns: // true if localization was successful, false otherwise - virtual bool LocalizeString_ch([[maybe_unused]] const char* sString, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; } + bool LocalizeString_ch([[maybe_unused]] const char* sString, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; } // Summary: // Same as LocalizeString( const char* sString, AZStd::string& outLocalizedString, bool bEnglish=false ) // but at the moment this is faster. - virtual bool LocalizeString_s([[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; } + bool LocalizeString_s([[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; } // Summary: - virtual void LocalizeAndSubstituteInternal([[maybe_unused]] AZStd::string& locString, [[maybe_unused]] const AZStd::vector& keys, [[maybe_unused]] const AZStd::vector& values) override {} + void LocalizeAndSubstituteInternal([[maybe_unused]] AZStd::string& locString, [[maybe_unused]] const AZStd::vector& keys, [[maybe_unused]] const AZStd::vector& values) override {} // Return the localized version corresponding to a label. // Description: // A label has to start with '@' sign. @@ -196,7 +196,7 @@ struct ILocalizationManager // bEnglish - if true, returns the always present English version of the label. // Returns: // True if localization was successful, false otherwise. - virtual bool LocalizeLabel([[maybe_unused]] const char* sLabel, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; } + bool LocalizeLabel([[maybe_unused]] const char* sLabel, [[maybe_unused]] AZStd::string& outLocalizedString, [[maybe_unused]] bool bEnglish = false) override { return false; } virtual bool IsLocalizedInfoFound([[maybe_unused]] const char* sKey) { return false; } // Summary: @@ -224,7 +224,7 @@ struct ILocalizationManager // Summary: // Return number of localization entries. - virtual int GetLocalizedStringCount() override { return -1; } + int GetLocalizedStringCount() override { return -1; } // Summary: // Get the localization info structure at index nIndex. @@ -251,7 +251,7 @@ struct ILocalizationManager // sLocalizedString - Corresponding english language string. // Returns: // True if successful, false otherwise (key not found). - virtual bool GetEnglishString([[maybe_unused]] const char* sKey, [[maybe_unused]] AZStd::string& sLocalizedString) override { return false; } + bool GetEnglishString([[maybe_unused]] const char* sKey, [[maybe_unused]] AZStd::string& sLocalizedString) override { return false; } // Summary: // Get Subtitle for Key or Label . @@ -261,25 +261,25 @@ struct ILocalizationManager // bForceSubtitle - If true, get subtitle (sLocalized or sEnglish) even if not specified in Data file. // Returns: // True if subtitle found (and outSubtitle filled in), false otherwise. - virtual bool GetSubtitle([[maybe_unused]] const char* sKeyOrLabel, [[maybe_unused]] AZStd::string& outSubtitle, [[maybe_unused]] bool bForceSubtitle = false) override { return false; } + bool GetSubtitle([[maybe_unused]] const char* sKeyOrLabel, [[maybe_unused]] AZStd::string& outSubtitle, [[maybe_unused]] bool bForceSubtitle = false) override { return false; } // Description: // These methods format outString depending on sString with ordered arguments // FormatStringMessage(outString, "This is %2 and this is %1", "second", "first"); // Arguments: // outString - This is first and this is second. - virtual void FormatStringMessage_List([[maybe_unused]] AZStd::string& outString, [[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] const char** sParams, [[maybe_unused]] int nParams) override {} - virtual void FormatStringMessage([[maybe_unused]] AZStd::string& outString, [[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] const char* param1, [[maybe_unused]] const char* param2 = 0, [[maybe_unused]] const char* param3 = 0, [[maybe_unused]] const char* param4 = 0) override {} + void FormatStringMessage_List([[maybe_unused]] AZStd::string& outString, [[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] const char** sParams, [[maybe_unused]] int nParams) override {} + void FormatStringMessage([[maybe_unused]] AZStd::string& outString, [[maybe_unused]] const AZStd::string& sString, [[maybe_unused]] const char* param1, [[maybe_unused]] const char* param2 = nullptr, [[maybe_unused]] const char* param3 = nullptr, [[maybe_unused]] const char* param4 = nullptr) override {} - virtual void LocalizeTime([[maybe_unused]] time_t t, [[maybe_unused]] bool bMakeLocalTime, [[maybe_unused]] bool bShowSeconds, [[maybe_unused]] AZStd::string& outTimeString) override {} - virtual void LocalizeDate([[maybe_unused]] time_t t, [[maybe_unused]] bool bMakeLocalTime, [[maybe_unused]] bool bShort, [[maybe_unused]] bool bIncludeWeekday, [[maybe_unused]] AZStd::string& outDateString) override {} - virtual void LocalizeDuration([[maybe_unused]] int seconds, [[maybe_unused]] AZStd::string& outDurationString) override {} - virtual void LocalizeNumber([[maybe_unused]] int number, [[maybe_unused]] AZStd::string& outNumberString) override {} - virtual void LocalizeNumber_Decimal([[maybe_unused]] float number, [[maybe_unused]] int decimals, [[maybe_unused]] AZStd::string& outNumberString) override {} + void LocalizeTime([[maybe_unused]] time_t t, [[maybe_unused]] bool bMakeLocalTime, [[maybe_unused]] bool bShowSeconds, [[maybe_unused]] AZStd::string& outTimeString) override {} + void LocalizeDate([[maybe_unused]] time_t t, [[maybe_unused]] bool bMakeLocalTime, [[maybe_unused]] bool bShort, [[maybe_unused]] bool bIncludeWeekday, [[maybe_unused]] AZStd::string& outDateString) override {} + void LocalizeDuration([[maybe_unused]] int seconds, [[maybe_unused]] AZStd::string& outDurationString) override {} + void LocalizeNumber([[maybe_unused]] int number, [[maybe_unused]] AZStd::string& outNumberString) override {} + void LocalizeNumber_Decimal([[maybe_unused]] float number, [[maybe_unused]] int decimals, [[maybe_unused]] AZStd::string& outNumberString) override {} // Summary: // Returns true if the project has localization configured for use, false otherwise. - virtual bool ProjectUsesLocalization() const override { return false; } + bool ProjectUsesLocalization() const override { return false; } // static ILINE TLocalizationBitfield LocalizationBitfieldFromPILID(EPlatformIndependentLanguageID pilid) diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.h b/Code/Legacy/CrySystem/LocalizedStringManager.h index 1fba05f9ac..c0a57fd93f 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.h +++ b/Code/Legacy/CrySystem/LocalizedStringManager.h @@ -27,7 +27,7 @@ class CLocalizedStringsManager , public ISystemEventListener { public: - typedef std::vector TLocalizationTagVec; + using TLocalizationTagVec = std::vector; constexpr const static size_t LOADING_FIXED_STRING_LENGTH = 2048; constexpr const static size_t COMPRESSION_FIXED_BUFFER_LENGTH = 6144; @@ -36,45 +36,45 @@ public: virtual ~CLocalizedStringsManager(); // ILocalizationManager - const char* LangNameFromPILID(const ILocalizationManager::EPlatformIndependentLanguageID id); + const char* LangNameFromPILID(const ILocalizationManager::EPlatformIndependentLanguageID id) override; ILocalizationManager::EPlatformIndependentLanguageID PILIDFromLangName(AZStd::string langName) override; ILocalizationManager::EPlatformIndependentLanguageID GetSystemLanguage() override; - ILocalizationManager::TLocalizationBitfield MaskSystemLanguagesFromSupportedLocalizations(const ILocalizationManager::TLocalizationBitfield systemLanguages); - ILocalizationManager::TLocalizationBitfield IsLanguageSupported(const ILocalizationManager::EPlatformIndependentLanguageID id); + ILocalizationManager::TLocalizationBitfield MaskSystemLanguagesFromSupportedLocalizations(const ILocalizationManager::TLocalizationBitfield systemLanguages) override; + ILocalizationManager::TLocalizationBitfield IsLanguageSupported(const ILocalizationManager::EPlatformIndependentLanguageID id) override; const char* GetLanguage() override; bool SetLanguage(const char* sLanguage) override; int GetLocalizationFormat() const override; - virtual AZStd::string GetLocalizedSubtitleFilePath(const AZStd::string& localVideoPath, const AZStd::string& subtitleFileExtension) const override; - virtual AZStd::string GetLocalizedLocXMLFilePath(const AZStd::string& localXmlPath) const override; - bool InitLocalizationData(const char* sFileName, bool bReload = false); - bool RequestLoadLocalizationDataByTag(const char* sTag); - bool LoadLocalizationDataByTag(const char* sTag, bool bReload = false); - bool ReleaseLocalizationDataByTag(const char* sTag); + AZStd::string GetLocalizedSubtitleFilePath(const AZStd::string& localVideoPath, const AZStd::string& subtitleFileExtension) const override; + AZStd::string GetLocalizedLocXMLFilePath(const AZStd::string& localXmlPath) const override; + bool InitLocalizationData(const char* sFileName, bool bReload = false) override; + bool RequestLoadLocalizationDataByTag(const char* sTag) override; + bool LoadLocalizationDataByTag(const char* sTag, bool bReload = false) override; + bool ReleaseLocalizationDataByTag(const char* sTag) override; bool LoadAllLocalizationData(bool bReload = false) override; bool LoadExcelXmlSpreadsheet(const char* sFileName, bool bReload = false) override; void ReloadData() override; - void FreeData(); + void FreeData() override; bool LocalizeString_s(const AZStd::string& sString, AZStd::string& outLocalizedString, bool bEnglish = false) override; bool LocalizeString_ch(const char* sString, AZStd::string& outLocalizedString, bool bEnglish = false) override; void LocalizeAndSubstituteInternal(AZStd::string& locString, const AZStd::vector& keys, const AZStd::vector& values) override; bool LocalizeLabel(const char* sLabel, AZStd::string& outLocalizedString, bool bEnglish = false) override; - bool IsLocalizedInfoFound(const char* sKey); - bool GetLocalizedInfoByKey(const char* sKey, SLocalizedInfoGame& outGameInfo); - bool GetLocalizedInfoByKey(const char* sKey, SLocalizedSoundInfoGame* pOutSoundInfoGame); - int GetLocalizedStringCount(); - bool GetLocalizedInfoByIndex(int nIndex, SLocalizedInfoGame& outGameInfo); - bool GetLocalizedInfoByIndex(int nIndex, SLocalizedInfoEditor& outEditorInfo); + bool IsLocalizedInfoFound(const char* sKey) override; + bool GetLocalizedInfoByKey(const char* sKey, SLocalizedInfoGame& outGameInfo) override; + bool GetLocalizedInfoByKey(const char* sKey, SLocalizedSoundInfoGame* pOutSoundInfoGame) override; + int GetLocalizedStringCount() override; + bool GetLocalizedInfoByIndex(int nIndex, SLocalizedInfoGame& outGameInfo) override; + bool GetLocalizedInfoByIndex(int nIndex, SLocalizedInfoEditor& outEditorInfo) override; bool GetEnglishString(const char* sKey, AZStd::string& sLocalizedString) override; bool GetSubtitle(const char* sKeyOrLabel, AZStd::string& outSubtitle, bool bForceSubtitle = false) override; void FormatStringMessage_List(AZStd::string& outString, const AZStd::string& sString, const char** sParams, int nParams) override; - void FormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2 = 0, const char* param3 = 0, const char* param4 = 0) override; + void FormatStringMessage(AZStd::string& outString, const AZStd::string& sString, const char* param1, const char* param2 = nullptr, const char* param3 = nullptr, const char* param4 = nullptr) override; void LocalizeTime(time_t t, bool bMakeLocalTime, bool bShowSeconds, AZStd::string& outTimeString) override; void LocalizeDate(time_t t, bool bMakeLocalTime, bool bShort, bool bIncludeWeekday, AZStd::string& outDateString) override; @@ -86,7 +86,7 @@ public: // ~ILocalizationManager // ISystemEventManager - void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam); + void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override; // ~ISystemEventManager int GetMemoryUsage(ICrySizer* pSizer); @@ -100,7 +100,7 @@ private: bool LocalizeStringInternal(const char* pStr, size_t len, AZStd::string& outLocalizedString, bool bEnglish); bool DoLoadExcelXmlSpreadsheet(const char* sFileName, uint8 tagID, bool bReload); - typedef bool(CLocalizedStringsManager::*LoadFunc)(const char*, uint8, bool); + using LoadFunc = bool(CLocalizedStringsManager::*)(const char*, uint8, bool); bool DoLoadAGSXmlDocument(const char* sFileName, uint8 tagID, bool bReload); LoadFunc GetLoadFunction() const; @@ -176,9 +176,9 @@ private: SLocalizedStringEntry() : flags(0) , huffmanTreeIndex(-1) - , pEditorExtension(NULL) + , pEditorExtension(nullptr) { - TranslatedText.psUtf8Uncompressed = NULL; + TranslatedText.psUtf8Uncompressed = nullptr; }; ~SLocalizedStringEntry() { @@ -201,7 +201,7 @@ private: pSizer->AddObject(sCharacterName); - if ((flags & IS_COMPRESSED) == 0 && TranslatedText.psUtf8Uncompressed != NULL) //Number of bytes stored for compressed text is unknown, which throws this GetMemoryUsage off + if ((flags & IS_COMPRESSED) == 0 && TranslatedText.psUtf8Uncompressed != nullptr) //Number of bytes stored for compressed text is unknown, which throws this GetMemoryUsage off { pSizer->AddObject(*TranslatedText.psUtf8Uncompressed); } @@ -211,7 +211,7 @@ private: pSizer->AddObject(SoundMoods); pSizer->AddObject(EventParameters); - if (pEditorExtension != NULL) + if (pEditorExtension != nullptr) { pEditorExtension->GetMemoryUsage(pSizer); } @@ -219,12 +219,12 @@ private: }; //Keys as CRC32. Strings previously, but these proved too large - typedef VectorMap StringsKeyMap; + using StringsKeyMap = VectorMap; struct SLanguage { - typedef std::vector TLocalizedStringEntries; - typedef std::vector THuffmanCoders; + using TLocalizedStringEntries = std::vector; + using THuffmanCoders = std::vector; AZStd::string sLanguage; StringsKeyMap m_keysMap; @@ -268,27 +268,27 @@ private: SLanguage* m_pLanguage; // all loaded Localization Files - typedef std::pair pairFileName; - typedef std::map tmapFilenames; + using pairFileName = std::pair; + using tmapFilenames = std::map; tmapFilenames m_loadedTables; // filenames per tag - typedef std::vector TStringVec; + using TStringVec = std::vector; struct STag { TStringVec filenames; uint8 id; bool loaded; }; - typedef std::map TTagFileNames; + using TTagFileNames = std::map; TTagFileNames m_tagFileNames; TStringVec m_tagLoadRequests; // Array of loaded languages. std::vector m_languages; - typedef std::set PrototypeSoundEvents; + using PrototypeSoundEvents = std::set; PrototypeSoundEvents m_prototypeEvents; // this set is purely used for clever string/string assigning to save memory struct less_strcmp @@ -299,7 +299,7 @@ private: } }; - typedef std::set CharacterNameSet; + using CharacterNameSet = std::set; CharacterNameSet m_characterNameSet; // this set is purely used for clever string/string assigning to save memory // CVARs @@ -312,5 +312,5 @@ private: //Lock for mutable AZStd::mutex m_cs; - typedef AZStd::lock_guard AutoLock; + using AutoLock = AZStd::lock_guard; }; diff --git a/Code/Legacy/CrySystem/System.h b/Code/Legacy/CrySystem/System.h index 738ffd4bfb..3244143cdf 100644 --- a/Code/Legacy/CrySystem/System.h +++ b/Code/Legacy/CrySystem/System.h @@ -159,7 +159,7 @@ class CWatchdogThread; #endif #ifdef WIN32 -typedef void* WIN_HMODULE; +using WIN_HMODULE = void*; #else typedef void* WIN_HMODULE; #endif @@ -174,7 +174,7 @@ struct IDataProbe; #define PHSYICS_OBJECT_ENTITY 0 -typedef void (__cdecl * VTuneFunction)(void); +using VTuneFunction = void (__cdecl *)(void); extern VTuneFunction VTResume; extern VTuneFunction VTPause; @@ -246,10 +246,10 @@ struct CProfilingSystem // Summary: // Resumes vtune data collection. - virtual void VTuneResume(); + void VTuneResume() override; // Summary: // Pauses vtune data collection. - virtual void VTunePause(); + void VTunePause() override; ////////////////////////////////////////////////////////////////////////// }; @@ -286,105 +286,105 @@ public: // interface ILoadConfigurationEntrySink ---------------------------------- - virtual void OnLoadConfigurationEntry(const char* szKey, const char* szValue, const char* szGroup); + void OnLoadConfigurationEntry(const char* szKey, const char* szValue, const char* szGroup) override; // ISystemEventListener - virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam); + void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override; /////////////////////////////////////////////////////////////////////////// //! @name ISystem implementation //@{ virtual bool Init(const SSystemInitParams& startupParams); - virtual void Release(); + void Release() override; - virtual SSystemGlobalEnvironment* GetGlobalEnvironment() { return &m_env; } + SSystemGlobalEnvironment* GetGlobalEnvironment() override { return &m_env; } - virtual bool UpdatePreTickBus(int updateFlags = 0, int nPauseMode = 0); - virtual bool UpdatePostTickBus(int updateFlags = 0, int nPauseMode = 0); - virtual bool UpdateLoadtime(); + bool UpdatePreTickBus(int updateFlags = 0, int nPauseMode = 0) override; + bool UpdatePostTickBus(int updateFlags = 0, int nPauseMode = 0) override; + bool UpdateLoadtime() override; //////////////////////////////////////////////////////////////////////// // CrySystemRequestBus interface implementation ISystem* GetCrySystem() override; //////////////////////////////////////////////////////////////////////// - void Relaunch(bool bRelaunch); - bool IsRelaunch() const { return m_bRelaunch; }; + void Relaunch(bool bRelaunch) override; + bool IsRelaunch() const override { return m_bRelaunch; }; - void SerializingFile(int mode) { m_iLoadingMode = mode; } - int IsSerializingFile() const { return m_iLoadingMode; } - void Quit(); - bool IsQuitting() const; + void SerializingFile(int mode) override { m_iLoadingMode = mode; } + int IsSerializingFile() const override { return m_iLoadingMode; } + void Quit() override; + bool IsQuitting() const override; void ShutdownFileSystem(); // used to cleanup any file resources, such as cache handle. void SetAffinity(); - virtual const char* GetUserName(); - virtual int GetApplicationInstance(); + const char* GetUserName() override; + int GetApplicationInstance() override; int GetApplicationLogInstance(const char* logFilePath) override; - ITimer* GetITimer(){ return m_env.pTimer; } - AZ::IO::IArchive* GetIPak() { return m_env.pCryPak; }; - IConsole* GetIConsole() { return m_env.pConsole; }; - IRemoteConsole* GetIRemoteConsole(); - IMovieSystem* GetIMovieSystem() { return m_env.pMovieSystem; }; - ICryFont* GetICryFont(){ return m_env.pCryFont; } - ILog* GetILog(){ return m_env.pLog; } - ICmdLine* GetICmdLine(){ return m_pCmdLine; } - IViewSystem* GetIViewSystem(); - ILevelSystem* GetILevelSystem(); - ISystemEventDispatcher* GetISystemEventDispatcher() { return m_pSystemEventDispatcher; } - IProfilingSystem* GetIProfilingSystem() { return &m_ProfilingSystem; } + ITimer* GetITimer() override{ return m_env.pTimer; } + AZ::IO::IArchive* GetIPak() override { return m_env.pCryPak; }; + IConsole* GetIConsole() override { return m_env.pConsole; }; + IRemoteConsole* GetIRemoteConsole() override; + IMovieSystem* GetIMovieSystem() override { return m_env.pMovieSystem; }; + ICryFont* GetICryFont() override{ return m_env.pCryFont; } + ILog* GetILog() override{ return m_env.pLog; } + ICmdLine* GetICmdLine() override{ return m_pCmdLine; } + IViewSystem* GetIViewSystem() override; + ILevelSystem* GetILevelSystem() override; + ISystemEventDispatcher* GetISystemEventDispatcher() override { return m_pSystemEventDispatcher; } + IProfilingSystem* GetIProfilingSystem() override { return &m_ProfilingSystem; } ////////////////////////////////////////////////////////////////////////// // retrieves the perlin noise singleton instance - CPNoise3* GetNoiseGen(); - virtual uint64 GetUpdateCounter() { return m_nUpdateCounter; }; + CPNoise3* GetNoiseGen() override; + uint64 GetUpdateCounter() override { return m_nUpdateCounter; }; void DetectGameFolderAccessRights(); - virtual void ExecuteCommandLine(bool deferred=true); + void ExecuteCommandLine(bool deferred=true) override; - virtual void GetUpdateStats(SSystemUpdateStats& stats); + void GetUpdateStats(SSystemUpdateStats& stats) override; ////////////////////////////////////////////////////////////////////////// - virtual XmlNodeRef CreateXmlNode(const char* sNodeName = "", bool bReuseStrings = false, bool bIsProcessingInstruction = false); - virtual XmlNodeRef LoadXmlFromFile(const char* sFilename, bool bReuseStrings = false); - virtual XmlNodeRef LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings = false, bool bSuppressWarnings = false); - virtual IXmlUtils* GetXmlUtils(); + XmlNodeRef CreateXmlNode(const char* sNodeName = "", bool bReuseStrings = false, bool bIsProcessingInstruction = false) override; + XmlNodeRef LoadXmlFromFile(const char* sFilename, bool bReuseStrings = false) override; + XmlNodeRef LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings = false, bool bSuppressWarnings = false) override; + IXmlUtils* GetXmlUtils() override; ////////////////////////////////////////////////////////////////////////// - void IgnoreUpdates(bool bIgnore) { m_bIgnoreUpdates = bIgnore; }; + void IgnoreUpdates(bool bIgnore) override { m_bIgnoreUpdates = bIgnore; }; - void SetIProcess(IProcess* process); - IProcess* GetIProcess(){ return m_pProcess; } + void SetIProcess(IProcess* process) override; + IProcess* GetIProcess() override{ return m_pProcess; } - bool IsTestMode() const { return m_bTestMode; } + bool IsTestMode() const override { return m_bTestMode; } //@} void SleepIfNeeded(); - virtual void FatalError(const char* format, ...) PRINTF_PARAMS(2, 3); - virtual void ReportBug(const char* format, ...) PRINTF_PARAMS(2, 3); + void FatalError(const char* format, ...) override PRINTF_PARAMS(2, 3); + void ReportBug(const char* format, ...) override PRINTF_PARAMS(2, 3); // Validator Warning. - void WarningV(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, va_list args); - void Warning(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, ...); - virtual int ShowMessage(const char* text, const char* caption, unsigned int uType); - bool CheckLogVerbosity(int verbosity); + void WarningV(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, va_list args) override; + void Warning(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, ...) override; + int ShowMessage(const char* text, const char* caption, unsigned int uType) override; + bool CheckLogVerbosity(int verbosity) override; //! Return pointer to user defined callback. ISystemUserCallback* GetUserCallback() const { return m_pUserCallback; }; ////////////////////////////////////////////////////////////////////////// - virtual void SaveConfiguration(); - virtual void LoadConfiguration(const char* sFilename, ILoadConfigurationEntrySink* pSink = 0, bool warnIfMissing = true); - virtual ESystemConfigSpec GetMaxConfigSpec() const; - virtual ESystemConfigPlatform GetConfigPlatform() const; - virtual void SetConfigPlatform(ESystemConfigPlatform platform); + void SaveConfiguration() override; + void LoadConfiguration(const char* sFilename, ILoadConfigurationEntrySink* pSink = nullptr, bool warnIfMissing = true) override; + ESystemConfigSpec GetMaxConfigSpec() const override; + ESystemConfigPlatform GetConfigPlatform() const override; + void SetConfigPlatform(ESystemConfigPlatform platform) override; ////////////////////////////////////////////////////////////////////////// - virtual bool IsPaused() const { return m_bPaused; }; + bool IsPaused() const override { return m_bPaused; }; - virtual ILocalizationManager* GetLocalizationManager(); - virtual void debug_GetCallStack(const char** pFunctions, int& nCount); - virtual void debug_LogCallStack(int nMaxFuncs = 32, int nFlags = 0); + ILocalizationManager* GetLocalizationManager() override; + void debug_GetCallStack(const char** pFunctions, int& nCount) override; + void debug_LogCallStack(int nMaxFuncs = 32, int nFlags = 0) override; // Get the current callstack in raw address form (more lightweight than the above functions) // static as memReplay needs it before CSystem has been setup - expose a ISystem interface to this function if you need it outside CrySystem static void debug_GetCallStackRaw(void** callstack, uint32& callstackLength); @@ -399,13 +399,13 @@ public: #if defined(WIN32) friend LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); #endif - virtual void* GetRootWindowMessageHandler(); - virtual void RegisterWindowMessageHandler(IWindowMessageHandler* pHandler); - virtual void UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler); + void* GetRootWindowMessageHandler() override; + void RegisterWindowMessageHandler(IWindowMessageHandler* pHandler) override; + void UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler) override; // IWindowMessageHandler #if defined(WIN32) - virtual bool HandleMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult); + bool HandleMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult) override; #endif // ~IWindowMessageHandler @@ -448,7 +448,7 @@ private: bool ReLaunchMediaCenter(); void UpdateAudioSystems(); - void AddCVarGroupDirectory(const AZStd::string& sPath); + void AddCVarGroupDirectory(const AZStd::string& sPath) override; AZStd::unique_ptr LoadDynamiclibrary(const char* dllName) const; @@ -464,13 +464,13 @@ public: // interface ISystem ------------------------------------------- virtual IDataProbe* GetIDataProbe() { return m_pDataProbe; }; - virtual void SetForceNonDevMode(bool bValue); - virtual bool GetForceNonDevMode() const; - virtual bool WasInDevMode() const { return m_bWasInDevMode; }; - virtual bool IsDevMode() const { return m_bInDevMode && !GetForceNonDevMode(); } + void SetForceNonDevMode(bool bValue) override; + bool GetForceNonDevMode() const override; + bool WasInDevMode() const override { return m_bWasInDevMode; }; + bool IsDevMode() const override { return m_bInDevMode && !GetForceNonDevMode(); } - virtual void SetConsoleDrawEnabled(bool enabled) { m_bDrawConsole = enabled; } - virtual void SetUIDrawEnabled(bool enabled) { m_bDrawUI = enabled; } + void SetConsoleDrawEnabled(bool enabled) override { m_bDrawConsole = enabled; } + void SetUIDrawEnabled(bool enabled) override { m_bDrawUI = enabled; } // ------------------------------------------------------------- @@ -478,10 +478,10 @@ public: //! recreates the variable if necessary ICVar* attachVariable (const char* szVarName, int* pContainer, const char* szComment, int dwFlags = 0); - const CTimeValue& GetLastTickTime(void) const { return m_lastTickTime; } - const ICVar* GetDedicatedMaxRate(void) const { return m_svDedicatedMaxRate; } + const CTimeValue& GetLastTickTime() const { return m_lastTickTime; } + const ICVar* GetDedicatedMaxRate() const { return m_svDedicatedMaxRate; } - std::shared_ptr CreateLocalFileIO(); + std::shared_ptr CreateLocalFileIO() override; private: // ------------------------------------------------------ @@ -654,9 +654,9 @@ public: ////////////////////////////////////////////////////////////////////////// // File version. ////////////////////////////////////////////////////////////////////////// - virtual const SFileVersion& GetFileVersion(); - virtual const SFileVersion& GetProductVersion(); - virtual const SFileVersion& GetBuildVersion(); + const SFileVersion& GetFileVersion() override; + const SFileVersion& GetProductVersion() override; + const SFileVersion& GetBuildVersion() override; bool InitVTuneProfiler(); @@ -671,16 +671,16 @@ public: ////////////////////////////////////////////////////////////////////////// // CryAssert and error related. - virtual bool RegisterErrorObserver(IErrorObserver* errorObserver); - bool UnregisterErrorObserver(IErrorObserver* errorObserver); - virtual void OnAssert(const char* condition, const char* message, const char* fileName, unsigned int fileLineNumber); + bool RegisterErrorObserver(IErrorObserver* errorObserver) override; + bool UnregisterErrorObserver(IErrorObserver* errorObserver) override; + void OnAssert(const char* condition, const char* message, const char* fileName, unsigned int fileLineNumber) override; void OnFatalError(const char* message); - bool IsAssertDialogVisible() const; - void SetAssertVisible(bool bAssertVisble); + bool IsAssertDialogVisible() const override; + void SetAssertVisible(bool bAssertVisble) override; ////////////////////////////////////////////////////////////////////////// - virtual void ClearErrorMessages() + void ClearErrorMessages() override { m_ErrorMessages.clear(); } @@ -690,11 +690,11 @@ public: return m_eRuntimeState == ESYSTEM_EVENT_LEVEL_LOAD_START_LOADINGSCREEN; } - virtual ESystemGlobalState GetSystemGlobalState(void); - virtual void SetSystemGlobalState(ESystemGlobalState systemGlobalState); + ESystemGlobalState GetSystemGlobalState() override; + void SetSystemGlobalState(ESystemGlobalState systemGlobalState) override; #if !defined(_RELEASE) - virtual bool IsSavingResourceList() const { return (g_cvars.archiveVars.nSaveLevelResourceList != 0); } + bool IsSavingResourceList() const override { return (g_cvars.archiveVars.nSaveLevelResourceList != 0); } #endif private: @@ -721,7 +721,7 @@ protected: // ------------------------------------------------------------- float m_Color[4]; bool m_HardFailure; }; - typedef std::list TErrorMessages; + using TErrorMessages = std::list; TErrorMessages m_ErrorMessages; bool m_bHasRenderedErrorMessage; diff --git a/Code/Legacy/CrySystem/Timer.h b/Code/Legacy/CrySystem/Timer.h index 93dffeec13..c988c1fa38 100644 --- a/Code/Legacy/CrySystem/Timer.h +++ b/Code/Legacy/CrySystem/Timer.h @@ -21,7 +21,7 @@ public: // constructor CTimer(); // destructor - ~CTimer() {}; + ~CTimer() = default;; bool Init(); @@ -30,57 +30,57 @@ public: // TODO: Review m_time usage in System.cpp // if it wants Game Time / UI Time or a new Render Time? - virtual void ResetTimer(); - virtual void UpdateOnFrameStart(); - virtual float GetCurrTime(ETimer which = ETIMER_GAME) const; - virtual CTimeValue GetAsyncTime() const; - virtual float GetAsyncCurTime(); // retrieve the actual wall clock time passed since the game started, in seconds - virtual float GetFrameTime(ETimer which = ETIMER_GAME) const; - virtual float GetRealFrameTime() const; - virtual float GetTimeScale() const; - virtual float GetTimeScale(uint32 channel) const; - virtual void SetTimeScale(float scale, uint32 channel = 0); - virtual void ClearTimeScales(); - virtual void EnableTimer(bool bEnable); - virtual float GetFrameRate(); - virtual float GetProfileFrameBlending(float* pfBlendTime = 0, int* piBlendMode = 0); - virtual void Serialize(TSerialize ser); - virtual bool IsTimerEnabled() const; + void ResetTimer() override; + void UpdateOnFrameStart() override; + float GetCurrTime(ETimer which = ETIMER_GAME) const override; + CTimeValue GetAsyncTime() const override; + float GetAsyncCurTime() override; // retrieve the actual wall clock time passed since the game started, in seconds + float GetFrameTime(ETimer which = ETIMER_GAME) const override; + float GetRealFrameTime() const override; + float GetTimeScale() const override; + float GetTimeScale(uint32 channel) const override; + void SetTimeScale(float scale, uint32 channel = 0) override; + void ClearTimeScales() override; + void EnableTimer(bool bEnable) override; + float GetFrameRate() override; + float GetProfileFrameBlending(float* pfBlendTime = nullptr, int* piBlendMode = nullptr) override; + void Serialize(TSerialize ser) override; + bool IsTimerEnabled() const override; //! try to pause/unpause a timer // returns true if successfully paused/unpaused, false otherwise - virtual bool PauseTimer(ETimer which, bool bPause); + bool PauseTimer(ETimer which, bool bPause) override; //! determine if a timer is paused // returns true if paused, false otherwise - virtual bool IsTimerPaused(ETimer which); + bool IsTimerPaused(ETimer which) override; //! try to set a timer // return true if successful, false otherwise - virtual bool SetTimer(ETimer which, float timeInSeconds); + bool SetTimer(ETimer which, float timeInSeconds) override; //! make a tm struct from a time_t in UTC (like gmtime) - virtual void SecondsToDateUTC(time_t time, struct tm& outDateUTC); + void SecondsToDateUTC(time_t time, struct tm& outDateUTC) override; //! make a UTC time from a tm (like timegm, but not available on all platforms) - virtual time_t DateToSecondsUTC(struct tm& timePtr); + time_t DateToSecondsUTC(struct tm& timePtr) override; //! Convert from Tics to Seconds - virtual float TicksToSeconds(int64 ticks) + float TicksToSeconds(int64 ticks) override { return float((double)ticks * m_fSecsPerTick); } //! Get number of ticks per second - virtual int64 GetTicksPerSecond() + int64 GetTicksPerSecond() override { return m_lTicksPerSec; } - virtual const CTimeValue& GetFrameStartTime(ETimer which = ETIMER_GAME) const { return m_CurrTime[(int)which]; } - virtual ITimer* CreateNewTimer(); + const CTimeValue& GetFrameStartTime(ETimer which = ETIMER_GAME) const override { return m_CurrTime[(int)which]; } + ITimer* CreateNewTimer() override; - virtual void EnableFixedTimeMode(bool enable, float timeStep) override; + void EnableFixedTimeMode(bool enable, float timeStep) override; private: // --------------------------------------------------------------------- diff --git a/Code/Legacy/CrySystem/ViewSystem/View.h b/Code/Legacy/CrySystem/ViewSystem/View.h index 689c254897..c58aa19ee5 100644 --- a/Code/Legacy/CrySystem/ViewSystem/View.h +++ b/Code/Legacy/CrySystem/ViewSystem/View.h @@ -87,24 +87,24 @@ public: // IView - virtual void Release(); - virtual void Update(float frameTime, bool isActive); + void Release() override; + void Update(float frameTime, bool isActive) override; virtual void ProcessShaking(float frameTime); virtual void ProcessShake(SShake* pShake, float frameTime); - virtual void ResetShaking(); - virtual void ResetBlending() { m_viewParams.ResetBlending(); } - virtual void LinkTo(AZ::Entity* follow); - virtual void Unlink(); - virtual AZ::EntityId GetLinkedId() {return m_linkedTo; }; - virtual void SetCurrentParams(SViewParams& params) { m_viewParams = params; }; - virtual const SViewParams* GetCurrentParams() {return &m_viewParams; } - virtual void SetViewShake(Ang3 shakeAngle, Vec3 shakeShift, float duration, float frequency, float randomness, int shakeID, bool bFlipVec = true, bool bUpdateOnly = false, bool bGroundOnly = false); - virtual void SetViewShakeEx(const SShakeParams& params); - virtual void StopShake(int shakeID); - virtual void SetFrameAdditiveCameraAngles(const Ang3& addFrameAngles); - virtual void SetScale(const float scale); - virtual void SetZoomedScale(const float scale); - virtual void SetActive(const bool bActive); + void ResetShaking() override; + void ResetBlending() override { m_viewParams.ResetBlending(); } + void LinkTo(AZ::Entity* follow) override; + void Unlink() override; + AZ::EntityId GetLinkedId() override {return m_linkedTo; }; + void SetCurrentParams(SViewParams& params) override { m_viewParams = params; }; + const SViewParams* GetCurrentParams() override {return &m_viewParams; } + void SetViewShake(Ang3 shakeAngle, Vec3 shakeShift, float duration, float frequency, float randomness, int shakeID, bool bFlipVec = true, bool bUpdateOnly = false, bool bGroundOnly = false) override; + void SetViewShakeEx(const SShakeParams& params) override; + void StopShake(int shakeID) override; + void SetFrameAdditiveCameraAngles(const Ang3& addFrameAngles) override; + void SetScale(const float scale) override; + void SetZoomedScale(const float scale) override; + void SetActive(const bool bActive) override; // ~IView void PostSerialize() override; diff --git a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.h b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.h index dd49e09e04..d9e8962d71 100644 --- a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.h +++ b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.h @@ -29,60 +29,60 @@ class CViewSystem { private: - typedef std::map TViewMap; - typedef std::vector TViewIdVector; + using TViewMap = std::map; + using TViewIdVector = std::vector; public: //IViewSystem - virtual IView* CreateView(); - virtual unsigned int AddView(IView* pView) override; - virtual void RemoveView(IView* pView); - virtual void RemoveView(unsigned int viewId); + IView* CreateView() override; + unsigned int AddView(IView* pView) override; + void RemoveView(IView* pView) override; + void RemoveView(unsigned int viewId) override; - virtual void SetActiveView(IView* pView); - virtual void SetActiveView(unsigned int viewId); + void SetActiveView(IView* pView) override; + void SetActiveView(unsigned int viewId) override; //CameraSystemRequestBus AZ::EntityId GetActiveCamera() override { return m_activeViewId ? GetActiveView()->GetLinkedId() : AZ::EntityId(); } //utility functions - virtual IView* GetView(unsigned int viewId); - virtual IView* GetActiveView(); + IView* GetView(unsigned int viewId) override; + IView* GetActiveView() override; - virtual unsigned int GetViewId(IView* pView); - virtual unsigned int GetActiveViewId(); + unsigned int GetViewId(IView* pView) override; + unsigned int GetActiveViewId() override; - virtual void PostSerialize(); + void PostSerialize() override; - virtual IView* GetViewByEntityId(const AZ::EntityId& id, bool forceCreate); + IView* GetViewByEntityId(const AZ::EntityId& id, bool forceCreate) override; - virtual float GetDefaultZNear() { return m_fDefaultCameraNearZ; }; - virtual void SetBlendParams(float fBlendPosSpeed, float fBlendRotSpeed, bool performBlendOut) { m_fBlendInPosSpeed = fBlendPosSpeed; m_fBlendInRotSpeed = fBlendRotSpeed; m_bPerformBlendOut = performBlendOut; }; - virtual void SetOverrideCameraRotation(bool bOverride, Quat rotation); - virtual bool IsPlayingCutScene() const + float GetDefaultZNear() override { return m_fDefaultCameraNearZ; }; + void SetBlendParams(float fBlendPosSpeed, float fBlendRotSpeed, bool performBlendOut) override { m_fBlendInPosSpeed = fBlendPosSpeed; m_fBlendInRotSpeed = fBlendRotSpeed; m_bPerformBlendOut = performBlendOut; }; + void SetOverrideCameraRotation(bool bOverride, Quat rotation) override; + bool IsPlayingCutScene() const override { return m_cutsceneCount > 0; } - virtual void SetDeferredViewSystemUpdate(bool const bDeferred){ m_useDeferredViewSystemUpdate = bDeferred; } - virtual bool UseDeferredViewSystemUpdate() const { return m_useDeferredViewSystemUpdate; } - virtual void SetControlAudioListeners(bool const bActive); + void SetDeferredViewSystemUpdate(bool const bDeferred) override{ m_useDeferredViewSystemUpdate = bDeferred; } + bool UseDeferredViewSystemUpdate() const override { return m_useDeferredViewSystemUpdate; } + void SetControlAudioListeners(bool const bActive) override; //~IViewSystem //IMovieUser - virtual void SetActiveCamera(const SCameraParams& Params); - virtual void BeginCutScene(IAnimSequence* pSeq, unsigned long dwFlags, bool bResetFX); - virtual void EndCutScene(IAnimSequence* pSeq, unsigned long dwFlags); - virtual void SendGlobalEvent(const char* pszEvent); + void SetActiveCamera(const SCameraParams& Params) override; + void BeginCutScene(IAnimSequence* pSeq, unsigned long dwFlags, bool bResetFX) override; + void EndCutScene(IAnimSequence* pSeq, unsigned long dwFlags) override; + void SendGlobalEvent(const char* pszEvent) override; //~IMovieUser // ILevelSystemListener - virtual void OnLevelNotFound([[maybe_unused]] const char* levelName) {}; - virtual void OnLoadingStart([[maybe_unused]] const char* levelName); - virtual void OnLoadingComplete([[maybe_unused]] const char* levelName){}; - virtual void OnLoadingError([[maybe_unused]] const char* levelName, [[maybe_unused]] const char* error){}; - virtual void OnLoadingProgress([[maybe_unused]] const char* levelName, [[maybe_unused]] int progressAmount){}; - virtual void OnUnloadComplete([[maybe_unused]] const char* levelName); + void OnLevelNotFound([[maybe_unused]] const char* levelName) override {}; + void OnLoadingStart([[maybe_unused]] const char* levelName) override; + void OnLoadingComplete([[maybe_unused]] const char* levelName) override{}; + void OnLoadingError([[maybe_unused]] const char* levelName, [[maybe_unused]] const char* error) override{}; + void OnLoadingProgress([[maybe_unused]] const char* levelName, [[maybe_unused]] int progressAmount) override{}; + void OnUnloadComplete([[maybe_unused]] const char* levelName) override; //~ILevelSystemListener CViewSystem(ISystem* pSystem); @@ -91,16 +91,16 @@ public: void Release() override { delete this; }; void Update(float frameTime) override; - virtual void ForceUpdate(float elapsed) { Update(elapsed); } + void ForceUpdate(float elapsed) override { Update(elapsed); } //void RegisterViewClass(const char *name, IView *(*func)()); - bool AddListener(IViewSystemListener* pListener) + bool AddListener(IViewSystemListener* pListener) override { return stl::push_back_unique(m_listeners, pListener); } - bool RemoveListener(IViewSystemListener* pListener) + bool RemoveListener(IViewSystemListener* pListener) override { return stl::find_and_erase(m_listeners, pListener); } diff --git a/Code/Legacy/CrySystem/XConsole.h b/Code/Legacy/CrySystem/XConsole.h index 3ff9824e6f..2069d31a74 100644 --- a/Code/Legacy/CrySystem/XConsole.h +++ b/Code/Legacy/CrySystem/XConsole.h @@ -50,7 +50,7 @@ struct CConsoleCommand ////////////////////////////////////////////////////////////////////////// CConsoleCommand() - : m_func(0) + : m_func(nullptr) , m_nFlags(0) {} size_t sizeofThis () const {return sizeof(*this) + m_sName.capacity() + 1 + m_sCommand.capacity() + 1; } void GetMemoryUsage (class ICrySizer* pSizer) const @@ -70,18 +70,18 @@ struct CConsoleCommandArgs CConsoleCommandArgs(AZStd::string& line, std::vector& args) : m_line(line) , m_args(args) {}; - virtual int GetArgCount() const { return static_cast(m_args.size()); }; + int GetArgCount() const override { return static_cast(m_args.size()); }; // Get argument by index, nIndex must be in 0 <= nIndex < GetArgCount() - virtual const char* GetArg(int nIndex) const + const char* GetArg(int nIndex) const override { assert(nIndex >= 0 && nIndex < GetArgCount()); if (!(nIndex >= 0 && nIndex < GetArgCount())) { - return NULL; + return nullptr; } return m_args[nIndex].c_str(); } - virtual const char* GetCommandLine() const + const char* GetCommandLine() const override { return m_line.c_str(); } @@ -118,9 +118,9 @@ class CXConsole , public AzFramework::CommandRegistrationBus::Handler { public: - typedef std::deque ConsoleBuffer; - typedef ConsoleBuffer::iterator ConsoleBufferItor; - typedef ConsoleBuffer::reverse_iterator ConsoleBufferRItor; + using ConsoleBuffer = std::deque; + using ConsoleBufferItor = ConsoleBuffer::iterator; + using ConsoleBufferRItor = ConsoleBuffer::reverse_iterator; // constructor CXConsole(); @@ -136,71 +136,71 @@ public: void Paste(); // interface IConsole --------------------------------------------------------- - virtual void Release(); + void Release() override; - virtual void Init(ISystem* pSystem); - virtual ICVar* RegisterString(const char* sName, const char* sValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = 0); - virtual ICVar* RegisterInt(const char* sName, int iValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = 0); - virtual ICVar* RegisterInt64(const char* sName, int64 iValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = 0); - virtual ICVar* RegisterFloat(const char* sName, float fValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = 0); - virtual ICVar* Register(const char* name, float* src, float defaultvalue, int flags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true); - virtual ICVar* Register(const char* name, int* src, int defaultvalue, int flags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true); - virtual ICVar* Register(const char* name, const char** src, const char* defaultvalue, int flags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = 0, bool allowModify = true); - virtual ICVar* Register(ICVar* pVar) { RegisterVar(pVar); return pVar; } + void Init(ISystem* pSystem) override; + ICVar* RegisterString(const char* sName, const char* sValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr) override; + ICVar* RegisterInt(const char* sName, int iValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr) override; + ICVar* RegisterInt64(const char* sName, int64 iValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr) override; + ICVar* RegisterFloat(const char* sName, float fValue, int nFlags, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr) override; + ICVar* Register(const char* name, float* src, float defaultvalue, int flags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr, bool allowModify = true) override; + ICVar* Register(const char* name, int* src, int defaultvalue, int flags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr, bool allowModify = true) override; + ICVar* Register(const char* name, const char** src, const char* defaultvalue, int flags = 0, const char* help = "", ConsoleVarFunc pChangeFunc = nullptr, bool allowModify = true) override; + ICVar* Register(ICVar* pVar) override { RegisterVar(pVar); return pVar; } - virtual void UnregisterVariable(const char* sVarName, bool bDelete = false); - virtual void SetScrollMax(int value); - virtual void AddOutputPrintSink(IOutputPrintSink* inpSink); - virtual void RemoveOutputPrintSink(IOutputPrintSink* inpSink); - virtual void ShowConsole(bool show, int iRequestScrollMax = -1); - virtual void DumpCVars(ICVarDumpSink* pCallback, unsigned int nFlagsFilter = 0); - virtual void DumpKeyBinds(IKeyBindDumpSink* pCallback); - virtual void CreateKeyBind(const char* sCmd, const char* sRes); - virtual const char* FindKeyBind(const char* sCmd) const; - virtual void SetImage(ITexture* pImage, bool bDeleteCurrent); - virtual inline ITexture* GetImage() { return m_pImage; } - virtual void StaticBackground(bool bStatic) { m_bStaticBackground = bStatic; } - virtual bool GetLineNo(int indwLineNo, char* outszBuffer, int indwBufferSize) const; - virtual int GetLineCount() const; - virtual ICVar* GetCVar(const char* name); - virtual char* GetVariable(const char* szVarName, const char* szFileName, const char* def_val); - virtual float GetVariable(const char* szVarName, const char* szFileName, float def_val); - virtual void PrintLine(const char* s); - virtual void PrintLinePlus(const char* s); - virtual bool GetStatus(); - virtual void Clear(); - virtual void Update(); - virtual void Draw(); - virtual bool AddCommand(const char* sCommand, ConsoleCommandFunc func, int nFlags = 0, const char* sHelp = NULL); - virtual bool AddCommand(const char* sName, const char* sScriptFunc, int nFlags = 0, const char* sHelp = NULL); - virtual void RemoveCommand(const char* sName); - virtual void ExecuteString(const char* command, bool bSilentMode, bool bDeferExecution = false); - virtual void ExecuteConsoleCommand(const char* command) override; - virtual void ResetCVarsToDefaults() override; - virtual void Exit(const char* command, ...) PRINTF_PARAMS(2, 3); - virtual bool IsOpened(); - virtual int GetNumVars(); - virtual int GetNumVisibleVars(); - virtual size_t GetSortedVars(AZStd::vector& pszArray, const char* szPrefix = 0); + void UnregisterVariable(const char* sVarName, bool bDelete = false) override; + void SetScrollMax(int value) override; + void AddOutputPrintSink(IOutputPrintSink* inpSink) override; + void RemoveOutputPrintSink(IOutputPrintSink* inpSink) override; + void ShowConsole(bool show, int iRequestScrollMax = -1) override; + void DumpCVars(ICVarDumpSink* pCallback, unsigned int nFlagsFilter = 0) override; + void DumpKeyBinds(IKeyBindDumpSink* pCallback) override; + void CreateKeyBind(const char* sCmd, const char* sRes) override; + const char* FindKeyBind(const char* sCmd) const override; + void SetImage(ITexture* pImage, bool bDeleteCurrent) override; + inline ITexture* GetImage() override { return m_pImage; } + void StaticBackground(bool bStatic) override { m_bStaticBackground = bStatic; } + bool GetLineNo(int indwLineNo, char* outszBuffer, int indwBufferSize) const override; + int GetLineCount() const override; + ICVar* GetCVar(const char* name) override; + char* GetVariable(const char* szVarName, const char* szFileName, const char* def_val) override; + float GetVariable(const char* szVarName, const char* szFileName, float def_val) override; + void PrintLine(const char* s) override; + void PrintLinePlus(const char* s) override; + bool GetStatus() override; + void Clear() override; + void Update() override; + void Draw() override; + bool AddCommand(const char* sCommand, ConsoleCommandFunc func, int nFlags = 0, const char* sHelp = nullptr) override; + bool AddCommand(const char* sName, const char* sScriptFunc, int nFlags = 0, const char* sHelp = nullptr) override; + void RemoveCommand(const char* sName) override; + void ExecuteString(const char* command, bool bSilentMode, bool bDeferExecution = false) override; + void ExecuteConsoleCommand(const char* command) override; + void ResetCVarsToDefaults() override; + void Exit(const char* command, ...) override PRINTF_PARAMS(2, 3); + bool IsOpened() override; + int GetNumVars() override; + int GetNumVisibleVars() override; + size_t GetSortedVars(AZStd::vector& pszArray, const char* szPrefix = nullptr) override; virtual void FindVar(const char* substr); - virtual const char* AutoComplete(const char* substr); - virtual const char* AutoCompletePrev(const char* substr); - virtual const char* ProcessCompletion(const char* szInputBuffer); - virtual void RegisterAutoComplete(const char* sVarOrCommand, IConsoleArgumentAutoComplete* pArgAutoComplete); - virtual void UnRegisterAutoComplete(const char* sVarOrCommand); - virtual void ResetAutoCompletion(); - virtual void GetMemoryUsage (ICrySizer* pSizer) const; - virtual void ResetProgressBar(int nProgressRange); - virtual void TickProgressBar(); - virtual void SetLoadingImage(const char* szFilename); - virtual void AddConsoleVarSink(IConsoleVarSink* pSink); - virtual void RemoveConsoleVarSink(IConsoleVarSink* pSink); - virtual const char* GetHistoryElement(bool bUpOrDown); - virtual void AddCommandToHistory(const char* szCommand); - virtual void SetInputLine(const char* szLine); - virtual void LoadConfigVar(const char* sVariable, const char* sValue); - virtual void EnableActivationKey(bool bEnable); - virtual void SetClientDataProbeString(const char* pName, const char* pValue); + const char* AutoComplete(const char* substr) override; + const char* AutoCompletePrev(const char* substr) override; + const char* ProcessCompletion(const char* szInputBuffer) override; + void RegisterAutoComplete(const char* sVarOrCommand, IConsoleArgumentAutoComplete* pArgAutoComplete) override; + void UnRegisterAutoComplete(const char* sVarOrCommand) override; + void ResetAutoCompletion() override; + void GetMemoryUsage (ICrySizer* pSizer) const override; + void ResetProgressBar(int nProgressRange) override; + void TickProgressBar() override; + void SetLoadingImage(const char* szFilename) override; + void AddConsoleVarSink(IConsoleVarSink* pSink) override; + void RemoveConsoleVarSink(IConsoleVarSink* pSink) override; + const char* GetHistoryElement(bool bUpOrDown) override; + void AddCommandToHistory(const char* szCommand) override; + void SetInputLine(const char* szLine) override; + void LoadConfigVar(const char* sVariable, const char* sValue) override; + void EnableActivationKey(bool bEnable) override; + void SetClientDataProbeString(const char* pName, const char* pValue) override; // InputChannelEventListener / InputTextEventListener bool OnInputChannelEventFiltered(const AzFramework::InputChannel& inputChannel) override; @@ -208,7 +208,7 @@ public: // interface IRemoteConsoleListener ------------------------------------------------------------------ - virtual void OnConsoleCommand(const char* cmd); + void OnConsoleCommand(const char* cmd) override; // interface IConsoleVarSink ---------------------------------------------------------------------- @@ -227,12 +227,12 @@ public: ICVar* RegisterCVarGroup(const char* sName, const char* szFileName); void SetProcessingGroup(bool isGroup) { m_bIsProcessingGroup = isGroup; } - bool GetIsProcessingGroup(void) const { return m_bIsProcessingGroup; } + bool GetIsProcessingGroup() const { return m_bIsProcessingGroup; } protected: // ---------------------------------------------------------------------------------------- void DrawBuffer(int nScrollPos, const char* szEffect); - void RegisterVar(ICVar* pCVar, ConsoleVarFunc pChangeFunc = 0); + void RegisterVar(ICVar* pCVar, ConsoleVarFunc pChangeFunc = nullptr); bool ProcessInput(const AzFramework::InputChannel& inputChannel); void AddLine(const char* inputStr); @@ -283,7 +283,7 @@ private: // ---------------------------------------------------------- typedef std::map ConsoleVariablesMap; // key points into string stored in ICVar or in .exe/.dll typedef ConsoleVariablesMap::iterator ConsoleVariablesMapItor; - typedef std::vector > ConsoleVariablesVector; + using ConsoleVariablesVector = std::vector >; void LogChangeMessage(const char* name, const bool isConst, const bool isCheat, const bool isReadOnly, const bool isDeprecated, const char* oldValue, const char* newValue, const bool isProcessingGroup, const bool allowChange); @@ -320,9 +320,9 @@ private: // ---------------------------------------------------------- , silentMode(_silentMode) {} }; - typedef std::list TDeferredCommandList; + using TDeferredCommandList = std::list; - typedef std::list ConsoleVarSinks; + using ConsoleVarSinks = std::list; // -------------------------------------------------------------------------------- diff --git a/Code/Legacy/CrySystem/XConsoleVariable.h b/Code/Legacy/CrySystem/XConsoleVariable.h index f761287b41..41ebc8e4fc 100644 --- a/Code/Legacy/CrySystem/XConsoleVariable.h +++ b/Code/Legacy/CrySystem/XConsoleVariable.h @@ -16,7 +16,7 @@ #include "SFunctor.h" class CXConsole; -typedef AZStd::fixed_string<512> stack_string; +using stack_string = AZStd::fixed_string<512>; inline int64 TextToInt64(const char* s, int64 nCurrent, bool bBitfield) { @@ -99,19 +99,19 @@ public: // interface ICVar -------------------------------------------------------------------------------------- - virtual void ClearFlags(int flags); - virtual int GetFlags() const; - virtual int SetFlags(int flags); - virtual const char* GetName() const; - virtual const char* GetHelp(); - virtual void Release(); - virtual void ForceSet(const char* s); - virtual void SetOnChangeCallback(ConsoleVarFunc pChangeFunc); - virtual uint64 AddOnChangeFunctor(const SFunctor& pChangeFunctor) override; - virtual ConsoleVarFunc GetOnChangeCallback() const; + void ClearFlags(int flags) override; + int GetFlags() const override; + int SetFlags(int flags) override; + const char* GetName() const override; + const char* GetHelp() override; + void Release() override; + void ForceSet(const char* s) override; + void SetOnChangeCallback(ConsoleVarFunc pChangeFunc) override; + uint64 AddOnChangeFunctor(const SFunctor& pChangeFunctor) override; + ConsoleVarFunc GetOnChangeCallback() const override; - virtual bool ShouldReset() const { return (m_nFlags & VF_RESETTABLE) != 0; } - virtual void Reset() override + bool ShouldReset() const { return (m_nFlags & VF_RESETTABLE) != 0; } + void Reset() override { if (ShouldReset()) { @@ -121,19 +121,19 @@ public: virtual void ResetImpl() = 0; - virtual void SetLimits(float min, float max) override; - virtual void GetLimits(float& min, float& max) override; - virtual bool HasCustomLimits() override; + void SetLimits(float min, float max) override; + void GetLimits(float& min, float& max) override; + bool HasCustomLimits() override; - virtual int GetRealIVal() const { return GetIVal(); } - virtual bool IsConstCVar() const {return (m_nFlags & VF_CONST_CVAR) != 0; } - virtual void SetDataProbeString(const char* pDataProbeString) + int GetRealIVal() const override { return GetIVal(); } + bool IsConstCVar() const override {return (m_nFlags & VF_CONST_CVAR) != 0; } + void SetDataProbeString(const char* pDataProbeString) override { CRY_ASSERT(m_pDataProbeString == NULL); m_pDataProbeString = new char[ strlen(pDataProbeString) + 1 ]; azstrcpy(m_pDataProbeString, strlen(pDataProbeString) + 1, pDataProbeString); } - virtual const char* GetDataProbeString() const + const char* GetDataProbeString() const override { if (gEnv->IsDedicated() && m_pDataProbeString) { @@ -157,7 +157,7 @@ protected: // ------------------------------------------------------------------ char* m_pDataProbeString; // value client is required to have for data probes int m_nFlags; // e.g. VF_CHEAT, ... - typedef std::vector > ChangeFunctorContainer; + using ChangeFunctorContainer = std::vector >; ChangeFunctorContainer m_changeFunctors; ConsoleVarFunc m_pChangeFunc; // Callback function that is called when this variable changes. CXConsole* m_pConsole; // used for the callback OnBeforeVarChange() @@ -185,15 +185,15 @@ public: // interface ICVar -------------------------------------------------------------------------------------- - virtual int GetIVal() const { return atoi(m_sValue.c_str()); } - virtual int64 GetI64Val() const { return _atoi64(m_sValue.c_str()); } - virtual float GetFVal() const { return (float)atof(m_sValue.c_str()); } - virtual const char* GetString() const { return m_sValue.c_str(); } - virtual void ResetImpl() + int GetIVal() const override { return atoi(m_sValue.c_str()); } + int64 GetI64Val() const override { return _atoi64(m_sValue.c_str()); } + float GetFVal() const override { return (float)atof(m_sValue.c_str()); } + const char* GetString() const override { return m_sValue.c_str(); } + void ResetImpl() override { Set(m_sDefault.c_str()); } - virtual void Set(const char* s) + void Set(const char* s) override { if (!s) { @@ -218,7 +218,7 @@ public: } } - virtual void Set(float f) + void Set(float f) override { stack_string s = stack_string::format("%g", f); @@ -231,7 +231,7 @@ public: Set(s.c_str()); } - virtual void Set(int i) + void Set(int i) override { stack_string s = stack_string::format("%d", i); @@ -243,9 +243,9 @@ public: m_nFlags |= VF_MODIFIED; Set(s.c_str()); } - virtual int GetType() { return CVAR_STRING; } + int GetType() override { return CVAR_STRING; } - virtual void GetMemoryUsage(class ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); } + void GetMemoryUsage(class ICrySizer* pSizer) const override { pSizer->AddObject(this, sizeof(*this)); } private: // -------------------------------------------------------------------------------------------- AZStd::string m_sValue; AZStd::string m_sDefault; //!< @@ -277,7 +277,7 @@ public: sprintf_s(szReturnString, "%d", GetIVal()); return szReturnString; } - virtual void ResetImpl() { Set(m_iDefault); } + void ResetImpl() override { Set(m_iDefault); } virtual void Set(const char* s) { int nValue = TextToInt(s, m_iValue, (m_nFlags & VF_BITFIELD) != 0); @@ -340,7 +340,7 @@ public: sprintf_s(szReturnString, "%lld", GetI64Val()); return szReturnString; } - virtual void ResetImpl() { Set(m_iDefault); } + void ResetImpl() override { Set(m_iDefault); } virtual void Set(const char* s) { int64 nValue = TextToInt64(s, m_iValue, (m_nFlags & VF_BITFIELD) != 0); @@ -408,7 +408,7 @@ public: sprintf_s(szReturnString, "%g", m_fValue); // %g -> "2.01", %f -> "2.01000" return szReturnString; } - virtual void ResetImpl() { Set(m_fDefault); } + void ResetImpl() override { Set(m_fDefault); } virtual void Set(const char* s) { float fValue = 0; @@ -475,7 +475,7 @@ public: protected: - virtual const char* GetOwnDataProbeString() const + const char* GetOwnDataProbeString() const override { static char szReturnString[8]; @@ -516,7 +516,7 @@ public: sprintf_s(szReturnString, "%d", m_iValue); return szReturnString; } - virtual void ResetImpl() { Set(m_iDefault); } + void ResetImpl() override { Set(m_iDefault); } virtual void Set(const char* s) { int nValue = TextToInt(s, m_iValue, (m_nFlags & VF_BITFIELD) != 0); @@ -609,7 +609,7 @@ public: sprintf_s(szReturnString, "%g", m_fValue); return szReturnString; } - virtual void ResetImpl() { Set(m_fDefault); } + void ResetImpl() override { Set(m_fDefault); } virtual void Set(const char* s) { float fValue = 0; @@ -673,7 +673,7 @@ public: protected: - virtual const char* GetOwnDataProbeString() const + const char* GetOwnDataProbeString() const override { static char szReturnString[8]; @@ -714,7 +714,7 @@ public: { return m_sValue.c_str(); } - virtual void ResetImpl() { Set(m_sDefault.c_str()); } + void ResetImpl() override { Set(m_sDefault.c_str()); } virtual void Set(const char* s) { if ((m_sValue == s) && (m_nFlags & VF_ALWAYSONCHANGE) == 0) @@ -776,13 +776,13 @@ public: // interface ICVar ----------------------------------------------------------------------------------- - virtual const char* GetHelp(); + const char* GetHelp() override; - virtual int GetRealIVal() const; + int GetRealIVal() const override; virtual void DebugLog(const int iExpectedValue, const ICVar::EConsoleLogMode mode) const; - virtual void Set(int i); + void Set(int i) override; // ConsoleVarFunc ------------------------------------------------------------------------------------ @@ -790,10 +790,10 @@ public: // interface ILoadConfigurationEntrySink ------------------------------------------------------------- - virtual void OnLoadConfigurationEntry(const char* szKey, const char* szValue, const char* szGroup); - virtual void OnLoadConfigurationEntry_End(); + void OnLoadConfigurationEntry(const char* szKey, const char* szValue, const char* szGroup) override; + void OnLoadConfigurationEntry_End() override; - virtual void GetMemoryUsage(class ICrySizer* pSizer) const + void GetMemoryUsage(class ICrySizer* pSizer) const override { pSizer->AddObject(this, sizeof(*this)); pSizer->AddObject(m_sDefaultValue); @@ -815,17 +815,17 @@ private: // -------------------------------------------------------------------- TCVarGroupStateMap m_CVarGroupStates; AZStd::string m_sDefaultValue; // used by OnLoadConfigurationEntry_End() - void ApplyCVars(const SCVarGroup& rGroup, const SCVarGroup* pExclude = 0); + void ApplyCVars(const SCVarGroup& rGroup, const SCVarGroup* pExclude = nullptr); // Arguments: // sKey - must exist, at least in default // pSpec - can be 0 - AZStd::string GetValueSpec(const AZStd::string& sKey, const int* pSpec = 0) const; + AZStd::string GetValueSpec(const AZStd::string& sKey, const int* pSpec = nullptr) const; // should only be used by TestCVars() // Returns: // true=all console variables match the state (excluding default state), false otherwise - bool TestCVars(const SCVarGroup& rGroup, const ICVar::EConsoleLogMode mode, const SCVarGroup* pExclude = 0) const; + bool TestCVars(const SCVarGroup& rGroup, const ICVar::EConsoleLogMode mode, const SCVarGroup* pExclude = nullptr) const; // Arguments: // pGroup - can be 0 to test if the default state is set diff --git a/Code/Legacy/CrySystem/XML/XmlUtils.cpp b/Code/Legacy/CrySystem/XML/XmlUtils.cpp index 56944eb344..4620b3f7a0 100644 --- a/Code/Legacy/CrySystem/XML/XmlUtils.cpp +++ b/Code/Legacy/CrySystem/XML/XmlUtils.cpp @@ -40,11 +40,11 @@ CXmlUtils::CXmlUtils(ISystem* pSystem) #ifdef CRY_COLLECT_XML_NODE_STATS g_pCXmlNode_Stats = new SXmlNodeStats(); #endif - m_pStatsXmlNodePool = 0; + m_pStatsXmlNodePool = nullptr; #ifndef _RELEASE m_statsThreadOwner = CryGetCurrentThreadId(); #endif - m_pXMLPatcher = NULL; + m_pXMLPatcher = nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -129,10 +129,10 @@ class CXmlSerializer public: CXmlSerializer() : m_nRefCount(0) - , m_pReaderImpl(NULL) - , m_pReaderSer(NULL) - , m_pWriterSer(NULL) - , m_pWriterImpl(NULL) + , m_pReaderImpl(nullptr) + , m_pReaderSer(nullptr) + , m_pWriterSer(nullptr) + , m_pWriterImpl(nullptr) { } ~CXmlSerializer() @@ -148,8 +148,8 @@ public: } ////////////////////////////////////////////////////////////////////////// - virtual void AddRef() { ++m_nRefCount; } - virtual void Release() + void AddRef() override { ++m_nRefCount; } + void Release() override { if (--m_nRefCount <= 0) { @@ -157,14 +157,14 @@ public: } } - virtual ISerialize* GetWriter(XmlNodeRef& node) + ISerialize* GetWriter(XmlNodeRef& node) override { ClearAll(); m_pWriterImpl = new CSerializeXMLWriterImpl(node); m_pWriterSer = new CSimpleSerializeWithDefaults(*m_pWriterImpl); return m_pWriterSer; } - virtual ISerialize* GetReader(XmlNodeRef& node) + ISerialize* GetReader(XmlNodeRef& node) override { ClearAll(); m_pReaderImpl = new CSerializeXMLReaderImpl(node); @@ -172,7 +172,7 @@ public: return m_pReaderSer; } - virtual void GetMemoryUsage(ICrySizer* pSizer) const + void GetMemoryUsage(ICrySizer* pSizer) const override { pSizer->Add(*this); pSizer->AddObject(m_pReaderImpl); @@ -271,7 +271,7 @@ public: return m_fileHandle != AZ::IO::InvalidHandle; } ; - virtual void Write(const void* pData, size_t size) + void Write(const void* pData, size_t size) override { if (m_fileHandle != AZ::IO::InvalidHandle) { @@ -292,7 +292,7 @@ bool CXmlUtils::SaveBinaryXmlFile(const char* filename, XmlNodeRef root) } XMLBinary::CXMLBinaryWriter writer; AZStd::string error; - return writer.WriteNode(&fileSink, root, false, 0, error); + return writer.WriteNode(&fileSink, root, false, nullptr, error); } ////////////////////////////////////////////////////////////////////////// @@ -302,7 +302,7 @@ XmlNodeRef CXmlUtils::LoadBinaryXmlFile(const char* filename, bool bEnablePatchi XMLBinary::XMLBinaryReader::EResult result; XmlNodeRef root = reader.LoadFromFile(filename, result); - if (result == XMLBinary::XMLBinaryReader::eResult_Success && bEnablePatching == true && m_pXMLPatcher != NULL) + if (result == XMLBinary::XMLBinaryReader::eResult_Success && bEnablePatching == true && m_pXMLPatcher != nullptr) { root = m_pXMLPatcher->ApplyXMLDataPatch(root, filename); } @@ -326,12 +326,12 @@ public: CXmlTableReader(); virtual ~CXmlTableReader(); - virtual void Release(); + void Release() override; - virtual bool Begin(XmlNodeRef rootNode); - virtual int GetEstimatedRowCount(); - virtual bool ReadRow(int& rowIndex); - virtual bool ReadCell(int& columnIndex, const char*& pContent, size_t& contentSize); + bool Begin(XmlNodeRef rootNode) override; + int GetEstimatedRowCount() override; + bool ReadRow(int& rowIndex) override; + bool ReadCell(int& columnIndex, const char*& pContent, size_t& contentSize) override; float GetCurrentRowHeight() override; private: @@ -372,7 +372,7 @@ void CXmlTableReader::Release() ////////////////////////////////////////////////////////////////////////// bool CXmlTableReader::Begin(XmlNodeRef rootNode) { - m_tableNode = 0; + m_tableNode = nullptr; if (!rootNode) { @@ -391,11 +391,11 @@ bool CXmlTableReader::Begin(XmlNodeRef rootNode) m_tableNode = rootNode->findChild("Table"); } - m_rowNode = 0; + m_rowNode = nullptr; m_rowNodeIndex = -1; m_row = -1; - return (m_tableNode != 0); + return (m_tableNode != nullptr); } ////////////////////////////////////////////////////////////////////////// @@ -441,7 +441,7 @@ bool CXmlTableReader::ReadRow(int& rowIndex) if (!m_rowNode->isTag("Row")) { - m_rowNode = 0; + m_rowNode = nullptr; continue; } @@ -454,7 +454,7 @@ bool CXmlTableReader::ReadRow(int& rowIndex) if (index < m_row) { m_rowNodeIndex = rowNodeCount; - m_rowNode = 0; + m_rowNode = nullptr; return false; } m_row = index; @@ -502,7 +502,7 @@ bool CXmlTableReader::ReadRow(int& rowIndex) ////////////////////////////////////////////////////////////////////////// bool CXmlTableReader::ReadCell(int& columnIndex, const char*& pContent, size_t& contentSize) { - pContent = 0; + pContent = nullptr; contentSize = 0; if (!m_tableNode) @@ -632,7 +632,7 @@ IXmlTableReader* CXmlUtils::CreateXmlTableReader() void CXmlUtils::InitStatsXmlNodePool(uint32 nPoolSize) { CHECK_STATS_THREAD_OWNERSHIP(); - if (0 == m_pStatsXmlNodePool) + if (nullptr == m_pStatsXmlNodePool) { // create special xml node pools for game statistics @@ -651,7 +651,7 @@ void CXmlUtils::InitStatsXmlNodePool(uint32 nPoolSize) XmlNodeRef CXmlUtils::CreateStatsXmlNode(const char* sNodeName) { CHECK_STATS_THREAD_OWNERSHIP(); - if (0 == m_pStatsXmlNodePool) + if (nullptr == m_pStatsXmlNodePool) { CryLog("[CXmlNodePool]: Xml stats nodes pool isn't initialized. Perform default initialization."); InitStatsXmlNodePool(); @@ -682,7 +682,7 @@ void CXmlUtils::SetXMLPatcher(XmlNodeRef* pPatcher) { SAFE_DELETE(m_pXMLPatcher); - if (pPatcher != NULL) + if (pPatcher != nullptr) { m_pXMLPatcher = new CXMLPatcher(*pPatcher); }