本文整理汇总了C++中Loader::SetFailMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ Loader::SetFailMessage方法的具体用法?C++ Loader::SetFailMessage怎么用?C++ Loader::SetFailMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::SetFailMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
/**
* Load the world from a file.
* @param ldr Input stream to read from.
*/
void VoxelWorld::Load(Loader &ldr)
{
uint32 version = ldr.OpenBlock("WRLD");
uint16 xsize = 64;
uint16 ysize = 64;
if (version == 1) {
xsize = ldr.GetWord();
ysize = ldr.GetWord();
} else if (version != 0) {
ldr.SetFailMessage("Unknown world version.");
}
if (xsize >= WORLD_X_SIZE || ysize >= WORLD_Y_SIZE) {
xsize = std::min<uint16>(xsize, WORLD_X_SIZE);
ysize = std::min<uint16>(ysize, WORLD_Y_SIZE);
ldr.SetFailMessage("Incorrect world size");
}
ldr.CloseBlock();
this->SetWorldSize(xsize, ysize);
if (!ldr.IsFail() && version != 0) {
for (uint16 x = 0; x < xsize; x++) {
for (uint16 y = 0; y < ysize; y++) {
VoxelStack *vs = this->GetModifyStack(x, y);
vs->Load(ldr);
}
}
}
if (version == 0 || ldr.IsFail()) this->MakeFlatWorld(8);
}
示例2: Load
/**
* 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();
}