本文整理汇总了C++中House::getHarvestedSpice方法的典型用法代码示例。如果您正苦于以下问题:C++ House::getHarvestedSpice方法的具体用法?C++ House::getHarvestedSpice怎么用?C++ House::getHarvestedSpice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类House
的用法示例。
在下文中一共展示了House::getHarvestedSpice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MenuBase
CustomGameStatsMenu::CustomGameStatsMenu() : MenuBase()
{
// set up window
SDL_Surface *surf;
surf = pGFXManager->getUIGraphic(UI_MenuBackground);
setBackground(surf,false);
resize(surf->w,surf->h);
setWindowWidget(&windowWidget);
int localHouseColor = houseColor[pLocalHouse->getHouseID()];
windowWidget.addWidget(&mainVBox, Point(24,23), Point(screen->w - 48, screen->h - 32));
captionLabel.setText(getBasename(currentGame->getGameInitSettings().getFilename(), true));
captionLabel.setTextColor(localHouseColor + 3);
captionLabel.setAlignment(Alignment_HCenter);
mainVBox.addWidget(&captionLabel, 24);
mainVBox.addWidget(VSpacer::create(24));
mainVBox.addWidget(Spacer::create(), 0.05);
mainVBox.addWidget(&mainHBox, 0.80);
mainHBox.addWidget(Spacer::create(), 0.4);
mainHBox.addWidget(&playerStatListVBox, 0.2);
headerHBox.addWidget(&headerLabelDummy, 130);
headerHBox.addWidget(Spacer::create(), 10);
headerLabel1.setText(_("Built Object"));
headerLabel1.setAlignment(Alignment_HCenter);
headerLabel1.setTextColor(localHouseColor + 3);
headerHBox.addWidget(&headerLabel1, 132);
headerHBox.addWidget(Spacer::create(), 30);
headerLabel2.setText(_("Destroyed"));
headerLabel2.setAlignment(Alignment_HCenter);
headerLabel2.setTextColor(localHouseColor + 3);
headerHBox.addWidget(&headerLabel2, 132);
headerLabel3.setText(_("Harvested Spice"));
headerLabel3.setAlignment(Alignment_HCenter);
headerLabel3.setTextColor(localHouseColor + 3);
headerHBox.addWidget(Spacer::create(), 30);
headerHBox.addWidget(&headerLabel3, 132);
playerStatListVBox.addWidget(&headerHBox, 25);
playerStatListVBox.addWidget(VSpacer::create(15));
int maxBuiltValue = 0;
int maxDestroyedValue = 0;
float maxSpiceHarvested = 0.0;
for(int i=0;i<NUM_HOUSES;i++) {
House* pHouse = currentGame->getHouse(i);
if(pHouse != NULL) {
maxBuiltValue = std::max(maxBuiltValue, pHouse->getBuiltValue());
maxDestroyedValue = std::max(maxDestroyedValue, pHouse->getDestroyedValue());
maxSpiceHarvested = std::max(maxSpiceHarvested, pHouse->getHarvestedSpice());
}
}
for(int i=0;i<NUM_HOUSES;i++) {
HouseStat& curHouseStat = houseStat[i];
House* pHouse = currentGame->getHouse(i);
if(pHouse != NULL) {
int color = houseColor[i];
curHouseStat.houseName.setText(_("House") + " " + getHouseNameByNumber((HOUSETYPE) i));
curHouseStat.houseName.setTextColor(color + 3);
curHouseStat.houseHBox.addWidget(&curHouseStat.houseName, 140);
curHouseStat.houseHBox.addWidget(Spacer::create(), 15);
curHouseStat.value1.setText( stringify(pHouse->getBuiltValue()*100));
curHouseStat.value1.setTextFont(FONT_STD10);
curHouseStat.value1.setAlignment(Alignment_Right);
curHouseStat.value1.setTextColor(color + 3);
curHouseStat.houseHBox.addWidget(&curHouseStat.value1, 50);
curHouseStat.houseHBox.addWidget(HSpacer::create(2));
curHouseStat.progressBar1.setProgress( (maxBuiltValue == 0) ? 0.0 : (pHouse->getBuiltValue() * 100.0f / maxBuiltValue));
curHouseStat.progressBar1.setDrawShadow(true);
curHouseStat.progressBar1.setColor(color + 1);
curHouseStat.vBox1.addWidget(Spacer::create(), 0.5);
curHouseStat.vBox1.addWidget(&curHouseStat.progressBar1, 12);
curHouseStat.vBox1.addWidget(Spacer::create(), 0.5);
curHouseStat.houseHBox.addWidget(&curHouseStat.vBox1, 80);
curHouseStat.houseHBox.addWidget(Spacer::create(), 30);
curHouseStat.value2.setText( stringify(pHouse->getDestroyedValue()*100));
curHouseStat.value2.setTextFont(FONT_STD10);
curHouseStat.value2.setAlignment(Alignment_Right);
curHouseStat.value2.setTextColor(color + 3);
curHouseStat.houseHBox.addWidget(&curHouseStat.value2, 50);
curHouseStat.houseHBox.addWidget(HSpacer::create(2));
curHouseStat.progressBar2.setProgress( (maxDestroyedValue == 0) ? 0.0 : (pHouse->getDestroyedValue() * 100.0f / maxDestroyedValue));
curHouseStat.progressBar2.setDrawShadow(true);
curHouseStat.progressBar2.setColor(color + 1);
//.........这里部分代码省略.........
示例2: 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);
}
}