Beispiel #1
0
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");
	}
}
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");
	}
}
Beispiel #3
0
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");
  }
}
Beispiel #4
0
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");
    }
}