[ZoneBuilder] Correctly store arrays

This commit is contained in:
momo5502 2016-12-24 18:37:27 +01:00
parent 61339350c1
commit fb17f5ec90
2 changed files with 18 additions and 6 deletions

View File

@ -126,9 +126,13 @@ namespace Assets
AssertSize(Game::cplane_t, 20); AssertSize(Game::cplane_t, 20);
buffer->align(Utils::Stream::ALIGN_4); buffer->align(Utils::Stream::ALIGN_4);
builder->storePointer(asset->planes);
buffer->saveArray(asset->planes, world->planeCount); for (int i = 0; i < world->planeCount; ++i)
{
builder->storePointer(&asset->planes[i]);
buffer->save(&asset->planes[i]);
}
Utils::Stream::ClearPointer(&dest->planes); Utils::Stream::ClearPointer(&dest->planes);
} }
} }
@ -655,9 +659,13 @@ namespace Assets
else else
{ {
buffer->align(Utils::Stream::ALIGN_2); buffer->align(Utils::Stream::ALIGN_2);
builder->storePointer(aabbTree->smodelIndexes);
buffer->saveArray(aabbTree->smodelIndexes, aabbTree->smodelIndexCount); for (int k = 0; k < aabbTree->smodelIndexCount; ++k)
{
builder->storePointer(&aabbTree->smodelIndexes[k]);
buffer->save(&aabbTree->smodelIndexes[k]);
}
Utils::Stream::ClearPointer(&destAabbTree->smodelIndexes); Utils::Stream::ClearPointer(&destAabbTree->smodelIndexes);
} }
} }

View File

@ -217,9 +217,13 @@ namespace Assets
else else
{ {
buffer->align(Utils::Stream::ALIGN_2); buffer->align(Utils::Stream::ALIGN_2);
builder->storePointer(node[i].data.brushes);
buffer->saveArray(node[i].data.brushes, node[i].leafBrushCount); for (short j = 0; j < node[i].leafBrushCount; ++j)
{
builder->storePointer(&node[i].data.brushes[j]);
buffer->save(&node[i].data.brushes[j]);
}
Utils::Stream::ClearPointer(&node[i].data.brushes); Utils::Stream::ClearPointer(&node[i].data.brushes);
} }
} }