From d43ebd22ae540fd7c3f9961448f5541bbbb16120 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 24 Nov 2022 18:05:47 +0100 Subject: [PATCH] - fixed merge errors from backend update. --- source/common/utility/tarray.h | 7 +++++++ source/games/duke/src/sounds.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/common/utility/tarray.h b/source/common/utility/tarray.h index dbd63002b..1df7e5d39 100644 --- a/source/common/utility/tarray.h +++ b/source/common/utility/tarray.h @@ -316,9 +316,16 @@ public: // Returns a reference to the last element T &Last() const { + assert(Count > 0); return Array[Count-1]; } + T SafeGet (size_t index, const T& defaultval) const + { + if (index <= Count) return Array[index]; + else return defaultval; + } + // returns address of first element T *Data() const { diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 50ed8c411..8f210771b 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -318,7 +318,7 @@ void S_GetCamera(DVector3* c, DAngle* ca, sectortype** cs) if (ud.cameraactor == nullptr) { auto p = &ps[screenpeek]; - if (c) *c = p->actor->spr.pos; + if (c) *c = p->pos; if (cs) *cs = p->cursector; if (ca) *ca = p->angle.ang; }