From 9e02da6380008f51fdc1cadeb37fda32923e25f4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 23 Nov 2021 18:43:19 +0100 Subject: [PATCH] - alias RXBucket to EventObject. --- source/games/blood/src/eventq.cpp | 26 ++++---------------------- source/games/blood/src/eventq.h | 19 ++----------------- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/source/games/blood/src/eventq.cpp b/source/games/blood/src/eventq.cpp index 9fd74c08e..661e67ec7 100644 --- a/source/games/blood/src/eventq.cpp +++ b/source/games/blood/src/eventq.cpp @@ -285,8 +285,7 @@ void evInit() if (sect.hasX() && sect.xs().rxID > 0) { assert(nCount < kChannelMax); - rxBucket[nCount].type = SS_SECTOR; - rxBucket[nCount].rxindex = sectnum(§); + rxBucket[nCount] = EventObject(§); nCount++; } } @@ -296,8 +295,7 @@ void evInit() if (wal.hasX() && wal.xw().rxID > 0) { assert(nCount < kChannelMax); - rxBucket[nCount].type = SS_WALL; - rxBucket[nCount].rxindex = wallnum(&wal); + rxBucket[nCount] = EventObject(&wal); nCount++; } } @@ -308,13 +306,10 @@ void evInit() if (actor->hasX() && actor->x().rxID > 0) { assert(nCount < kChannelMax); - rxBucket[nCount].type = SS_SPRITE; - rxBucket[nCount].rxindex = 0; - rxBucket[nCount].rxactor = actor; + rxBucket[nCount] = EventObject(actor); nCount++; } } - SortRXBucket(nCount); bucketCount = nCount; createBucketHeads(); @@ -484,8 +479,7 @@ void evSend(const EventObject& eob, int rxId, COMMAND_ID command) #endif for (int i = bucketHead[rxId]; i < bucketHead[rxId + 1]; i++) { - EventObject eo; - eo.fromElements(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].rxactor); + auto eo = rxBucket[i]; if (!event.event_isObject(eo)) { if (eo.isSector()) @@ -712,18 +706,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, EVENT& w, EVENT* d return arc; } -FSerializer& Serialize(FSerializer& arc, const char* keyname, RXBUCKET& w, RXBUCKET* def) -{ - if (arc.BeginObject(keyname)) - { - arc("type", w.type); - if (w.type != SS_SPRITE) arc("index", w.rxindex); - else arc("index", w.rxactor); - arc.EndObject(); - } - return arc; -} - //--------------------------------------------------------------------------- // // diff --git a/source/games/blood/src/eventq.h b/source/games/blood/src/eventq.h index dcc7e8ae2..b789d0bb0 100644 --- a/source/games/blood/src/eventq.h +++ b/source/games/blood/src/eventq.h @@ -121,23 +121,8 @@ enum { kChannelMax = 4096, }; -struct RXBUCKET -{ - DBloodActor* actor() const { return rxactor; } - DBloodActor* rxactor; - int rxindex; - uint8_t type; - - bool isActor() const { return type == 3/*OBJ_SPRITE*/; } - bool isSector() const { return type == 6/*OBJ_SECTOR*/; } - bool isWall() const { return type == 0/*OBJ_WALL*/; } - - sectortype* sector() const { assert(isSector()); return &::sector[rxindex]; } - walltype* wall() const { assert(isWall()); return &::wall[rxindex]; } - FString description() const { return "placeholder"; } // Just to have the method. No need to implement it. - -}; -extern RXBUCKET rxBucket[]; +using RXBUCKET = EventObject; +extern EventObject rxBucket[]; extern unsigned short bucketHead[]; enum COMMAND_ID {