Added Item Tests file. Added a check to make sure item loadout slot is not blank when attempting to use the item loadout slot. 95/95 tests passing. Release Build 9944.
This commit is contained in:
@@ -681,6 +681,10 @@
|
||||
<ClInclude Include="steam\steam_api_flat.h" />
|
||||
<ClInclude Include="steam\steam_api_internal.h" />
|
||||
<ClInclude Include="steam\steam_gameserver.h" />
|
||||
<ClInclude Include="TEST_DEFINES.h">
|
||||
<SubType>
|
||||
</SubType>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TextEntryLabel.h">
|
||||
<SubType>
|
||||
</SubType>
|
||||
|
||||
@@ -660,6 +660,9 @@
|
||||
<ClInclude Include="ExpandingRing.h">
|
||||
<Filter>Source Files\Effects</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TEST_DEFINES.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Player.cpp">
|
||||
|
||||
@@ -3886,7 +3886,7 @@ void AiL::SetLoadoutItem(int slot,std::string itemName){
|
||||
|
||||
bool AiL::UseLoadoutItem(int slot){
|
||||
if(slot<0||slot>GetLoadoutSize()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(GetLoadoutSize()-1)+").");
|
||||
if(GetLoadoutItem(slot).lock()->Amt()>0){
|
||||
if(!ISBLANK(GetLoadoutItem(slot).lock())&&GetLoadoutItem(slot).lock()->Amt()>0){
|
||||
Tutorial::GetTask(TutorialTaskName::USE_RECOVERY_ITEMS).I(A::ITEM_USE_COUNT)++;
|
||||
Inventory::UseItem(GetLoadoutItem(slot).lock()->ActualName());
|
||||
Inventory::AddLoadoutItemUsed(GetLoadoutItem(slot).lock()->ActualName(),slot);
|
||||
|
||||
@@ -95,6 +95,7 @@ class AiL : public olc::PixelGameEngine
|
||||
friend class Minimap;
|
||||
friend class MonsterTests::MonsterTest;
|
||||
friend class PlayerTests::PlayerTest;
|
||||
friend class ItemTests::ItemTest;
|
||||
std::unique_ptr<Player>player;
|
||||
SplashScreen splash;
|
||||
public:
|
||||
@@ -324,7 +325,7 @@ public:
|
||||
const std::string_view GetCurrentMapDisplayName()const;
|
||||
int GetCurrentChapter();
|
||||
void SetChapter(int chapter);
|
||||
const std::weak_ptr<Item>GetLoadoutItem(int slot);
|
||||
const std::weak_ptr<Item>GetLoadoutItem(int slot); //Slot range is 0-2.
|
||||
void SetLoadoutItem(int slot,std::string itemName);
|
||||
int GetLoadoutSize()const;
|
||||
void RestockLoadoutItems();
|
||||
|
||||
@@ -47,6 +47,7 @@ class ItemDrop{
|
||||
friend class AiL;
|
||||
friend class MonsterTests::MonsterTest;
|
||||
friend class PlayerTests::PlayerTest;
|
||||
friend class ItemTests::ItemTest;
|
||||
vf2d pos;
|
||||
vf2d speed{};
|
||||
float zSpeed=0;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#pragma region License
|
||||
/*
|
||||
License (OLC-3)
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions or derivations of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions or derivative works in binary form must reproduce the above
|
||||
copyright notice. This list of conditions and the following disclaimer must be
|
||||
reproduced in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright © 2024 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
#pragma endregion
|
||||
#pragma once
|
||||
|
||||
namespace PlayerTests{
|
||||
class PlayerTest;
|
||||
}
|
||||
|
||||
namespace ItemTests{
|
||||
class ItemTest;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 3
|
||||
#define VERSION_BUILD 9940
|
||||
#define VERSION_BUILD 9944
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
@@ -407,6 +407,7 @@ return 0;
|
||||
#include "Error.h"
|
||||
#include "olcUTIL_Geometry2D.h"
|
||||
#include "Pixel.h"
|
||||
#include "TEST_DEFINES.h"
|
||||
#pragma endregion
|
||||
|
||||
#define PGE_VER 225
|
||||
@@ -572,11 +573,6 @@ namespace X11
|
||||
#endif
|
||||
#pragma endregion
|
||||
|
||||
|
||||
namespace PlayerTests{
|
||||
class PlayerTest;
|
||||
}
|
||||
|
||||
// O------------------------------------------------------------------------------O
|
||||
// | olcPixelGameEngine INTERFACE DECLARATION |
|
||||
// O------------------------------------------------------------------------------O
|
||||
@@ -942,6 +938,7 @@ namespace olc
|
||||
{
|
||||
friend class ViewPort;
|
||||
friend class PlayerTests::PlayerTest;
|
||||
friend class ItemTests::ItemTest;
|
||||
struct StringDecalData{
|
||||
char c;
|
||||
vf2d sourcePos;
|
||||
|
||||
Reference in New Issue
Block a user