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


C++ Inventory::getSlots方法代码示例

本文整理汇总了C++中Inventory::getSlots方法的典型用法代码示例。如果您正苦于以下问题:C++ Inventory::getSlots方法的具体用法?C++ Inventory::getSlots怎么用?C++ Inventory::getSlots使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Inventory的用法示例。


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

示例1: runNewStandardTurnEvents

void GameTime::runNewStandardTurnEvents() {
  turn_++;

  Actor* actor = NULL;
  unsigned int loopSize = actors_.size();

  bool visionBlockingArray[MAP_X_CELLS][MAP_Y_CELLS];
  eng->mapTests->makeVisionBlockerArray(eng->player->pos, visionBlockingArray);

  for(unsigned int i = 0; i < loopSize; i++) {
    actor = actors_.at(i);
    //Update status effects on all actors, this also makes the monster player-aware if
    //it has any active status effect.
    actor->getStatusEffectsHandler()->newTurnAllEffects(visionBlockingArray);

    if(actor->deadState == actorDeadState_alive) {
      actor->actorSpecificOnStandardTurn();
    }

    //Delete dead, mangled actors
    if(actor->deadState == actorDeadState_mangled) {
      delete actor;
      if(eng->player->target == actor) {
        eng->player->target = NULL;
      }
      actors_.erase(actors_.begin() + i);
      i--;
      loopSize--;
      if(static_cast<unsigned int>(currentActorVectorPos_) >= actors_.size()) {
        currentActorVectorPos_ = 0;
      }
    }
  }
  //Update all timed features
  for(unsigned int i = 0; i < featureMobs_.size(); i++) {
    featureMobs_.at(i)->newTurn(); //Note: this may erase the feature
  }

  for(int y = 0; y < MAP_Y_CELLS; y++) {
    for(int x = 0; x < MAP_X_CELLS; x++) {
      eng->map->featuresStatic[x][y]->newTurn();
    }
  }

  //Spawn more monsters? (If an unexplored cell is selected, the spawn is aborted)
  if(eng->map->getDungeonLevel() >= 1 && eng->map->getDungeonLevel() <= LAST_CAVERN_LEVEL) {
    const int SPAWN_N_TURN = 125;
    if(turn_ == (turn_ / SPAWN_N_TURN) * SPAWN_N_TURN) {
      eng->populateMonsters->trySpawnDueToTimePassed();
    }
  }

  //Player spell cooldowns
  for(unsigned int i = 1; i < endOfItemIds; i++) {
    ItemDefinition& d = *(eng->itemData->itemDefinitions[i]);
    if(d.isScroll) {
      if(d.isScrollLearned) {
        if(eng->playerBonusHandler->isBonusPicked(playerBonus_occultist)) {
          if(turn_ == (turn_ / d.spellTurnsPerPercentCooldown) * d.spellTurnsPerPercentCooldown) {
            if(d.castFromMemoryCurrentBaseChance < CAST_FROM_MEMORY_CHANCE_LIM) {
              d.castFromMemoryCurrentBaseChance++;
            }
          }
        }
      }
    }
  }

  //Run new turn events on all player items
  Inventory* playerInv = eng->player->getInventory();
  vector<Item*>* playerBackpack = playerInv->getGeneral();
  for(unsigned int i = 0; i < playerBackpack->size(); i++) {
    playerBackpack->at(i)->newTurnInInventory(eng);
  }
  vector<InventorySlot>* playerSlots = playerInv->getSlots();
  for(unsigned int i = 0; i < playerSlots->size(); i++) {
    Item* const item = playerSlots->at(i).item;
    if(item != NULL) {
      item->newTurnInInventory(eng);
    }
  }

  eng->soundEmitter->resetNrSoundsHeardByPlayerCurTurn();
}
开发者ID:Justice-,项目名称:ia,代码行数:84,代码来源:GameTime.cpp


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