Fix TileGroup forward declaration issue. Migrate EnchantTests.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Failing after 2m27s
Emscripten Build / UnitTesting (push) Failing after 8m42s

This commit is contained in:
AMay 2026-04-30 16:36:31 -05:00
parent f458814887
commit 875b22cc2d
12 changed files with 1349 additions and 32 deletions

View File

@ -861,6 +861,7 @@
</ClCompile>
<ClCompile Include="Crab.cpp" />
<ClCompile Include="EffectTests.cpp" />
<ClCompile Include="EnchantTests.cpp" />
<ClCompile Include="Entity.cpp">
<SubType>
</SubType>

View File

@ -1406,6 +1406,9 @@
<ClCompile Include="EffectTests.cpp">
<Filter>Source Files\Unit Tests</Filter>
</ClCompile>
<ClCompile Include="EnchantTests.cpp">
<Filter>Source Files\Unit Tests</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

View File

@ -62,6 +62,7 @@ All rights reserved.
#include "Overlay.h"
#include <variant>
#include"safemap.h"
#include"TileGroup.h"
#undef KEY_MENU
#undef KEY_SELECT

View File

@ -67,9 +67,6 @@ private:
using EffectData=EffectManager::EffectData;
class EffectTests;
template<typename T>
struct EffectRef{
public:

File diff suppressed because it is too large Load Diff

View File

@ -110,7 +110,7 @@ namespace Game{
namespace Test
{
template<class T>
inline static void InRange(T initialVal,std::pair<T,T>range,std::wstring_view assertMessage){
REQUIRE(initialVal>=range.first&&initialVal<=range.second);
inline static void InRange(T initialVal,std::pair<T,T>range){
REQUIRE((((initialVal)>=range.first)&&((initialVal)<=range.second)));
}
}

View File

@ -171,10 +171,6 @@ namespace PlayerTests{
class PlayerTest;
};
namespace EnchantTests{
class EnchantTest;
};
using IncreaseAmount=int;
using RefineResult=std::pair<ItemAttribute,IncreaseAmount>;
@ -186,7 +182,6 @@ class Item{
friend void Merchant::PurchaseItem(IT item,uint32_t amt);
friend void Merchant::SellItem(std::weak_ptr<Item>,uint32_t amt);
friend class PlayerTests::PlayerTest;
friend class EnchantTests::EnchantTest;
public:
static const std::string BLANK_ITEM_NAME;
Item();
@ -264,7 +259,11 @@ public:
static const bool SelectedEquipIsDifferent(const std::weak_ptr<Item>equipAttemptingToEquip,const EquipSlot slotToEquipTo);
static std::vector<std::string>GetItemCategories();
const std::optional<std::string>&FragmentIcon()const;
#ifndef UNIT_TESTING
private:
#else
public:
#endif
//The amount in the current item stack.
uint32_t amt;
uint8_t enhancementLevel;

View File

@ -38,7 +38,6 @@ All rights reserved.
#include "Map.h"
#include "AdventuresInLestoria.h"
#include "safemap.h"
#include"TileGroupDataFile.h"
INCLUDE_game

View File

@ -1 +1,22 @@
#pragma once
#include"olcUTIL_Geometry2D.h"
struct TileGroup{
friend class TileGroupDataFile;
private:
geom2d::rect<int>range;
geom2d::rect<float>collisionRange={{},{}};
std::vector<TileRenderData>tiles;
int minX=0,minY=0,maxX=0,maxY=0;
public:
static float FADE_TIME;
//0-255. 255 indicates fully invisible.
static uint8_t FADE_AMT;
geom2d::rect<float>GetCollisionRange();
geom2d::rect<int>GetRange();
//The fade range is the bounds in which this tile group will be considered "in range" of a player, one tile in each direction further than its actual range.
geom2d::rect<int>GetFadeRange();
std::vector<TileRenderData>&GetTiles();
void InsertTile(TileRenderData tile);
float fadeFactor=0.f;
};

View File

@ -46,26 +46,6 @@ All rights reserved.
INCLUDE_PACK_KEY
INCLUDE_game
struct TileGroup{
friend class TileGroupDataFile;
private:
geom2d::rect<int>range;
geom2d::rect<float>collisionRange={{},{}};
std::vector<TileRenderData>tiles;
int minX=0,minY=0,maxX=0,maxY=0;
public:
static float FADE_TIME;
//0-255. 255 indicates fully invisible.
static uint8_t FADE_AMT;
geom2d::rect<float>GetCollisionRange();
geom2d::rect<int>GetRange();
//The fade range is the bounds in which this tile group will be considered "in range" of a player, one tile in each direction further than its actual range.
geom2d::rect<int>GetFadeRange();
std::vector<TileRenderData>&GetTiles();
void InsertTile(TileRenderData tile);
float fadeFactor=0.f;
};
enum TileReadTag:uint32_t{
TILESET_NAME,
FIRSTGID,

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 13446
#define VERSION_BUILD 13458
#define stringify(a) stringify_(a)
#define stringify_(a) #a

View File

@ -17997,7 +17997,9 @@ using Catch::Detail::Approx;
#endif
#ifdef UNIT_TESTING
#define TEST(cl,testCaseName) TEST_CASE_METHOD(cl,"["#cl"] "#testCaseName)
#define APPROX(val,err) Approx(val).epsilon(err)
#else
#define TEST(cl,testCaseName) void UnusedFunc##cl()
#define REQUIRE(condition)
#define APPROX(val,err)
#endif