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


C++ House::getNumDestroyedUnits方法代码示例

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


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

示例1: calculateScore

void GameStatsMenu::calculateScore(int level)
{
    Human_UnitsDestroyed = 0;
	AI_UnitsDestroyed = 0;

    Human_StructuresDestroyed = 0;
	AI_StructuresDestroyed = 0;

	Human_SpiceHarvested = 0.0;
	AI_SpiceHarvested = 0.0;

	totalTime = currentGame->GetGameTime()/1000;

    totalScore = level*45;

    double totalHumanCredits = 0.0;
	for(int i=0; i < MAX_PLAYERS; i++) {
        House* pHouse = currentGame->house[i];
        if(pHouse != NULL) {
            if(pHouse->isAI() == true) {
                AI_UnitsDestroyed += pHouse->getNumDestroyedUnits();
                AI_StructuresDestroyed += pHouse->getNumDestroyedStructures();
                AI_SpiceHarvested += pHouse->getHarvestedSpice();

                totalScore -= pHouse->getDestroyedValue();
            } else {
                Human_UnitsDestroyed += pHouse->getNumDestroyedUnits();
                Human_StructuresDestroyed += pHouse->getNumDestroyedStructures();
                Human_SpiceHarvested += pHouse->getHarvestedSpice();

                totalHumanCredits += pHouse->getCredits();

                totalScore += pHouse->getDestroyedValue();
            }
        }
	}

	totalScore += ((int) totalHumanCredits) / 100;

    for(RobustList<StructureClass*>::const_iterator iter = structureList.begin(); iter != structureList.end(); ++iter) {
        StructureClass* pStructure = *iter;
        if(pStructure->getOwner()->isAI() == false) {
            totalScore += currentGame->objectData.data[pStructure->getItemID()].price / 100;
        }
    }

    totalScore -= ((totalTime/60) + 1);

    for(RobustList<UnitClass*>::const_iterator iter = unitList.begin(); iter != unitList.end(); ++iter) {
        UnitClass* pUnit = *iter;
        if(pUnit->getItemID() == Unit_Harvester) {
            HarvesterClass* pHarvester = (HarvesterClass*) pUnit;
            if(pHarvester->getOwner()->isAI() == true) {
                AI_SpiceHarvested += pHarvester->getAmountOfSpice();
            } else {
                Human_SpiceHarvested += pHarvester->getAmountOfSpice();
            }
        }
    }

    if(currentGame->CheatsEnabled() == true) {
        rank = "Cheater";
    } else {
        int rankID = DuneText_SandFlea;

        if(totalScore >= 25)   rankID++;
        if(totalScore >= 50)   rankID++;
        if(totalScore >= 100)  rankID++;
        if(totalScore >= 150)  rankID++;
        if(totalScore >= 200)  rankID++;
        if(totalScore >= 300)  rankID++;
        if(totalScore >= 400)  rankID++;
        if(totalScore >= 500)  rankID++;
        if(totalScore >= 700)  rankID++;
        if(totalScore >= 1000) rankID++;
        if(totalScore >= 1400) rankID++;
    //    if(totalScore >= 1800) rankID++;

        rank = pTextManager->getDuneText(rankID);
    }
}
开发者ID:thebohemian,项目名称:dunelegacy-richiesbranch,代码行数:81,代码来源:GameStatsMenu.cpp


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