diff options
| author | qwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com> | 2026-03-16 21:44:26 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-16 21:44:26 -0500 |
| commit | ce739f6045ec72127491286ea3f3f21e537c1b55 (patch) | |
| tree | f33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.Client/Common/Tutorial | |
| parent | 255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff) | |
| parent | 5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff) | |
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Common/Tutorial')
32 files changed, 140 insertions, 137 deletions
diff --git a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp index f01db84e..06e73d6f 100644 --- a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp +++ b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp @@ -61,9 +61,9 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) + if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) { - player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); + player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs)); } } } @@ -89,7 +89,7 @@ void ChangeStateConstraint::tick(int iPad) if(m_changeGameMode) { - if(minecraft->localgameModes[iPad] != NULL) + if(minecraft->localgameModes[iPad] != nullptr) { m_changedFromGameMode = minecraft->localplayers[iPad]->abilities.instabuild ? GameType::CREATIVE : GameType::SURVIVAL; @@ -102,9 +102,9 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) + if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) { - player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); + player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs)); } } } @@ -126,9 +126,9 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) + if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) { - player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); + player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs)); } } } diff --git a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h index 2156870d..e5f2d74b 100644 --- a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h +++ b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h @@ -30,7 +30,7 @@ private: public: virtual ConstraintType getType() { return e_ConstraintChangeState; } - ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], DWORD sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = NULL ); + ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], DWORD sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = nullptr ); ~ChangeStateConstraint(); virtual void tick(int iPad); diff --git a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp index 1ea34ace..023e4b22 100644 --- a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp @@ -8,11 +8,12 @@ #include "ChoiceTask.h" #include "..\..\..\Minecraft.World\Material.h" #include "..\..\Windows64\KeyboardMouseInput.h" +#include "Common/UI/UI.h" ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, - int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/, - eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) + int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/, + eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) + : TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false ) { if(requiresUserInput == true) { diff --git a/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp b/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp index 43b2f7f3..f2fb8c12 100644 --- a/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp +++ b/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp @@ -3,7 +3,7 @@ #include "CompleteUsingItemTask.h" CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr) { m_iValidItemsA= new int [itemIdsLength]; for(int i=0;i<itemIdsLength;i++) diff --git a/Minecraft.Client/Common/Tutorial/ControllerTask.cpp b/Minecraft.Client/Common/Tutorial/ControllerTask.cpp index 379e117c..ddb07050 100644 --- a/Minecraft.Client/Common/Tutorial/ControllerTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ControllerTask.cpp @@ -9,7 +9,7 @@ ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime, int mappings[], unsigned int mappingsLength, int iCompletionMaskA[], int iCompletionMaskACount, int iSouthpawMappings[], unsigned int uiSouthpawMappingsCount) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL, showMinimumTime ) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr, showMinimumTime ) { for(unsigned int i = 0; i < mappingsLength; ++i) { diff --git a/Minecraft.Client/Common/Tutorial/ControllerTask.h b/Minecraft.Client/Common/Tutorial/ControllerTask.h index 1ee6746f..8cf8f5c6 100644 --- a/Minecraft.Client/Common/Tutorial/ControllerTask.h +++ b/Minecraft.Client/Common/Tutorial/ControllerTask.h @@ -16,7 +16,7 @@ private: bool CompletionMaskIsValid(); public: ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime, - int mappings[], unsigned int mappingsLength, int iCompletionMaskA[]=NULL, int iCompletionMaskACount=0, int iSouthpawMappings[]=NULL, unsigned int uiSouthpawMappingsCount=0); + int mappings[], unsigned int mappingsLength, int iCompletionMaskA[]=nullptr, int iCompletionMaskACount=0, int iSouthpawMappings[]=nullptr, unsigned int uiSouthpawMappingsCount=0); ~ControllerTask(); virtual bool isCompleted(); virtual void setAsCurrentTask(bool active = true); diff --git a/Minecraft.Client/Common/Tutorial/CraftTask.cpp b/Minecraft.Client/Common/Tutorial/CraftTask.cpp index 6749d030..c96e6872 100644 --- a/Minecraft.Client/Common/Tutorial/CraftTask.cpp +++ b/Minecraft.Client/Common/Tutorial/CraftTask.cpp @@ -3,7 +3,7 @@ #include "..\..\..\Minecraft.World\net.minecraft.world.item.h" CraftTask::CraftTask( int itemId, int auxValue, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= NULL*/, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= nullptr*/, bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_quantity( quantity ), @@ -17,7 +17,7 @@ CraftTask::CraftTask( int itemId, int auxValue, int quantity, } CraftTask::CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= NULL*/, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= nullptr*/, bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_quantity( quantity ), diff --git a/Minecraft.Client/Common/Tutorial/CraftTask.h b/Minecraft.Client/Common/Tutorial/CraftTask.h index 1496f07a..4246711e 100644 --- a/Minecraft.Client/Common/Tutorial/CraftTask.h +++ b/Minecraft.Client/Common/Tutorial/CraftTask.h @@ -5,10 +5,10 @@ class CraftTask : public TutorialTask { public: CraftTask( int itemId, int auxValue, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); ~CraftTask(); diff --git a/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp b/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp index 86dbe500..428bbe3c 100644 --- a/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp +++ b/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp @@ -22,7 +22,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile) { - if(item != NULL) + if(item != nullptr) { bool itemFound = false; for(unsigned int i=0;i<m_iItemsCount;i++) @@ -48,7 +48,7 @@ int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile) int DiggerItemHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity) { - if(item != NULL) + if(item != nullptr) { bool itemFound = false; for(unsigned int i=0;i<m_iItemsCount;i++) diff --git a/Minecraft.Client/Common/Tutorial/EffectChangedTask.cpp b/Minecraft.Client/Common/Tutorial/EffectChangedTask.cpp index 5f1b5b20..4a027b6c 100644 --- a/Minecraft.Client/Common/Tutorial/EffectChangedTask.cpp +++ b/Minecraft.Client/Common/Tutorial/EffectChangedTask.cpp @@ -4,7 +4,7 @@ EffectChangedTask::EffectChangedTask(Tutorial *tutorial, int descriptionId, MobEffect *effect, bool apply, bool enablePreCompletion, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders ) - : TutorialTask(tutorial,descriptionId,enablePreCompletion,NULL,bShowMinimumTime,bAllowFade,bTaskReminders) + : TutorialTask(tutorial,descriptionId,enablePreCompletion,nullptr,bShowMinimumTime,bAllowFade,bTaskReminders) { m_effect = effect; m_apply = apply; diff --git a/Minecraft.Client/Common/Tutorial/FullTutorial.cpp b/Minecraft.Client/Common/Tutorial/FullTutorial.cpp index d0fda62e..a6e1ebb7 100644 --- a/Minecraft.Client/Common/Tutorial/FullTutorial.cpp +++ b/Minecraft.Client/Common/Tutorial/FullTutorial.cpp @@ -154,10 +154,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) addTask(e_Tutorial_State_Gameplay, new UseItemTask(Item::door_wood->id, this, IDS_TUTORIAL_TASK_PLACE_DOOR) ); addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::torch_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_TORCH) ); - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea"); - if(area != NULL) + if(area != nullptr) { vector<TutorialConstraint *> *areaConstraints = new vector<TutorialConstraint *>(); areaConstraints->push_back( new AreaConstraint( IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -283,10 +283,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * MINECART * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"minecartArea"); - if(area != NULL) + if(area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Minecart, IDS_TUTORIAL_HINT_MINECART, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -298,10 +298,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BOAT * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea"); - if(area != NULL) + if(area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Boat, IDS_TUTORIAL_HINT_BOAT, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -313,10 +313,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FISHING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea"); - if(area != NULL) + if(area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Fishing, IDS_TUTORIAL_HINT_FISHING, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -328,10 +328,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PISTON - SELF-REPAIRING BRIDGE * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea"); - if(area != NULL) + if(area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_None, IDS_TUTORIAL_HINT_PISTON_SELF_REPAIRING_BRIDGE, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1, true ) ); } @@ -343,10 +343,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PISTON - PISTON AND REDSTONE CIRCUITS * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State redstoneAndPistonStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Redstone_And_Piston, redstoneAndPistonStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -368,10 +368,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PORTAL * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Portal, portalStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -391,10 +391,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * CREATIVE * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"creativeArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_CreativeMode, creativeStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1,true,true,GameType::CREATIVE) ); @@ -411,7 +411,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) ProcedureCompoundTask *creativeFinalTask = new ProcedureCompoundTask( this ); AABB *exitArea = app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea"); - if(exitArea != NULL) + if(exitArea != nullptr) { vector<TutorialConstraint *> *creativeExitAreaConstraints = new vector<TutorialConstraint *>(); creativeExitAreaConstraints->push_back( new AreaConstraint( -1, exitArea->x0,exitArea->y0,exitArea->z0,exitArea->x1,exitArea->y1,exitArea->z1,true,false) ); @@ -434,10 +434,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BREWING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -467,10 +467,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ENCHANTING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enchanting, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -492,10 +492,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ANVIL * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -517,10 +517,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * TRADING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Trading, tradingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -541,10 +541,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FIREWORKS * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Fireworks, fireworkStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -563,10 +563,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BEACON * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Beacon, beaconStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -585,10 +585,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * HOPPER * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Hopper, hopperStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -610,10 +610,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ENDERCHEST * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enderchests, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -632,10 +632,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FARMING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Farming, farmingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -661,10 +661,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BREEDING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"breedingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -689,10 +689,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * SNOW AND IRON GOLEM * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Golem, golemStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); diff --git a/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp b/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp index 54985d21..f1357c6c 100644 --- a/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp +++ b/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp @@ -3,7 +3,7 @@ #include "FullTutorialActiveTask.h" FullTutorialActiveTask::FullTutorialActiveTask(Tutorial *tutorial, eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/) - : TutorialTask( tutorial, -1, false, NULL, false, false, false ) + : TutorialTask( tutorial, -1, false, nullptr, false, false, false ) { m_completeAction = completeAction; } diff --git a/Minecraft.Client/Common/Tutorial/InfoTask.cpp b/Minecraft.Client/Common/Tutorial/InfoTask.cpp index 6a78ed92..2e481804 100644 --- a/Minecraft.Client/Common/Tutorial/InfoTask.cpp +++ b/Minecraft.Client/Common/Tutorial/InfoTask.cpp @@ -8,10 +8,11 @@ #include "InfoTask.h" #include "..\..\..\Minecraft.World\Material.h" #include "..\..\Windows64\KeyboardMouseInput.h" +#include "Common/UI/UI.h" InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, - int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) + int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) + : TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false ) { if(requiresUserInput == true) { diff --git a/Minecraft.Client/Common/Tutorial/PickupTask.h b/Minecraft.Client/Common/Tutorial/PickupTask.h index 68e1d479..9f2d2426 100644 --- a/Minecraft.Client/Common/Tutorial/PickupTask.h +++ b/Minecraft.Client/Common/Tutorial/PickupTask.h @@ -8,7 +8,7 @@ class PickupTask : public TutorialTask { public: PickupTask( int itemId, unsigned int quantity, int auxValue, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_itemId( itemId), diff --git a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp index 0e3b3e37..ddf15a55 100644 --- a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp @@ -11,7 +11,7 @@ ProcedureCompoundTask::~ProcedureCompoundTask() void ProcedureCompoundTask::AddTask(TutorialTask *task) { - if(task != NULL) + if(task != nullptr) { m_taskSequence.push_back(task); } diff --git a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h index 36b32798..0a5b7eee 100644 --- a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h +++ b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h @@ -8,7 +8,7 @@ class ProcedureCompoundTask : public TutorialTask { public: ProcedureCompoundTask(Tutorial *tutorial ) - : TutorialTask(tutorial, -1, false, NULL, false, true, false ) + : TutorialTask(tutorial, -1, false, nullptr, false, true, false ) {} ~ProcedureCompoundTask(); diff --git a/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h b/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h index b96e1bc0..9baea5a5 100644 --- a/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h +++ b/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h @@ -17,7 +17,7 @@ private: EProgressFlagType m_type; public: ProgressFlagTask(char *flags, char mask, EProgressFlagType type, Tutorial *tutorial ) : - TutorialTask(tutorial, -1, false, NULL ), + TutorialTask(tutorial, -1, false, nullptr ), flags( flags ), m_mask( mask ), m_type( type ) {} diff --git a/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp b/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp index 29fe592d..29b77645 100644 --- a/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp +++ b/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp @@ -23,7 +23,7 @@ bool RideEntityTask::isCompleted() void RideEntityTask::onRideEntity(shared_ptr<Entity> entity) { - if (entity->instanceof((eINSTANCEOF) m_eType)) + if (entity->instanceof(static_cast<eINSTANCEOF>(m_eType))) { bIsCompleted = true; } diff --git a/Minecraft.Client/Common/Tutorial/RideEntityTask.h b/Minecraft.Client/Common/Tutorial/RideEntityTask.h index d9b6d41e..749b187f 100644 --- a/Minecraft.Client/Common/Tutorial/RideEntityTask.h +++ b/Minecraft.Client/Common/Tutorial/RideEntityTask.h @@ -13,7 +13,7 @@ protected: public: RideEntityTask(const int eTYPE, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, + bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); virtual bool isCompleted(); diff --git a/Minecraft.Client/Common/Tutorial/StatTask.cpp b/Minecraft.Client/Common/Tutorial/StatTask.cpp index 5f8b215e..c2dc82aa 100644 --- a/Minecraft.Client/Common/Tutorial/StatTask.cpp +++ b/Minecraft.Client/Common/Tutorial/StatTask.cpp @@ -6,7 +6,7 @@ #include "StatTask.h" StatTask::StatTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, Stat *stat, int variance /*= 1*/) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL ) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr ) { this->stat = stat; @@ -20,6 +20,6 @@ bool StatTask::isCompleted() return true; Minecraft *minecraft = Minecraft::GetInstance(); - bIsCompleted = minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue( stat ) >= (unsigned int)targetValue; + bIsCompleted = minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue( stat ) >= static_cast<unsigned int>(targetValue); return bIsCompleted; }
\ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/StateChangeTask.h b/Minecraft.Client/Common/Tutorial/StateChangeTask.h index fb9e6396..ab34d35d 100644 --- a/Minecraft.Client/Common/Tutorial/StateChangeTask.h +++ b/Minecraft.Client/Common/Tutorial/StateChangeTask.h @@ -9,7 +9,7 @@ private: eTutorial_State m_state; public: StateChangeTask(eTutorial_State state, - Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, + Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_state( state ) diff --git a/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp b/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp index a1a5c37a..3a318488 100644 --- a/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp +++ b/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp @@ -19,7 +19,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], u bool TakeItemHint::onTake(shared_ptr<ItemInstance> item) { - if(item != NULL) + if(item != nullptr) { bool itemFound = false; for(unsigned int i=0;i<m_iItemsCount;i++) diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Common/Tutorial/Tutorial.cpp index 60feba11..c985ef49 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Common/Tutorial/Tutorial.cpp @@ -17,6 +17,7 @@ #include "TutorialTasks.h" #include "TutorialConstraints.h" #include "TutorialHints.h" +#include "Common/UI/UI.h" vector<int> Tutorial::s_completableTasks; @@ -31,7 +32,7 @@ int Tutorial::m_iTutorialFreezeTimeValue = 8000; bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other) { - if(other == NULL) return false; + if(other == nullptr) return false; bool textTheSame = (m_messageId == other->m_messageId) && (m_messageString.compare(other->m_messageString) == 0); bool titleTheSame = (m_titleId == other->m_titleId) && (m_titleString.compare(other->m_titleString) == 0); @@ -360,12 +361,12 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) m_hintDisplayed = false; m_freezeTime = false; m_timeFrozen = false; - m_UIScene = NULL; + m_UIScene = nullptr; m_allowShow = true; m_bHasTickedOnce = false; m_firstTickTime = 0; - m_lastMessage = NULL; + m_lastMessage = nullptr; lastMessageTime = 0; m_iTaskReminders = 0; @@ -374,13 +375,13 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) m_CurrentState = e_Tutorial_State_Gameplay; m_hasStateChanged = false; #ifdef _XBOX - m_hTutorialScene=NULL; + m_hTutorialScene=nullptr; #endif for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i) { - currentTask[i] = NULL; - currentFailedConstraint[i] = NULL; + currentTask[i] = nullptr; + currentFailedConstraint[i] = nullptr; } // DEFAULT TASKS THAT ALL TUTORIALS SHARE @@ -1012,7 +1013,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); // 4J-JEV: Only force the RideEntityTask if we're on the full-tutorial. - if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, NULL, false, false, false) ); + if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, nullptr, false, false, false) ); else addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); @@ -1163,8 +1164,8 @@ Tutorial::~Tutorial() delete it; } - currentTask[i] = NULL; - currentFailedConstraint[i] = NULL; + currentTask[i] = nullptr; + currentFailedConstraint[i] = nullptr; } } @@ -1173,7 +1174,7 @@ void Tutorial::debugResetPlayerSavedProgress(int iPad) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(iPad); #else - GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(iPad); + GAME_SETTINGS *pGameSettings = static_cast<GAME_SETTINGS *>(ProfileManager.GetGameDefinedProfileData(iPad)); #endif ZeroMemory( pGameSettings->ucTutorialCompletion, TUTORIAL_PROFILE_STORAGE_BYTES ); pGameSettings->uiSpecialTutorialBitmask = 0; @@ -1202,7 +1203,7 @@ void Tutorial::setCompleted( int completableId ) #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(m_iPad); #else - GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(m_iPad); + GAME_SETTINGS *pGameSettings = static_cast<GAME_SETTINGS *>(ProfileManager.GetGameDefinedProfileData(m_iPad)); #endif int arrayIndex = completableIndex >> 3; int bitIndex = 7 - (completableIndex % 8); @@ -1235,7 +1236,7 @@ bool Tutorial::getCompleted( int completableId ) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(m_iPad); #else - GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(m_iPad); + GAME_SETTINGS *pGameSettings = static_cast<GAME_SETTINGS *>(ProfileManager.GetGameDefinedProfileData(m_iPad)); #endif int arrayIndex = completableIndex >> 3; int bitIndex = 7 - (completableIndex % 8); @@ -1362,7 +1363,7 @@ void Tutorial::tick() if(!m_allowShow) { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1412,7 +1413,7 @@ void Tutorial::tick() if(ui.IsPauseMenuDisplayed( m_iPad ) ) { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1460,12 +1461,12 @@ void Tutorial::tick() // Check constraints // Only need to update these if we aren't already failing something - if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == NULL || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) ) + if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == nullptr || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) ) { - if( currentFailedConstraint[m_CurrentState] != NULL && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) ) + if( currentFailedConstraint[m_CurrentState] != nullptr && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) ) { constraintChanged = true; - currentFailedConstraint[m_CurrentState] = NULL; + currentFailedConstraint[m_CurrentState] = nullptr; } for (auto& constraint : constraints[m_CurrentState]) { @@ -1477,7 +1478,7 @@ void Tutorial::tick() } } - if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == NULL ) + if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == nullptr ) { // Update tasks bool isCurrentTask = true; @@ -1496,7 +1497,7 @@ void Tutorial::tick() eTutorial_CompletionAction compAction = task->getCompletionAction(); it = activeTasks[m_CurrentState].erase( it ); delete task; - task = NULL; + task = nullptr; if( activeTasks[m_CurrentState].size() > 0 ) { @@ -1552,12 +1553,12 @@ void Tutorial::tick() { setStateCompleted( m_CurrentState ); - currentTask[m_CurrentState] = NULL; + currentTask[m_CurrentState] = nullptr; } taskChanged = true; // If we can complete this early, check if we can complete it right now - if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isPreCompletionEnabled() ) + if( currentTask[m_CurrentState] != nullptr && currentTask[m_CurrentState]->isPreCompletionEnabled() ) { isCurrentTask = true; } @@ -1566,7 +1567,7 @@ void Tutorial::tick() { ++it; } - if( task != NULL && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) + if( task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) { task->setShownForMinimumTime(); @@ -1587,7 +1588,7 @@ void Tutorial::tick() } } - if( currentTask[m_CurrentState] == NULL && activeTasks[m_CurrentState].size() > 0 ) + if( currentTask[m_CurrentState] == nullptr && activeTasks[m_CurrentState].size() > 0 ) { currentTask[m_CurrentState] = activeTasks[m_CurrentState][0]; currentTask[m_CurrentState]->setAsCurrentTask(); @@ -1616,17 +1617,17 @@ void Tutorial::tick() } if( constraintChanged || taskChanged || m_hasStateChanged || - (currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_lastMessage == NULL || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed) + (currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_lastMessage == nullptr || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed) ) { - if( currentFailedConstraint[m_CurrentState] != NULL ) + if( currentFailedConstraint[m_CurrentState] != nullptr ) { PopupMessageDetails *message = new PopupMessageDetails(); message->m_messageId = currentFailedConstraint[m_CurrentState]->getDescriptionId(); message->m_allowFade = false; setMessage( message ); } - else if( currentTask[m_CurrentState] != NULL ) + else if( currentTask[m_CurrentState] != nullptr ) { PopupMessageDetails *message = new PopupMessageDetails(); message->m_messageId = currentTask[m_CurrentState]->getDescriptionId(); @@ -1637,7 +1638,7 @@ void Tutorial::tick() } else { - setMessage( NULL ); + setMessage( nullptr ); } } @@ -1646,7 +1647,7 @@ void Tutorial::tick() m_hintDisplayed = false; } - if( currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() ) + if( currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() ) { // Reminder PopupMessageDetails *message = new PopupMessageDetails(); @@ -1671,7 +1672,7 @@ void Tutorial::tick() bool Tutorial::setMessage(PopupMessageDetails *message) { - if(message != NULL && !message->m_forceDisplay && + if(message != nullptr && !message->m_forceDisplay && m_lastMessageState == m_CurrentState && message->isSameContent(m_lastMessage) && ( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() && message->m_isReminder ) ) @@ -1681,7 +1682,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) return false; } - if(message != NULL && (message->m_messageId > 0 || !message->m_messageString.empty()) ) + if(message != nullptr && (message->m_messageId > 0 || !message->m_messageString.empty()) ) { m_lastMessageState = m_CurrentState; @@ -1695,7 +1696,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) else { auto it = messages.find(message->m_messageId); - if( it != messages.end() && it->second != NULL ) + if( it != messages.end() && it->second != nullptr ) { TutorialMessage *messageString = it->second; text = wstring( messageString->getMessageForDisplay() ); @@ -1725,7 +1726,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) else if(message->m_promptId >= 0) { auto it = messages.find(message->m_promptId); - if(it != messages.end() && it->second != NULL) + if(it != messages.end() && it->second != nullptr) { TutorialMessage *prompt = it->second; text.append( prompt->getMessageForDisplay() ); @@ -1754,7 +1755,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) ui.SetTutorialDescription( m_iPad, &popupInfo ); } } - else if( (m_lastMessage != NULL && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() ) + else if( (m_lastMessage != nullptr && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() ) { // This should cause the popup to dissappear TutorialPopupInfo popupInfo; @@ -1763,7 +1764,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) ui.SetTutorialDescription( m_iPad, &popupInfo ); } - if(m_lastMessage != NULL) delete m_lastMessage; + if(m_lastMessage != nullptr) delete m_lastMessage; m_lastMessage = message; return true; @@ -1777,7 +1778,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) bool messageShown = false; DWORD time = GetTickCount(); - if(message != NULL && (message->m_forceDisplay || hintsOn) && + if(message != nullptr && (message->m_forceDisplay || hintsOn) && (!message->m_delay || ( (m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) || @@ -1792,7 +1793,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) { m_lastHintDisplayedTime = time; m_hintDisplayed = true; - if(hint!=NULL) setHintCompleted( hint ); + if(hint!=nullptr) setHintCompleted( hint ); } } return messageShown; @@ -1815,7 +1816,7 @@ void Tutorial::showTutorialPopup(bool show) if(!show) { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1926,7 +1927,7 @@ void Tutorial::handleUIInput(int iAction) { if( m_hintDisplayed ) return; - if(currentTask[m_CurrentState] != NULL) + if(currentTask[m_CurrentState] != nullptr) currentTask[m_CurrentState]->handleUIInput(iAction); } @@ -1988,7 +1989,7 @@ void Tutorial::onSelectedItemChanged(shared_ptr<ItemInstance> item) // Menus and states like riding in a minecart will NOT allow this if( isSelectedItemState() ) { - if(item != NULL) + if(item != nullptr) { switch(item->id) { @@ -2151,7 +2152,7 @@ void Tutorial::AddConstraint(TutorialConstraint *c) void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= false*/) { if( currentFailedConstraint[m_CurrentState] == c ) - currentFailedConstraint[m_CurrentState] = NULL; + currentFailedConstraint[m_CurrentState] = nullptr; if( c->getQueuedForRemoval() ) { @@ -2211,16 +2212,16 @@ void Tutorial::addMessage(int messageId, bool limitRepeats /*= false*/, unsigned } #ifdef _XBOX -void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= NULL*/) +void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= nullptr*/) #else -void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= NULL*/) +void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= nullptr*/) #endif { if(newState == m_CurrentState) { // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed #ifndef _XBOX - if( scene == NULL ) + if( scene == nullptr ) { ui.RemoveInteractSceneReference(m_iPad, m_UIScene); } @@ -2241,7 +2242,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= } // The action that caused the change of state may also have completed the current task - if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() ) + if( currentTask[m_CurrentState] != nullptr && currentTask[m_CurrentState]->isCompleted() ) { activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) ); @@ -2252,21 +2253,21 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= } else { - currentTask[m_CurrentState] = NULL; + currentTask[m_CurrentState] = nullptr; } } - if( currentTask[m_CurrentState] != NULL ) + if( currentTask[m_CurrentState] != nullptr ) { currentTask[m_CurrentState]->onStateChange(newState); } // Make sure that the current message is cleared - setMessage( NULL ); + setMessage( nullptr ); // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed #ifndef _XBOX - if( scene == NULL ) + if( scene == nullptr ) { ui.RemoveInteractSceneReference(m_iPad, m_UIScene); } diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.h b/Minecraft.Client/Common/Tutorial/Tutorial.h index 169c33e3..c36a9086 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.h +++ b/Minecraft.Client/Common/Tutorial/Tutorial.h @@ -139,9 +139,9 @@ public: bool getCompleted( int completableId ); #ifdef _XBOX - void changeTutorialState(eTutorial_State newState, CXuiScene *scene = NULL); + void changeTutorialState(eTutorial_State newState, CXuiScene *scene = nullptr); #else - void changeTutorialState(eTutorial_State newState, UIScene *scene = NULL); + void changeTutorialState(eTutorial_State newState, UIScene *scene = nullptr); #endif bool isSelectedItemState(); diff --git a/Minecraft.Client/Common/Tutorial/TutorialHint.cpp b/Minecraft.Client/Common/Tutorial/TutorialHint.cpp index 5f0808bf..d80d7d16 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialHint.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialHint.cpp @@ -9,7 +9,7 @@ TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/) : m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ), - m_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade) + m_lastTile( nullptr ), m_hintNeeded( true ), m_allowFade(allowFade) { tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients); } diff --git a/Minecraft.Client/Common/Tutorial/TutorialMode.cpp b/Minecraft.Client/Common/Tutorial/TutorialMode.cpp index 82c81598..50a45a42 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialMode.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialMode.cpp @@ -15,7 +15,7 @@ TutorialMode::TutorialMode(int iPad, Minecraft *minecraft, ClientConnection *con TutorialMode::~TutorialMode() { - if(tutorial != NULL) + if(tutorial != nullptr) delete tutorial; } @@ -38,7 +38,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face) } shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem(); int damageBefore; - if(item != NULL) + if(item != nullptr) { damageBefore = item->getDamageValue(); } @@ -46,7 +46,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face) if(!tutorial->m_allTutorialsComplete) { - if ( item != NULL && item->isDamageableItem() ) + if ( item != nullptr && item->isDamageableItem() ) { int max = item->getMaxDamage(); int damageNow = item->getDamageValue(); @@ -88,7 +88,7 @@ bool TutorialMode::useItemOn(shared_ptr<Player> player, Level *level, shared_ptr if(!bTestUseOnly) { - if(item != NULL) + if(item != nullptr) { haveItem = true; itemCount = item->count; diff --git a/Minecraft.Client/Common/Tutorial/TutorialMode.h b/Minecraft.Client/Common/Tutorial/TutorialMode.h index 75e24edf..2263a91c 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialMode.h +++ b/Minecraft.Client/Common/Tutorial/TutorialMode.h @@ -19,7 +19,7 @@ public: virtual void startDestroyBlock(int x, int y, int z, int face); virtual bool destroyBlock(int x, int y, int z, int face); virtual void tick(); - virtual bool useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); + virtual bool useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=nullptr); virtual void attack(shared_ptr<Player> player, shared_ptr<Entity> entity); virtual bool isInputAllowed(int mapping); diff --git a/Minecraft.Client/Common/Tutorial/TutorialTask.cpp b/Minecraft.Client/Common/Tutorial/TutorialTask.cpp index 53fdd275..1b6d84b2 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialTask.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialTask.cpp @@ -9,7 +9,7 @@ TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePre areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ), m_bAllowFade(bAllowFade), m_bTaskReminders(bTaskReminders), m_bShowMinimumTime( bShowMinimumTime), m_bShownForMinimumTime( false ) { - if(inConstraints != NULL) + if(inConstraints != nullptr) { for(auto& constraint : *inConstraints) { diff --git a/Minecraft.Client/Common/Tutorial/UseItemTask.h b/Minecraft.Client/Common/Tutorial/UseItemTask.h index 6c729540..9c8f0192 100644 --- a/Minecraft.Client/Common/Tutorial/UseItemTask.h +++ b/Minecraft.Client/Common/Tutorial/UseItemTask.h @@ -13,7 +13,7 @@ private: public: UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); + bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); virtual bool isCompleted(); virtual void useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly=false); };
\ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/UseTileTask.h b/Minecraft.Client/Common/Tutorial/UseTileTask.h index 74b3a40c..1f72fb2e 100644 --- a/Minecraft.Client/Common/Tutorial/UseTileTask.h +++ b/Minecraft.Client/Common/Tutorial/UseTileTask.h @@ -16,9 +16,9 @@ private: public: UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); + bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); + bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); virtual bool isCompleted(); virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false); };
\ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp index 71b88479..d0217d19 100644 --- a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp +++ b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp @@ -22,13 +22,13 @@ bool XuiCraftingTask::isCompleted() switch(m_type) { case e_Crafting_SelectGroup: - if(craftScene != NULL && craftScene->getCurrentGroup() == m_group) + if(craftScene != nullptr && craftScene->getCurrentGroup() == m_group) { completed = true; } break; case e_Crafting_SelectItem: - if(craftScene != NULL && craftScene->isItemSelected(m_item)) + if(craftScene != nullptr && craftScene->isItemSelected(m_item)) { completed = true; } diff --git a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h index 2dc48709..146b1554 100644 --- a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h +++ b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h @@ -12,7 +12,7 @@ public: }; // Select group - XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, + XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_group(groupToSelect), @@ -20,7 +20,7 @@ public: {} // Select Item - XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, + XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_item(itemId), |
