本文整理汇总了C++中TCODZip::saveToFile方法的典型用法代码示例。如果您正苦于以下问题:C++ TCODZip::saveToFile方法的具体用法?C++ TCODZip::saveToFile怎么用?C++ TCODZip::saveToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCODZip
的用法示例。
在下文中一共展示了TCODZip::saveToFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
void Engine::save()
{
if (player->destructible->isDead())
{
TCODSystem::deleteFile("game.sav");
}
else
{
TCODZip zip;
//save the map first
zip.putInt(map->width);
zip.putInt(map->height);
map->save(zip);
//then the player
player->save(zip);
//then the stairs
stairs->save(zip);
//then all the other actors
zip.putInt(map->actors.size()-2);
for (Actor **i=map->actors.begin(); i!=map->actors.end(); i++)
{
if (*i!=player && *i!=stairs)
{
(*i)->save(zip);
}
}
// finally the message log
topGui->save(zip);
zip.saveToFile("game.sav");
}
}
示例2:
void
Engine::Save() {
if(player->destructible->IsDead()) {
TCODSystem::deleteFile("game.sav");
}
else {
TCODZip zip;
zip.putInt(SAVEGAME_VERSION);
zip.putInt(map->width);
zip.putInt(map->height);
map->Save(zip);
player->Save(zip);
zip.putInt(allActors.size() - 2);
for(Actor** it = allActors.begin(); it != allActors.end(); ++it) {
if(*it != player) {
(*it)->Save(zip);
}
}
gui->Save(zip);
zip.saveToFile("game.sav");
}
}
示例3: save
void Engine::save() {
if (player->destructible->isDead() ){
TCODSystem::deleteFile("game.sav");
}else {
TCODZip zip;
//save the map
zip.putInt(map->width);
zip.putInt(map->height);
map->save(zip);
//then the player
player->save(zip);
//All the other actors
zip.putInt(actors.size()-1);
for (Actor **iterator=actors.begin(); iterator!=actors.end();
iterator++){
if(*iterator != player){
(*iterator)->save(zip);
}
}
//Save the logs
gui->save(zip);
zip.saveToFile("game.sav");
}
}
示例4: Save
void Engine::Save(void)
{
if (player_->destructible_->IsDead()) {
TCODSystem::deleteFile("game.sav");
} else {
TCODZip zip;
// save the map
zip.putInt(map_->width_);
zip.putInt(map_->height_);
map_->Save(zip);
// save the player
player_->Save(zip);
// then all the other actors
zip.putInt(actors_.size()-1);
for (Actor **it = actors_.begin(); it != actors_.end(); it++) {
if (*it != player_) {
(*it)->Save(zip);
}
}
// finally the message log
gui_->Save(zip);
zip.saveToFile("game.sav");
}
}