Beispiel #1
0
/**
 * Save a voxel stack to the save game file.
 * @param svr Output stream to write.
 */
void VoxelStack::Save(Saver &svr) const
{
	svr.StartBlock("VSTK", 3);
	svr.PutWord(this->base);
	svr.PutWord(this->height);
	svr.PutByte(this->owner);
	for (uint i = 0; i < this->height; i++) this->voxels[i].Save(svr);
	svr.EndBlock();
}
Beispiel #2
0
/**
 * Write a voxel to the save game.
 * @param svr Output stream to write.
 */
void Voxel::Save(Saver &svr) const
{
	svr.PutLong(this->ground);
	if (this->instance >= SRI_RIDES_START && this->instance < SRI_FULL_RIDES) {
		svr.PutByte(this->instance);
		svr.PutWord(this->instance_data);
	} else {
		svr.PutByte(SRI_FREE); // Full rides save their own data from the world.
	}
	svr.PutWord(this->fences);
}
Beispiel #3
0
/**
 * Save guests to the save game.
 * @param svr Output stream to save to.
 */
void Guests::Save(Saver &svr)
{
	svr.StartBlock("GSTS", 1);
	svr.PutWord(this->start_voxel.x);
	svr.PutWord(this->start_voxel.y);
	svr.PutWord(this->daily_frac);
	svr.PutWord(this->next_daily_index);
	svr.PutLong(this->free_idx);
	svr.PutLong(this->CountActiveGuests());
	for (uint i = 0; i < GUEST_BLOCK_SIZE; i++) {
		Guest *g = this->block.Get(i);
		if (g->IsActive()) {
			svr.PutWord(g->id);
			g->Save(svr);
		}
	}
	svr.EndBlock();
}
Beispiel #4
0
/**
 * Save the world to a file.
 * @param svr Output stream to save to.
 */
void VoxelWorld::Save(Saver &svr) const
{
	/* Save basic map information (rides are saved as part of the ride). */
	svr.StartBlock("WRLD", 1);
	svr.PutWord(this->GetXSize());
	svr.PutWord(this->GetYSize());
	svr.EndBlock();
	for (uint16 x = 0; x < this->GetXSize(); x++) {
		for (uint16 y = 0; y < this->GetYSize(); y++) {
			const VoxelStack *vs = this->GetStack(x, y);
			vs->Save(svr);
		}
	}
}