当前位置: 首页>>代码示例>>C++>>正文


C++ TCODZip::saveToFile方法代码示例

本文整理汇总了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");
	}
}
开发者ID:PeterMRegan,项目名称:CS1310,代码行数:31,代码来源:Engine.cpp

示例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");
	}
}
开发者ID:ctmartinez1992,项目名称:Blood-Arena,代码行数:29,代码来源:Persistent.cpp

示例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");
  }
}
开发者ID:alec-parks,项目名称:rlTutorial,代码行数:24,代码来源:Persistent.cpp

示例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");
    }
}
开发者ID:dev-riker,项目名称:roguelikes,代码行数:24,代码来源:persistent.cpp


注:本文中的TCODZip::saveToFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。