Refactor neighboring rooms sync-ups. Remove all of the neighboring room objects and recreate them, which fixes a bunch of problems with objects becoming out-of-frame after resize.

This commit is contained in:
elasota
2020-04-05 18:34:37 -04:00
parent b827048c36
commit d7353ff6ed
8 changed files with 163 additions and 27 deletions

View File

@@ -0,0 +1,21 @@
#pragma once
#include <stdint.h>
namespace PortabilityLayer
{
class ArrayTools
{
public:
template<class T, class TSize, class TIndex>
static void RemoveFromArray(T *arr, TSize &count, TIndex index)
{
TSize countCopy = count;
countCopy--;
if (countCopy != index)
arr[index] = arr[countCopy];
count = static_cast<TSize>(countCopy);
}
};
}

View File

@@ -146,6 +146,7 @@
<ClInclude Include="AEHandlerDesc.h" />
<ClInclude Include="AEManager.h" />
<ClInclude Include="AntiAliasTable.h" />
<ClInclude Include="ArrayTools.h" />
<ClInclude Include="BinarySearch.h" />
<ClInclude Include="BinHex4.h" />
<ClInclude Include="BitmapImage.h" />

View File

@@ -480,6 +480,9 @@
<ClInclude Include="TextPlacer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ArrayTools.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CFileStream.cpp">