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


C++ TCODZip类代码示例

本文整理汇总了C++中TCODZip的典型用法代码示例。如果您正苦于以下问题:C++ TCODZip类的具体用法?C++ TCODZip怎么用?C++ TCODZip使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TCODZip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: load

void Pickable::load(TCODZip &zip){
    bool hasTargetSelector = zip.getInt();
    bool hasEffect = zip.getInt();
    if(hasTargetSelector){
        selector = new TargetSelector(TargetSelector::CLOSEST_MONSTER,0);
        selector->load(zip);
    }
    if(hasEffect){
        effect = Effect::create(zip);
    }
}
开发者ID:pthurston,项目名称:Roguelike-Game-Engine,代码行数:11,代码来源:Pickable.cpp

示例2: while

void
Gui::Load(TCODZip& zip) {
    int numberOfMessages = zip.getInt();

    while(numberOfMessages > 0) {
        char* text = (char*)zip.getString();
        TCODColor color = zip.getColor();

        Message(color, text);

        numberOfMessages--;
    }
}
开发者ID:ctmartinez1992,项目名称:Blood-Arena,代码行数:13,代码来源:Persistent.cpp

示例3: save

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);
    }
}
开发者ID:pthurston,项目名称:Roguelike-Game-Engine,代码行数:27,代码来源:Map.cpp

示例4: Load

void clBuilding::Load(TCODZip &file,VecLoad &bonusdata)
{
     mytile=GetFromLoad(file.getInt(),bonusdata);
    if(mytile==NULL)
        throw "Error loading file";
    int bid=file.getInt();
    t=BTManager::Get().GetTemplate((BuildingID)bid);
    if(t==NULL)
        throw "Error loading building template";
    mypic=file.getInt();
    data=file.getInt();
    int matid=file.getInt();
    mat=MaterialManager::Get().GetMaterial(MATT_ALL,matid);
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例5: load

void Map::load(TCODZip &zip, NodeType type){
    seed = zip.getInt();
    init(false);
    for(int i = 0; i < width * height; i++){
        tiles[i].explored = zip.getInt();
        //tiles[i].walkable = zip.getInt();
        //tiles[i].inFOV = zip.getInt();
    }

    int nbActors = zip.getInt();
    while(nbActors > 0){
        Actor *actor = new Actor(0, 0, 0, NULL, TCODColor::white);
        actor->load(zip);
        actors.push(actor);
        nbActors--;
    }

    bool hasNextLevel = zip.getInt();
    bool hasPrevLevel = zip.getInt();

    if(hasNextLevel && (type == ROOT || type == BELOW_ROOT)){
        int newWidth = zip.getInt();
        int newHeight = zip.getInt();
        nextLevel = new Map(newWidth, newHeight, NULL, this);
        nextLevel->load(zip, BELOW_ROOT);
    }
    if(hasPrevLevel && (type == ROOT || type == ABOVE_ROOT)){
        int newWidth = zip.getInt();
        int newHeight = zip.getInt();
        prevLevel = new Map(newWidth, newHeight, this, NULL);
        prevLevel->load(zip, ABOVE_ROOT);
    }
}
开发者ID:pthurston,项目名称:Roguelike-Game-Engine,代码行数:33,代码来源:Map.cpp

示例6: exit

void Engine::Load(void)
{
    engine.gui_->menu_.Clear();
    engine.gui_->menu_.AddItem(Menu::NEW_GAME, "New game");
    if (TCODSystem::fileExists("game.sav")) {
        engine.gui_->menu_.AddItem(Menu::CONTINUE, "Continue");
    }
    engine.gui_->menu_.AddItem(Menu::EXIT, "Exit");

    Menu::MenuItemCode menuItem = engine.gui_->menu_.Pick();
    if ((menuItem == Menu::EXIT) || (menuItem == Menu::NONE )) {
        // Exit or window closed
        exit(0);
    } else if (menuItem == Menu::NEW_GAME) {
        // New game
        engine.Term();
        engine.Init();
    } else {
        TCODZip zip;
        // continue a saved game
        engine.Term();
        zip.loadFromFile("game.sav");
        // load the map
        int32_t width = zip.getInt();
        int32_t height = zip.getInt();
        map_ = new Map(width, height);
        map_->Load(zip);
        // then the player
        player_ = new Actor(0, 0, 0, NULL, TCODColor::white);
        actors_.push(player_);
        player_->Load(zip);
        // then all other actors
        int32_t nbActors = zip.getInt();
        while (nbActors > 0) {
            Actor *actor = new Actor(0, 0, 0, NULL, TCODColor::white);
            actor->Load(zip);
            actors_.push(actor);
            nbActors--;
        }
        // finally the message log
        gui_->Load(zip);
        // to force FOV recomputation
        gameStatus = STARTUP;
    }
}
开发者ID:dev-riker,项目名称:roguelikes,代码行数:45,代码来源:persistent.cpp

示例7: Save

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

示例8: save

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);
}
开发者ID:cottog,项目名称:Game,代码行数:19,代码来源:Actor.cpp

示例9: save

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);
}
开发者ID:cottog,项目名称:CASTER-EDITION,代码行数:9,代码来源:Pickable.cpp

示例10: save

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);
}
开发者ID:cottog,项目名称:CASTER-EDITION,代码行数:9,代码来源:Aura.cpp

示例11: load

void Weapon::load(TCODZip &zip) {
	equipped = zip.getInt();
	slot = (SlotType)zip.getInt();
	stacks = zip.getInt();
	stackSize = zip.getInt();
	value = zip.getInt();
	int numBonus = zip.getInt();
	for(int i = 0; i < numBonus; i++){
		ItemBonus *bon = new ItemBonus(ItemBonus::NOBONUS,0);
		bon->load(zip);
		bonus.push(bon);
	}
	ItemReq *req = new ItemReq(ItemReq::NOREQ,0);
	req->load(zip);
	requirement = req;
	diceNum = zip.getInt();
	diceType = zip.getInt();
	critMult = zip.getInt();
	critRange = zip.getInt();
	wType = (WeaponType)zip.getInt();
}
开发者ID:cottog,项目名称:CASTER-EDITION,代码行数:21,代码来源:Pickable.cpp

示例12:

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

示例13: save

void Destructible::save(TCODZip &zip) {
	zip.putFloat(maxHp);
	zip.putFloat(hp);
	zip.putFloat(baseDefense);
	zip.putFloat(totalDefense);
	zip.putString(corpseName);
	zip.putInt(xp);
}
开发者ID:cottog,项目名称:Game,代码行数:8,代码来源:Destructible.cpp

示例14: load

void Destructible::load(TCODZip &zip) {
	maxHp = zip.getFloat();
	hp = zip.getFloat();
	baseDefense = zip.getFloat();
	totalDefense = zip.getFloat();
	corpseName = strdup(zip.getString());
	xp = zip.getInt();
}
开发者ID:cottog,项目名称:Game,代码行数:8,代码来源:Destructible.cpp

示例15: load

void Destructible::load(TCODZip &zip) {
	maxHp = zip.getFloat();
	hp = zip.getFloat();
	defense = zip.getFloat();
	corpseName = _strdup(zip.getString());
	maxAp = zip.getInt();
	ap = zip.getInt();
}
开发者ID:netsphereengineer,项目名称:knavereboot,代码行数:8,代码来源:Destructible.cpp


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