Beispiel #1
0
void Map::Save(TCODZip &zip)
{
    zip.putInt(seed_);
    for (int32_t i = 0; i < width_ * height_; i++) {
        zip.putInt(tiles_[i].explored_);
    }
}
Beispiel #2
0
void Aura::save(TCODZip &zip) {
	zip.putInt(stat);
	zip.putInt(totalDuration);
	zip.putInt(duration);
	zip.putInt(bonus);
	zip.putInt(life);
}
Beispiel #3
0
void Healer::save(TCODZip &zip) {
	zip.putInt(type);
	zip.putFloat(amount);
	zip.putInt(stacks);
	zip.putInt(stackSize);
	zip.putInt(value);
}
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 #5
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 ConfusedMonsterAi::save(TCODZip &zip)
{
    zip.putInt(CONFUSED_MONSTER);
    zip.putInt(nbTurns);
    oldAi->save(zip);
    zip.putColor(&oldColor);
}
Beispiel #7
0
void Container::Save(TCODZip &zip)
{
    zip.putInt(size_);
    zip.putInt(inventory.size());
    for (Actor **it = inventory.begin(); it != inventory.end(); it++) {
        (*it)->Save(zip);
    }
}
void Destructible::save(TCODZip &zip) {
	zip.putFloat(maxHp);
	zip.putFloat(hp);
	zip.putFloat(defense);
	zip.putString(corpseName);
	zip.putInt(maxAp);
	zip.putInt(ap);
}
Beispiel #9
0
void Poison::save(TCODZip &zip) {
	zip.putInt(type);
	zip.putFloat(tick);
	zip.putInt(duration);
	zip.putInt(stacks);
	zip.putInt(stackSize);
	zip.putInt(value);
}
Beispiel #10
0
void Confuser::save(TCODZip &zip) {
	zip.putInt(type);
	zip.putInt(nbTurns);
	zip.putFloat(range);
	zip.putInt(stacks);
	zip.putInt(stackSize);
	zip.putInt(value);
}
Beispiel #11
0
void LightningBolt::save(TCODZip &zip) {
	zip.putInt(type);
	zip.putFloat(range);
	zip.putFloat(damage);
	zip.putInt(stacks);
	zip.putInt(stackSize);
	zip.putInt(value);
}
void
Map::Save(TCODZip& zip) {
	zip.putInt(seed);

	for(int i = 0; i < width * height; ++i) {
		zip.putInt(tiles[i].explored);
	}
}
void Pickable::save(TCODZip &zip){
    zip.putInt(selector != NULL);
    zip.putInt(effect != NULL);
    if(selector)
        selector->save(zip);
    if(effect)
        effect->save(zip);
}
Beispiel #14
0
void Fireball::save(TCODZip &zip) {
	zip.putInt(type);
	zip.putFloat(range);
	zip.putFloat(aoe);
	zip.putFloat(damage);
	zip.putInt(stacks);
	zip.putInt(stackSize);
	zip.putInt(value);
}
Beispiel #15
0
void clBuilding::Save(TCODZip &file)
{
    file.putChar(CL_BUILDING);
    file.putInt(mytile->GetSave()->num);
    file.putInt(t->GetBuildingID());
    file.putInt(mypic);
    file.putInt(data);
    file.putInt(mat->ID);
}
Beispiel #16
0
void Map::save(TCODZip &zip, NodeType type){
    zip.putInt(seed);
    for(int i = 0; i < width * height; i++){
        zip.putInt(tiles[i].explored);
        //zip.putInt(tiles[i].walkable);
        //zip.putInt(tiles[i].inFOV);
    }

    zip.putInt(actors.size());
    for(Actor **it = actors.begin(); it != actors.end(); it++){
        (*it)->save(zip);
    }

    zip.putInt(nextLevel != NULL);
    zip.putInt(prevLevel != NULL);

    if(nextLevel && (type == ROOT || type == BELOW_ROOT)){
        zip.putInt(nextLevel->width);
        zip.putInt(nextLevel->height);
        nextLevel->save(zip, BELOW_ROOT);
    }
    if(prevLevel && (type == ROOT || type == ABOVE_ROOT)){
        zip.putInt(prevLevel->width);
        zip.putInt(prevLevel->height);
        prevLevel->save(zip, ABOVE_ROOT);
    }
}
void
Actor::Save(TCODZip& zip) {
	zip.putInt(x);
	zip.putInt(y);

	zip.putInt(code);
	zip.putColor(&color);

	zip.putString(name);

	zip.putInt(blocks);
	zip.putInt(fovOnly);

	zip.putInt(destructible != nullptr);
	zip.putInt(ai != nullptr);
	zip.putInt(pickable != nullptr);
	zip.putInt(container != nullptr);

	if(destructible) {
		destructible->Save(zip);
	}

	if(ai) {
		ai->Save(zip);
	}

	if(pickable) {
		pickable->Save(zip);
	}

	if(container) {
		container->Save(zip);
	}
}
Beispiel #18
0
void Gui::save(TCODZip &zip) {
	zip.putInt(log.size());
	for (Message **it = log.begin(); it != log.end(); it++) {
		zip.putString((*it)->text);
		zip.putColor(&(*it)->col);
	}
}
Beispiel #19
0
void Destructible::save(TCODZip &zip) {
	zip.putFloat(maxHp);
	zip.putFloat(hp);
	zip.putFloat(baseDefense);
	zip.putFloat(totalDefense);
	zip.putString(corpseName);
	zip.putInt(xp);
}
Beispiel #20
0
void DamagingAura::save(TCODZip &zip){
	zip.putInt(stat);
	zip.putInt(totalDuration);
	zip.putInt(duration);
	zip.putInt(bonus);
	zip.putInt(life);
	zip.putInt(radius);
	zip.putInt(smart);
}
Beispiel #21
0
void Equipment::save(TCODZip &zip) {
	zip.putInt(type);
	zip.putInt(equipped);
	zip.putInt(slot);
	zip.putInt(stacks);
	zip.putInt(stackSize);
	zip.putInt(value);
	zip.putInt(bonus.size());
	for (int i = 0; i < bonus.size(); i++) {
		bonus.get(i)->save(zip);
	}
	requirement->save(zip);
}
Beispiel #22
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 #23
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");
    }
}
Beispiel #24
0
void Actor::Save(TCODZip &zip)
{
    zip.putInt(x_);
    zip.putInt(y_);
    zip.putInt(ch_);
    zip.putColor(&col_);
    zip.putString(name_);
    zip.putInt(blocks_);
    zip.putInt(attacker_ != NULL);
    zip.putInt(destructible_ != NULL);
    zip.putInt(ai_ != NULL);
    zip.putInt(pickable_ != NULL);
    zip.putInt(container_ != NULL);
    if (attacker_ != NULL) attacker_->Save(zip);
    if (destructible_ != NULL) destructible_->Save(zip);
    if (ai_ != NULL) ai_->Save(zip);
    if (pickable_ != NULL) pickable_->Save(zip);
    if (container_ != NULL) container_->Save(zip);
}
Beispiel #25
0
void Actor::save(TCODZip &zip) {
	zip.putInt(x);
	zip.putInt(y);
	zip.putInt(ch);
	zip.putColor(&col);
	zip.putString(name);
	zip.putInt(blocks);
	zip.putInt(attacker != NULL);
	zip.putInt(destructible != NULL);
	zip.putInt(ai != NULL);
	zip.putInt(pickable != NULL);
	zip.putInt(container != NULL);
	
	if (attacker) attacker->save(zip);
	if (destructible) destructible->save(zip);
	if (ai) ai->save(zip);
	if (pickable) pickable->save(zip);
	if (container) container->save(zip);
}
Beispiel #26
0
void LightningBolt::save(TCODZip &zip)
{
	zip.putInt(LIGHTNING_BOLT);
	zip.putFloat(range);
	zip.putFloat(damage);
}
Beispiel #27
0
void PlayerAi::save(TCODZip &zip) {
	zip.putInt(PLAYER);
}
void MonsterDestructible::save(TCODZip &zip)
{
    zip.putInt(MONSTER);
    Destructible::save(zip);
}
void PlayerDestructible::save(TCODZip &zip)
{
    zip.putInt(PLAYER);
    Destructible::save(zip);
}
Beispiel #30
0
void MonsterAi::save(TCODZip &zip) {
	zip.putInt(MONSTER);
	zip.putInt(moveCount);
}