Exemplo n.º 1
0
/**
 * Load guests from the save game.
 * @param ldr Input stream to read.
 */
void Guests::Load(Loader &ldr)
{
	uint32 version = ldr.OpenBlock("GSTS");
	if (version == 1) {
		this->start_voxel.x = ldr.GetWord();
		this->start_voxel.y = ldr.GetWord();
		this->daily_frac = ldr.GetWord();
		this->next_daily_index = ldr.GetWord();
		this->free_idx = ldr.GetLong();
		uint active_guest_count = ldr.GetLong();
		for (uint i = 0; i < active_guest_count; i++) {
			Guest *g = this->block.Get(ldr.GetWord());
			g->Load(ldr);
		}
	} else {
		ldr.SetFailMessage("Incorrect version of Guests block.");
	}
	ldr.CloseBlock();
}
Exemplo n.º 2
0
/**
 * Load a voxel from the save game.
 * @param ldr Input stream to read.
 * @param version Version to load.
 */
void Voxel::Load(Loader &ldr, uint32 version)
{
	this->ClearVoxel();
	if (version >= 1 && version <= 3) {
		this->ground = ldr.GetLong(); /// \todo Check sanity of the data.
		this->instance = ldr.GetByte();
		if (this->instance == SRI_FREE) {
			this->instance_data = 0; // Full rides load after the world, overwriting map data.
		} else if (this->instance >= SRI_RIDES_START && this->instance < SRI_FULL_RIDES) {
			this->instance_data = ldr.GetWord();
		} else {
			this->instance_data = 0; // Full rides load after the world, overwriting map data.
			ldr.SetFailMessage("Unknown voxel instance data");
		}

		if (version >= 2) this->fences = ldr.GetWord();
	} else {
		ldr.SetFailMessage("Unknown voxel version");
	}
}