- alias RXBucket to EventObject.

This commit is contained in:
Christoph Oelckers 2021-11-23 18:43:19 +01:00
parent 483b28b258
commit 9e02da6380
2 changed files with 6 additions and 39 deletions

View file

@ -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(&sect);
rxBucket[nCount] = EventObject(&sect);
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;
}
//---------------------------------------------------------------------------
//
//

View file

@ -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 {