Migrate vectors

FossilOrigin-Name: 853e760619bc8b16ee0262c55740ba82bd7efdc508357d544a6f59f450a155a7
This commit is contained in:
Jonathan Schleifer 2025-03-16 00:05:52 +00:00
parent 9dff5ec70c
commit a67b134eb2
2 changed files with 24 additions and 17 deletions

View file

@ -189,15 +189,16 @@ calclight()
VARP(dynlight, 0, 16, 32);
vector<block *> dlights;
static OFMutableData *dlights;
void
cleardlights()
{
while (!dlights.empty()) {
block *backup = dlights.pop();
while (dlights.count > 0) {
block *backup = *(block **)[dlights lastItem];
[dlights removeLastItem];
blockpaste(*backup);
free(backup);
OFFreeMemory(backup);
}
}
@ -227,7 +228,13 @@ dodynlight(const OFVector3D &vold, const OFVector3D &v, int reach, int strength,
if (b.ys + b.y > ssize - 2)
b.ys = ssize - 2 - b.y;
dlights.add(blockcopy(b)); // backup area before rendering in dynlight
if (dlights == nil)
dlights =
[[OFMutableData alloc] initWithItemSize:sizeof(block *)];
// backup area before rendering in dynlight
block *copy = blockcopy(b);
[dlights addItem:&copy];
persistent_entity l = { (short)v.x, (short)v.y, (short)v.z,
(short)reach, LIGHT, (uchar)strength, 0, 0 };