Skip to content

Commit 3874448

Browse files
committed
First draft for child sections
1 parent 2c4bc87 commit 3874448

14 files changed

+501
-101
lines changed

src/C4Game.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,12 @@ bool C4Game::RemoveSection(uint32_t number)
960960
std::unique_ptr<C4Section> section{std::move(*it)};
961961
Sections.erase(it);
962962
SectionsPendingDeletion.emplace_back(std::move(section));
963+
964+
for (const auto &otherSection : Sections)
965+
{
966+
otherSection->ClearSectionPointers(*section);
967+
}
968+
963969
return true;
964970
}
965971

@@ -1200,7 +1206,7 @@ void C4Game::DrawCursors(C4FacetEx &cgo, int32_t iPlayer)
12001206
for (C4Player *pPlr = Players.First; pPlr; pPlr = pPlr->Next)
12011207
if (pPlr->Number == iPlayer || iPlayer == NO_OWNER)
12021208
if (pPlr->CursorFlash || pPlr->SelectFlash)
1203-
if (pPlr->Cursor)
1209+
if (pPlr->Cursor && pPlr->Cursor->Section == pPlr->ViewSection)
12041210
{
12051211
cursor = pPlr->Cursor;
12061212
if (Inside<int32_t>(cursor->x - fctCursor.Wdt / 2 - cgo.TargetX, 1 - fctCursor.Wdt, cgo.Wdt) && Inside<int32_t>(cursor->y - cursor->Def->Shape.Hgt / 2 - fctCursor.Hgt - cgo.TargetY, 1 - fctCursor.Hgt, cgo.Hgt))

src/C4GraphicsSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ void C4GraphicsSystem::RecalculateViewports()
384384
cOffWdt = cOffHgt = 0;
385385
int32_t ViewportScrollBorder = Application.isFullScreen ? C4ViewportScrollBorder : 0;
386386

387-
C4Section &section{cvp->get()->GetViewSection()};
387+
C4Section &section{cvp->get()->GetViewRootSection()};
388388
if (ciViewsX * std::min<int32_t>(cViewWdt, section.Landscape.Width + 2 * ViewportScrollBorder) < ViewportArea.Wdt)
389389
cOffX = (ViewportArea.Wdt - ciViewsX * std::min<int32_t>(cViewWdt, section.Landscape.Width + 2 * ViewportScrollBorder)) / 2;
390390
if (iViewsH * std::min<int32_t>(cViewHgt, section.Landscape.Height + 2 * ViewportScrollBorder) < ViewportArea.Hgt)
@@ -544,7 +544,7 @@ bool C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename)
544544
// get viewport to draw in
545545
const auto &pVP = Viewports.front();
546546
// create image large enough to hold the landcape
547-
C4Landscape &landscape{pVP->GetViewSection().Landscape};
547+
C4Landscape &landscape{pVP->GetViewRootSection().Landscape};
548548
int32_t lWdt = static_cast<int32_t>(ceilf(landscape.Width * scale)), lHgt = static_cast<int32_t>(ceilf(landscape.Height * scale));
549549
StdBitmap bmp(lWdt, lHgt, false);
550550
// get backbuffer size

src/C4MainMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ bool C4MainMenu::ActivateObserver()
957957
C4Viewport *const viewport{Game.GraphicsSystem.GetViewport(NO_OWNER)};
958958
if (!viewport) return false;
959959
// Menu symbol/init
960-
InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_View), viewport->GetViewSection(), LoadResStr(C4ResStrTableKey::IDS_TEXT_VIEW), NO_OWNER, C4MN_Extra_None, 0, C4MN_Observer, C4MN_Style_Context);
960+
InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_View), viewport->GetViewRootSection(), LoadResStr(C4ResStrTableKey::IDS_TEXT_VIEW), NO_OWNER, C4MN_Extra_None, 0, C4MN_Observer, C4MN_Style_Context);
961961
SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom);
962962
// Players added in Refill
963963
Refill();

src/C4MouseControl.cpp

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,10 @@ void C4MouseControl::UpdateCursorTarget()
464464
// Movement
465465
if (!FogOfWar && !IsPassive()) Cursor = C4MC_Cursor_Crosshair;
466466

467-
C4Section &section{Viewport->GetViewSection()};
467+
const auto &[section, childX, childY] = Viewport->MapPointToChildSectionPoint(X, Y);
468468

469469
// Dig
470-
if (!FogOfWar && section.Landscape.GBackSolid(X, Y) && !IsPassive())
470+
if (!FogOfWar && section.Landscape.GBackSolid(childX, childY) && !IsPassive())
471471
{
472472
Cursor = C4MC_Cursor_Dig;
473473
if (ControlDown) Cursor = C4MC_Cursor_DigMaterial;
@@ -501,8 +501,8 @@ void C4MouseControl::UpdateCursorTarget()
501501
}
502502
// Chop (reduced range)
503503
if (ocf & OCF_Chop)
504-
if (Inside<int32_t>(X - iObjX, -TargetObject->Shape.Wdt / 3, +TargetObject->Shape.Wdt / 3))
505-
if (Inside<int32_t>(Y - iObjY, -TargetObject->Shape.Wdt / 2, +TargetObject->Shape.Wdt / 3))
504+
if (Inside<int32_t>(childX - iObjX, -TargetObject->Shape.Wdt / 3, +TargetObject->Shape.Wdt / 3))
505+
if (Inside<int32_t>(childY - iObjY, -TargetObject->Shape.Wdt / 2, +TargetObject->Shape.Wdt / 3))
506506
Cursor = C4MC_Cursor_Chop;
507507
// Enter
508508
if (ocf & OCF_Entrance)
@@ -528,11 +528,18 @@ void C4MouseControl::UpdateCursorTarget()
528528
if (pPlrCursor)
529529
if (!pPlrCursor->Contained)
530530
if (pPlrCursor->GetProcedure() == DFA_WALK)
531-
if (Inside<int32_t>(Y - pPlrCursor->y, -25, -10))
531+
{
532+
std::int32_t plrCursorSectionChildX{X};
533+
std::int32_t plrCursorSectionChildY{Y};
534+
535+
pPlrCursor->Section->ParentPointToPoint(plrCursorSectionChildX, plrCursorSectionChildY);
536+
537+
if (Inside<int32_t>(plrCursorSectionChildY - pPlrCursor->y, -25, -10))
532538
{
533-
if (Inside<int32_t>(X - pPlrCursor->x, -15, -1)) Cursor = C4MC_Cursor_JumpLeft;
534-
if (Inside<int32_t>(X - pPlrCursor->x, +1, +15)) Cursor = C4MC_Cursor_JumpRight;
539+
if (Inside<int32_t>(plrCursorSectionChildX - pPlrCursor->x, -15, -1)) Cursor = C4MC_Cursor_JumpLeft;
540+
if (Inside<int32_t>(plrCursorSectionChildX - pPlrCursor->x, +1, +15)) Cursor = C4MC_Cursor_JumpRight;
535541
}
542+
}
536543

537544
// Help
538545
if (Help)
@@ -597,7 +604,7 @@ void C4MouseControl::UpdateCursorTarget()
597604
break;
598605

599606
case C4MC_Cursor_DigMaterial:
600-
if (section.MatValid(section.Landscape.GetMat(X, Y)))
607+
if (section.MatValid(section.Landscape.GetMat(childX, childY)))
601608
{
602609
SetCaption<C4ResStrTableKey::IDS_CON_DIGOUT>(Game.Defs.ID2Def(section.Material.Map[section.Landscape.GetMat(X, Y)].Dig2Object), true);
603610
}
@@ -849,34 +856,35 @@ void C4MouseControl::DragMoving()
849856
if (UpdatePutTarget(false))
850857
return;
851858
// In liquid: drop
852-
C4Section &section{Viewport->GetViewSection()};
853-
if (section.Landscape.GBackLiquid(X, Y))
859+
const auto &[section, x, y] = Viewport->MapPointToChildSectionPoint(X, Y);
860+
if (section.Landscape.GBackLiquid(x, y))
854861
{
855862
Cursor = C4MC_Cursor_Drop; return;
856863
}
857864
// In free: drop or throw
858-
if (!section.Landscape.GBackSolid(X, Y))
865+
if (!section.Landscape.GBackSolid(x, y))
859866
{
860867
// Check drop
861-
int32_t iX = X, iY = Y;
868+
int32_t iX = x, iY = y;
862869
while ((iY < section.Landscape.Height) && !section.Landscape.GBackSolid(iX, iY)) iY++;
863-
if (Inside<int32_t>(X - iX, -5, +5) && Inside<int32_t>(Y - iY, -5, +5))
870+
if (Inside<int32_t>(x - iX, -5, +5) && Inside<int32_t>(y - iY, -5, +5))
864871
{
865872
Cursor = C4MC_Cursor_Drop; return;
866873
}
867874
// Throwing physical
868875
C4Fixed fixThrow = ValByPhysical(400, 50000);
869876
if (pPlayer->Cursor) fixThrow = ValByPhysical(400, pPlayer->Cursor->GetPhysical()->Throw);
870877
// Preferred throwing direction
871-
int32_t iDir = +1; if (pPlayer->Cursor) if (pPlayer->Cursor->x > X) iDir = -1;
878+
int32_t iDir = +1; if (pPlayer->Cursor) if (pPlayer->Cursor->x > x) iDir = -1;
872879
// Throwing height
873880
int32_t iHeight = 20; if (pPlayer->Cursor) iHeight = pPlayer->Cursor->Shape.Hgt;
874881
// Check throw
875-
if (section.Landscape.FindThrowingPosition(X, Y, fixThrow * iDir, -fixThrow, iHeight, iX, iY)
876-
|| section.Landscape.FindThrowingPosition(X, Y, fixThrow * (iDir *= -1), -fixThrow, iHeight, iX, iY))
882+
if (section.Landscape.FindThrowingPosition(x, y, fixThrow * iDir, -fixThrow, iHeight, iX, iY)
883+
|| section.Landscape.FindThrowingPosition(x, y, fixThrow * (iDir *= -1), -fixThrow, iHeight, iX, iY))
877884
{
878885
Cursor = (iDir == -1) ? C4MC_Cursor_ThrowLeft : C4MC_Cursor_ThrowRight;
879886
ShowPointX = iX; ShowPointY = iY;
887+
section.PointToParentPoint(ShowPointX, ShowPointY);
880888
return;
881889
}
882890
}
@@ -1225,6 +1233,8 @@ void C4MouseControl::SendCommand(int32_t iCommand, int32_t iX, int32_t iY, C4Obj
12251233
if (!pPlr || pPlr->Eliminated) return;
12261234
// User add multiple command mode
12271235
if (ShiftDown) iAddMode |= C4P_Command_Append;
1236+
// Map coordinates
1237+
pPlr->ViewSection.Denumerated()->ParentPointToPoint(iX, iY);
12281238
// Command to control queue
12291239
Game.Input.Add(CID_PlrCommand,
12301240
new C4ControlPlayerCommand(Player, iCommand, iX, iY, pTarget, pTarget2, iData, iAddMode));
@@ -1271,7 +1281,8 @@ void C4MouseControl::UpdateFogOfWar()
12711281
// Assume no fog of war
12721282
FogOfWar = false;
12731283
// Check for fog of war
1274-
if ((pPlayer->fFogOfWar && !pPlayer->FoWIsVisible(X, Y)) || X < 0 || Y < 0 || X >= Viewport->GetViewSection().Landscape.Width || Y >= Viewport->GetViewSection().Landscape.Height)
1284+
C4Section &rootSection{pPlayer->ViewSection->GetRootSection()};
1285+
if (X < 0 || Y < 0 || X >= rootSection.Landscape.Width || Y >= rootSection.Landscape.Height || (pPlayer->fFogOfWar && !pPlayer->FoWIsVisible(X, Y)))
12751286
{
12761287
FogOfWar = true;
12771288
// allow dragging, scrolling, region selection and manipulations of objects not affected by FoW
@@ -1321,10 +1332,12 @@ const char *C4MouseControl::GetCaption()
13211332
C4Object *C4MouseControl::GetTargetObject(int32_t iX, int32_t iY, uint32_t &dwOCF, C4Object *pExclude)
13221333
{
13231334
// find object
1324-
C4Object *pObj = Viewport->GetViewSection().FindVisObject(ViewX, ViewY, Player, fctViewport, iX, iY, 0, 0, dwOCF, pExclude);
1335+
const auto &[section, x, y] = Viewport->MapPointToChildSectionPoint(iX, iY);
1336+
1337+
C4Object *pObj = section.FindVisObject(ViewX, ViewY, Player, fctViewport, x, y, 0, 0, dwOCF, pExclude);
13251338
if (!pObj) return nullptr;
13261339
// adjust OCF
1327-
pObj->GetOCFForPos(iX, iY, dwOCF);
1340+
pObj->GetOCFForPos(x, y, dwOCF);
13281341
return pObj;
13291342
}
13301343

src/C4Object.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5848,6 +5848,20 @@ void C4Object::UnSelect(bool fCursor)
58485848
Call(PSF_CrewSelection, {C4VBool(true), C4VBool(fCursor)});
58495849
}
58505850

5851+
void C4Object::GetViewPos(int32_t &riX, int32_t &riY, int32_t tx, int32_t ty, const C4Facet &fctViewport) // get position this object is seen at (for given scroll)
5852+
{
5853+
if (Category & C4D_Parallax)
5854+
{
5855+
GetViewPosPar(riX, riY, tx, ty, fctViewport);
5856+
}
5857+
else
5858+
{
5859+
riX = x; riY = y;
5860+
}
5861+
5862+
Section->PointToParentPoint(riX, riY);
5863+
}
5864+
58515865
void C4Object::GetViewPosPar(int32_t &riX, int32_t &riY, int32_t tx, int32_t ty, const C4Facet &fctViewport)
58525866
{
58535867
int iParX = Local[0].getInt(), iParY = Local[1].getInt();

src/C4Object.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,7 @@ class C4Object
410410
bool DoSelect(bool fCursor = false); // select in crew (or just set cursor) if not disabled
411411
void UnSelect(bool fCursor = false); // unselect in crew (or just task away cursor)
412412

413-
void GetViewPos(int32_t &riX, int32_t &riY, int32_t tx, int32_t ty, const C4Facet &fctViewport) // get position this object is seen at (for given scroll)
414-
{
415-
if (Category & C4D_Parallax) GetViewPosPar(riX, riY, tx, ty, fctViewport); else { riX = x; riY = y; }
416-
}
413+
void GetViewPos(int32_t &riX, int32_t &riY, int32_t tx, int32_t ty, const C4Facet &fctViewport);
417414

418415
void GetViewPosPar(int32_t &riX, int32_t &riY, int32_t tx, int32_t ty, const C4Facet &fctViewport); // get position this object is seen at, calculating parallaxity
419416
bool PutAwayUnusedObject(C4Object *pToMakeRoomForObject); // either directly put the least-needed object away, or add a command to do it - return whether successful

src/C4Player.cpp

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,7 @@ void C4Player::UpdateView()
17231723
{
17241724
ViewX = pViewObj->x; ViewY = pViewObj->y;
17251725
ViewSection = pViewObj->Section;
1726+
ViewSection->PointToParentPoint(ViewX, ViewY);
17261727
}
17271728
break;
17281729
}
@@ -1731,6 +1732,7 @@ void C4Player::UpdateView()
17311732
{
17321733
ViewX = ViewTarget->x; ViewY = ViewTarget->y;
17331734
ViewSection = ViewTarget->Section;
1735+
ViewSection->PointToParentPoint(ViewX, ViewY);
17341736
}
17351737
break;
17361738
case C4PVM_Scrolling:
@@ -1945,48 +1947,106 @@ void C4Player::InitControl(C4Section &initialSection)
19451947
PressedComs = 0;
19461948
}
19471949

1950+
namespace
1951+
{
1952+
struct ObjectInSection
1953+
{
1954+
ObjectInSection(const C4Section &viewRootSection, const C4Object &obj) noexcept
1955+
: ObjX{obj.x}, ObjY{obj.y}
1956+
{
1957+
if (obj.Contained && obj.Contained->Def->ClosedContainer == 1)
1958+
{
1959+
visibleToEachOther = false;
1960+
}
1961+
else if (&viewRootSection == obj.Section)
1962+
{
1963+
visibleToEachOther = true;
1964+
}
1965+
else if (obj.Section->IsChildOf(viewRootSection))
1966+
{
1967+
visibleToEachOther = true;
1968+
obj.Section->PointToParentPoint(ObjX, ObjY, &viewRootSection);
1969+
}
1970+
else
1971+
{
1972+
visibleToEachOther = false;
1973+
}
1974+
}
1975+
1976+
explicit operator bool() const noexcept { return visibleToEachOther; }
1977+
1978+
public:
1979+
std::int32_t ObjX;
1980+
std::int32_t ObjY;
1981+
1982+
private:
1983+
bool visibleToEachOther;
1984+
};
1985+
}
1986+
19481987
void C4Player::FoW2Map(CClrModAddMap &rMap, int iOffX, int iOffY)
19491988
{
19501989
// No fog of war
19511990
if (!fFogOfWar) return;
19521991
// Add view for all FoW-repellers - keep track of FoW-generators, which should be avaluated finally
19531992
// so they override repellers
1993+
C4Section &viewRootSection{ViewSection->GetRootSection()};
19541994
bool fAnyGenerators = false;
19551995
C4Object *cobj; C4ObjectLink *clnk;
19561996
for (clnk = FoWViewObjs.First; clnk && (cobj = clnk->Obj); clnk = clnk->Next)
1957-
if (cobj->Section == ViewSection && (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1))
1997+
{
1998+
if (const ObjectInSection objInSection{viewRootSection, *cobj}; objInSection)
1999+
{
19582000
if (cobj->PlrViewRange > 0)
1959-
rMap.ReduceModulation(cobj->x + iOffX, cobj->y + iOffY, cobj->PlrViewRange * 2 / 3, cobj->PlrViewRange);
2001+
{
2002+
rMap.ReduceModulation(objInSection.ObjX + iOffX, objInSection.ObjY + iOffY, cobj->PlrViewRange * 2 / 3, cobj->PlrViewRange);
2003+
}
19602004
else
2005+
{
19612006
fAnyGenerators = true;
2007+
}
2008+
}
2009+
}
19622010
// Add view for target view object
19632011
if (ViewMode == C4PVM_Target)
2012+
{
19642013
if (ViewTarget)
1965-
if (!ViewTarget->Contained || ViewTarget->Contained->Def->ClosedContainer != 1)
2014+
{
2015+
if (const ObjectInSection objInSection{viewRootSection, *ViewTarget}; objInSection)
19662016
{
19672017
int iRange = ViewTarget->PlrViewRange;
19682018
if (!iRange && Cursor) iRange = Cursor->PlrViewRange;
19692019
if (!iRange) iRange = C4FOW_Def_View_RangeX;
1970-
rMap.ReduceModulation(ViewTarget->x + iOffX, ViewTarget->y + iOffY, iRange * 2 / 3, iRange);
2020+
2021+
rMap.ReduceModulation(objInSection.ObjX + iOffX, objInSection.ObjY + iOffY, iRange * 2 / 3, iRange);
19712022
}
2023+
}
2024+
}
19722025
// apply generators
19732026
// do this check, be cause in 99% of all normal scenarios, there will be no FoW-generators
1974-
if (fAnyGenerators) FoWGenerators2Map(rMap, iOffX, iOffY);
2027+
if (fAnyGenerators) FoWGenerators2Map(rMap, viewRootSection, iOffX, iOffY);
19752028
}
19762029

1977-
void C4Player::FoWGenerators2Map(CClrModAddMap &rMap, int iOffX, int iOffY)
2030+
void C4Player::FoWGenerators2Map(CClrModAddMap &rMap, C4Section &viewRootSection, int iOffX, int iOffY)
19782031
{
19792032
// add fog to any generator pos (view range
19802033
C4Object *cobj; C4ObjectLink *clnk;
19812034
for (clnk = FoWViewObjs.First; clnk && (cobj = clnk->Obj); clnk = clnk->Next)
1982-
if (cobj->Section == ViewSection && (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1))
1983-
if (cobj->PlrViewRange < 0)
1984-
rMap.AddModulation(cobj->x + iOffX, cobj->y + iOffY, -cobj->PlrViewRange, -cobj->PlrViewRange + 200, cobj->ColorMod >> 24);
2035+
{
2036+
if (cobj->PlrViewRange < 0)
2037+
{
2038+
if (const ObjectInSection objInSection{viewRootSection, *cobj}; objInSection)
2039+
{
2040+
rMap.AddModulation(objInSection.ObjX + iOffX, objInSection.ObjY + iOffY, -cobj->PlrViewRange, -cobj->PlrViewRange + 200, cobj->ColorMod >> 24);
2041+
}
2042+
}
2043+
}
19852044
}
19862045

19872046
bool C4Player::FoWIsVisible(int32_t x, int32_t y)
19882047
{
19892048
// check repellers and generators and ViewTarget
2049+
C4Section &viewRootSection{ViewSection->GetRootSection()};
19902050
bool fSeen = false;
19912051
C4Object *cobj = nullptr; C4ObjectLink *clnk;
19922052
clnk = FoWViewObjs.First;
@@ -2008,15 +2068,17 @@ bool C4Player::FoWIsVisible(int32_t x, int32_t y)
20082068
if (!iRange && Cursor) iRange = Cursor->PlrViewRange;
20092069
if (!iRange) iRange = C4FOW_Def_View_RangeX;
20102070
}
2011-
if (cobj->Section == ViewSection && (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1))
2012-
if (Distance(cobj->x, cobj->y, x, y) < Abs(iRange))
2071+
if (const ObjectInSection objInSection{viewRootSection, *cobj}; objInSection)
2072+
{
2073+
if (Distance(objInSection.ObjX, objInSection.ObjY, x, y) < Abs(iRange))
20132074
if (iRange < 0)
20142075
{
20152076
if (!(cobj->ColorMod & 0xff000000)) // faded generators generate darkness only; no FoW blocking
20162077
return false; // shadowed by FoW-generator
20172078
}
20182079
else
20192080
fSeen = true; // made visible by FoW-repeller
2081+
}
20202082
}
20212083
return fSeen;
20222084
}

src/C4Player.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class C4Player : public C4PlayerInfoCore
233233
void EvaluateLeague(bool fDisconnected, bool fWon);
234234

235235
void FoW2Map(CClrModAddMap &rMap, int iOffX, int iOffY);
236-
void FoWGenerators2Map(CClrModAddMap &rMap, int iOffX, int iOffY);
236+
void FoWGenerators2Map(CClrModAddMap &rMap, C4Section &viewRootSection, int iOffX, int iOffY);
237237
bool FoWIsVisible(int32_t x, int32_t y); // check whether a point in the landscape is visible
238238

239239
// runtime statistics

src/C4Rect.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ class C4Rect
3737
void Add(const C4Rect &r2);
3838
bool operator==(const C4Rect &r2) const { return !((x - r2.x) | (y - r2.y) | (Wdt - r2.Wdt) | (Hgt - r2.Hgt)); }
3939

40-
bool Contains(int32_t iX, int32_t iY)
40+
constexpr bool Contains(int32_t iX, int32_t iY) const noexcept
4141
{
4242
return iX >= x && iX < x + Wdt && iY >= y && iY < y + Hgt;
4343
}
4444

45-
bool Contains(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)
45+
constexpr bool Contains(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt) const noexcept
4646
{
4747
return iX >= x && iX + iWdt < x + Wdt && iY >= y && iY + iHgt < y + Hgt;
4848
}
4949

50-
bool Contains(const C4Rect &rect)
50+
constexpr bool Contains(const C4Rect &rect) const noexcept
5151
{
5252
return Contains(rect.x, rect.y, rect.Wdt, rect.Hgt);
5353
}

0 commit comments

Comments
 (0)