您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetMeter函数代码示例

51自学网 2021-06-01 21:10:56
  C++
这篇教程C++ GetMeter函数代码示例写得很实用,希望能帮到您。

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

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

示例1: ResourceCenterPopGrowthProductionResearchPhase

void Planet::PopGrowthProductionResearchPhase() {    UniverseObject::PopGrowthProductionResearchPhase();    // do not do production if planet was just conquered    if (m_just_conquered)        m_just_conquered = false;    else        ResourceCenterPopGrowthProductionResearchPhase();    PopCenterPopGrowthProductionResearchPhase();    // check for planets with zero population.  If they have a species set, then    // they probably just starved    if (!SpeciesName().empty() && GetMeter(METER_POPULATION)->Current() == 0.0) {        // generate starvation sitrep for empire that owns this depopulated planet        if (Empire* empire = Empires().Lookup(this->Owner()))            empire->AddSitRepEntry(CreatePlanetStarvedToDeathSitRep(this->ID()));        // remove species        SetSpecies("");    }    GetMeter(METER_SHIELD)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_SHIELD));    GetMeter(METER_DEFENSE)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_DEFENSE));    GetMeter(METER_TROOPS)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_TROOPS));    GetMeter(METER_REBEL_TROOPS)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_REBEL_TROOPS));    StateChangedSignal();}
开发者ID:anarsky,项目名称:freeorion,代码行数:30,


示例2: ResourceCenterPopGrowthProductionResearchPhase

void Planet::PopGrowthProductionResearchPhase() {    UniverseObject::PopGrowthProductionResearchPhase();    // do not do production if planet was just conquered    if (m_just_conquered)        m_just_conquered = false;    else        ResourceCenterPopGrowthProductionResearchPhase();    PopCenterPopGrowthProductionResearchPhase();    // check for planets with zero population.  If they have any owners    // then the planet has likely just starved.  Regardless, resetting the    // planet keeps things consistent.    if (GetMeter(METER_POPULATION)->Current() == 0.0 && !Unowned()) {        // generate starvation sitrep for empire that owns this depopulated planet        if (Empire* empire = Empires().Lookup(this->Owner()))            empire->AddSitRepEntry(CreatePlanetStarvedToDeathSitRep(this->ID()));        // reset planet to empty and unowned        Reset();    } else {        GetMeter(METER_SHIELD)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_SHIELD));        GetMeter(METER_DEFENSE)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_SHIELD));        GetMeter(METER_TROOPS)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_SHIELD));    }    StateChangedSignal();}
开发者ID:dbuksbaum,项目名称:FreeOrion,代码行数:30,


示例3: if

void Steps::TidyUpData(){	// Don't set the StepsType to dance single if it's invalid.  That just	// causes unrecognized charts to end up where they don't belong.	// Leave it as StepsType_Invalid so the Song can handle it specially.  This	// is a forwards compatibility feature, so that if a future version adds a	// new style, editing a simfile with unrecognized Steps won't silently	// delete them. -Kyz	if( m_StepsType == StepsType_Invalid )	{		LOG->Warn("Detected steps with unknown style '%s' in '%s'", m_StepsTypeStr.c_str(), m_pSong->m_sSongFileName.c_str());	}	else if(m_StepsTypeStr == "")	{		m_StepsTypeStr= GAMEMAN->GetStepsTypeInfo(m_StepsType).szName;	}	if( GetDifficulty() == Difficulty_Invalid )		SetDifficulty( StringToDifficulty(GetDescription()) );	if( GetDifficulty() == Difficulty_Invalid )	{		if(	 GetMeter() == 1 )	SetDifficulty( Difficulty_Beginner );		else if( GetMeter() <= 3 )	SetDifficulty( Difficulty_Easy );		else if( GetMeter() <= 6 )	SetDifficulty( Difficulty_Medium );		else				SetDifficulty( Difficulty_Hard );	}	if( GetMeter() < 1) // meter is invalid		SetMeter( int(PredictMeter()) );}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:31,


示例4: GetMeter

void Planet::Depopulate() {    PopCenter::Depopulate();    GetMeter(METER_INDUSTRY)->Reset();    GetMeter(METER_RESEARCH)->Reset();    GetMeter(METER_TRADE)->Reset();    GetMeter(METER_CONSTRUCTION)->Reset();    ClearFocus();}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:10,


示例5: switch

double Planet::NextTurnCurrentMeterValue(MeterType type) const{    MeterType max_meter_type = INVALID_METER_TYPE;    switch (type) {    case METER_TARGET_POPULATION:    case METER_TARGET_HEALTH:    case METER_POPULATION:    case METER_HEALTH:    case METER_FOOD_CONSUMPTION:        return PopCenterNextTurnMeterValue(type);        break;    case METER_TARGET_FARMING:    case METER_TARGET_INDUSTRY:    case METER_TARGET_RESEARCH:    case METER_TARGET_TRADE:    case METER_TARGET_MINING:    case METER_TARGET_CONSTRUCTION:    case METER_FARMING:    case METER_INDUSTRY:    case METER_RESEARCH:    case METER_TRADE:    case METER_MINING:    case METER_CONSTRUCTION:        return ResourceCenterNextTurnMeterValue(type);        break;    case METER_SHIELD:  max_meter_type = METER_MAX_SHIELD;  break;    case METER_TROOPS:  max_meter_type = METER_MAX_TROOPS;  break;    case METER_DEFENSE: max_meter_type = METER_MAX_DEFENSE; break;        break;    default:        return UniverseObject::NextTurnCurrentMeterValue(type);    }    const Meter* meter = GetMeter(type);    if (!meter) {        throw std::invalid_argument("Planet::NextTurnCurrentMeterValue passed meter type that the Planet does not have, but should.");    }    double current_meter_value = meter->Current();    const Meter* max_meter = GetMeter(max_meter_type);    if (!max_meter) {        throw std::runtime_error("Planet::NextTurnCurrentMeterValue dealing with invalid meter type");    }    double max_meter_value = max_meter->Current();    // being attacked prevents meter growth    if (LastTurnAttackedByShip() >= CurrentTurn()) {        return std::min(current_meter_value, max_meter_value);    }    // currently meter growth is one per turn.    return std::min(current_meter_value + 1.0, max_meter_value);}
开发者ID:dbuksbaum,项目名称:FreeOrion,代码行数:53,


示例6: GetMeter

void Planet::Reset() {    PopCenter::Reset();    ResourceCenter::Reset();    GetMeter(METER_SUPPLY)->Reset();    GetMeter(METER_MAX_SUPPLY)->Reset();    GetMeter(METER_SHIELD)->Reset();    GetMeter(METER_MAX_SHIELD)->Reset();    GetMeter(METER_DEFENSE)->Reset();    GetMeter(METER_MAX_DEFENSE)->Reset();    GetMeter(METER_DETECTION)->Reset();    GetMeter(METER_REBEL_TROOPS)->Reset();    if (m_is_about_to_be_colonized && !OwnedBy(ALL_EMPIRES)) {        for (std::set<int>::const_iterator it = m_buildings.begin(); it != m_buildings.end(); ++it)            if (TemporaryPtr<Building> building = GetBuilding(*it))                building->Reset();    }    m_just_conquered = false;    m_is_about_to_be_colonized = false;    m_is_about_to_be_invaded = false;    m_is_about_to_be_bombarded = false;    SetOwner(ALL_EMPIRES);}
开发者ID:J-d-H,项目名称:freeorion,代码行数:25,


示例7: GetMeter

float PopCenter::NextTurnPopGrowth() const {    float target_pop = GetMeter(METER_TARGET_POPULATION)->Current();    float cur_pop = GetMeter(METER_POPULATION)->Current();    float pop_change = 0.0f;    if (target_pop > cur_pop) {        pop_change = cur_pop * (target_pop + 1 - cur_pop) / 100; // Using target population slightly above actual population avoids excessively slow asymptotic growth towards target.        pop_change = std::min(pop_change, target_pop - cur_pop);    } else {        pop_change = -(cur_pop - target_pop) / 10;        pop_change = std::max(pop_change, target_pop - cur_pop);    }    return pop_change;}
开发者ID:anarsky,项目名称:freeorion,代码行数:15,


示例8: switch

float Planet::NextTurnCurrentMeterValue(MeterType type) const {    MeterType max_meter_type = INVALID_METER_TYPE;    switch (type) {    case METER_TARGET_POPULATION:    case METER_POPULATION:    case METER_TARGET_HAPPINESS:    case METER_HAPPINESS:        return PopCenterNextTurnMeterValue(type);        break;    case METER_TARGET_INDUSTRY:    case METER_TARGET_RESEARCH:    case METER_TARGET_TRADE:    case METER_TARGET_CONSTRUCTION:    case METER_INDUSTRY:    case METER_RESEARCH:    case METER_TRADE:    case METER_CONSTRUCTION:        return ResourceCenterNextTurnMeterValue(type);        break;    case METER_SHIELD:      max_meter_type = METER_MAX_SHIELD;          break;    case METER_TROOPS:      max_meter_type = METER_MAX_TROOPS;          break;    case METER_DEFENSE:     max_meter_type = METER_MAX_DEFENSE;         break;    case METER_SUPPLY:      max_meter_type = METER_MAX_SUPPLY;          break;        break;    default:        return UniverseObject::NextTurnCurrentMeterValue(type);    }    const Meter* meter = GetMeter(type);    if (!meter) {        throw std::invalid_argument("Planet::NextTurnCurrentMeterValue passed meter type that the Planet does not have, but should: " + boost::lexical_cast<std::string>(type));    }    float current_meter_value = meter->Current();    const Meter* max_meter = GetMeter(max_meter_type);    if (!max_meter) {        throw std::runtime_error("Planet::NextTurnCurrentMeterValue dealing with invalid meter type: " + boost::lexical_cast<std::string>(type));    }    float max_meter_value = max_meter->Current();    // being attacked prevents meter growth    if (LastTurnAttackedByShip() >= CurrentTurn())        return std::min(current_meter_value, max_meter_value);    // currently meter growth is one per turn.    return std::min(current_meter_value + 1.0f, max_meter_value);}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:47,


示例9: SetOwner

void Planet::Reset() {    // remove owner    SetOwner(ALL_EMPIRES);    // reset popcenter meters    PopCenter::Reset();    // reset resourcecenter meters    ResourceCenter::Reset();    // reset planet meters    GetMeter(METER_SUPPLY)->Reset();    GetMeter(METER_SHIELD)->Reset();    GetMeter(METER_MAX_SHIELD)->Reset();    GetMeter(METER_DEFENSE)->Reset();    GetMeter(METER_MAX_DEFENSE)->Reset();    GetMeter(METER_DETECTION)->Reset();    GetMeter(METER_REBEL_TROOPS)->Reset();    // reset buildings    for (std::set<int>::const_iterator it = m_buildings.begin(); it != m_buildings.end(); ++it)        if (Building* building = GetBuilding(*it))            building->Reset();    // reset other state    m_available_trade = 0.0;    m_just_conquered = false;    m_is_about_to_be_colonized = false;    m_is_about_to_be_invaded = false;}
开发者ID:anarsky,项目名称:freeorion,代码行数:30,


示例10: GetMeter

double PopCenter::NextTurnPopGrowth() const {    double target_pop = std::max(GetMeter(METER_TARGET_POPULATION)->Current(), 0.01);   // clamping target pop to at least 1 prevents divide by zero cases    double cur_pop = GetMeter(METER_POPULATION)->Current();    Logger().debugStream() << "pop: " << cur_pop << " / " << target_pop;    double population_fraction = (target_pop - cur_pop) / target_pop;    Logger().debugStream() << "pop frac: " << population_fraction;    double change_potential = cur_pop * population_fraction * 0.05;    Logger().debugStream() << "change potential: " << change_potential;    double max_growth = target_pop - cur_pop;    double max_loss = -cur_pop;    double change = 0.0;    if (change_potential > 0)        change = std::min(max_growth, change_potential);    else if (change_potential < 0)        change = std::max(max_loss, change_potential);    Logger().debugStream() << "pop change: " << change;    return change;}
开发者ID:adesst,项目名称:freeorion,代码行数:18,


示例11: GetMeter

bool Field::InField(double x, double y) const {    const Meter* size_meter = GetMeter(METER_SIZE);    double radius = 1.0;    if (size_meter)        radius = size_meter->Current();    double dist2 = (x - this->X())*(x - this->X()) + (y - this->Y())*(y - this->Y());    return dist2 < radius*radius;}
开发者ID:mel-odious,项目名称:freeorion,代码行数:9,


示例12: GetMeter

void ResourceCenter::ResourceCenterClampMeters() {    GetMeter(METER_TARGET_INDUSTRY)->ClampCurrentToRange();    GetMeter(METER_TARGET_RESEARCH)->ClampCurrentToRange();    GetMeter(METER_TARGET_TRADE)->ClampCurrentToRange();    GetMeter(METER_TARGET_CONSTRUCTION)->ClampCurrentToRange();    GetMeter(METER_INDUSTRY)->ClampCurrentToRange();    GetMeter(METER_RESEARCH)->ClampCurrentToRange();    GetMeter(METER_TRADE)->ClampCurrentToRange();    GetMeter(METER_CONSTRUCTION)->ClampCurrentToRange();}
开发者ID:Deepsloth,项目名称:freeorion,代码行数:11,


示例13: SetDifficulty

void Steps::TidyUpData(){    if( m_StepsType == StepsType_Invalid )        m_StepsType = StepsType_dance_single;    if( GetDifficulty() == Difficulty_Invalid )        SetDifficulty( StringToDifficulty(GetDescription()) );    if( GetDifficulty() == Difficulty_Invalid )    {        if(	 GetMeter() == 1 )	SetDifficulty( Difficulty_Beginner );        else if( GetMeter() <= 3 )	SetDifficulty( Difficulty_Easy );        else if( GetMeter() <= 6 )	SetDifficulty( Difficulty_Medium );        else				SetDifficulty( Difficulty_Hard );    }    if( GetMeter() < 1) // meter is invalid        SetMeter( int(PredictMeter()) );}
开发者ID:goofwear,项目名称:stepmania,代码行数:19,


示例14: ResetTargetMaxUnpairedMeters

void System::ResetTargetMaxUnpairedMeters() {    UniverseObject::ResetTargetMaxUnpairedMeters();    // give systems base stealth slightly above zero, so that they can't be    // seen from a distance without high detection ability    if (Meter* stealth = GetMeter(METER_STEALTH)) {        stealth->ResetCurrent();        stealth->AddToCurrent(0.01f);    }}
开发者ID:J-d-H,项目名称:freeorion,代码行数:10,


示例15: GetMeter

void ResourceCenter::Reset() {    m_focus.clear();    GetMeter(METER_INDUSTRY)->Reset();    GetMeter(METER_RESEARCH)->Reset();    GetMeter(METER_TRADE)->Reset();    GetMeter(METER_CONSTRUCTION)->Reset();    GetMeter(METER_TARGET_INDUSTRY)->Reset();    GetMeter(METER_TARGET_RESEARCH)->Reset();    GetMeter(METER_TARGET_TRADE)->Reset();    GetMeter(METER_TARGET_CONSTRUCTION)->Reset();}
开发者ID:anarsky,项目名称:freeorion,代码行数:13,


示例16: ResetTargetMaxUnpairedMeters

void Fleet::ResetTargetMaxUnpairedMeters() {    UniverseObject::ResetTargetMaxUnpairedMeters();    // give fleets base stealth very high, so that they can (almost?) never be    // seen by empires that don't own them, unless their ships are seen and    // that visibility is propegated to the fleet that contains the ships    if (Meter* stealth = GetMeter(METER_STEALTH)) {        stealth->ResetCurrent();        stealth->AddToCurrent(2000.0);    }}
开发者ID:adesst,项目名称:freeorion,代码行数:11,


示例17: MeterType

void UniverseObject::ResetPairedActiveMeters() {    // iterate over paired active meters (those that have an associated max or    // target meter.  if another paired meter type is added to Enums.h, it    // should be added here as well.    for (MeterType meter_type = MeterType(METER_POPULATION);         meter_type <= MeterType(METER_TROOPS);         meter_type = MeterType(meter_type + 1))    {        if (Meter* meter = GetMeter(meter_type))            meter->SetCurrent(meter->Initial());    }}
开发者ID:adesst,项目名称:freeorion-1,代码行数:12,


示例18: CurrentMeterValue

void PopCenter::PopCenterPopGrowthProductionResearchPhase() {    double cur_pop = CurrentMeterValue(METER_POPULATION);    double pop_growth = NextTurnPopGrowth();                        // may be negative    double new_pop = cur_pop + pop_growth;    Logger().debugStream() << "Planet Pop: " << cur_pop << " growth: " << pop_growth;    if (new_pop >= MINIMUM_POP_CENTER_POPULATION) {        GetMeter(METER_POPULATION)->SetCurrent(new_pop);    } else {        // if population falls below threshold, kill off the remainder        Reset();    }}
开发者ID:adesst,项目名称:freeorion,代码行数:14,


示例19: ResourceCenterResetTargetMaxUnpairedMeters

void Planet::ResetTargetMaxUnpairedMeters() {    UniverseObject::ResetTargetMaxUnpairedMeters();    ResourceCenterResetTargetMaxUnpairedMeters();    PopCenterResetTargetMaxUnpairedMeters();    // give planets base stealth slightly above zero, so that they can't be    // seen from a distance without high detection ability    if (Meter* stealth = GetMeter(METER_STEALTH)) {        stealth->ResetCurrent();        //stealth->AddToCurrent(0.01f);    }    GetMeter(METER_MAX_SUPPLY)->ResetCurrent();    GetMeter(METER_MAX_SHIELD)->ResetCurrent();    GetMeter(METER_MAX_DEFENSE)->ResetCurrent();    GetMeter(METER_MAX_TROOPS)->ResetCurrent();    GetMeter(METER_REBEL_TROOPS)->ResetCurrent();    GetMeter(METER_DETECTION)->ResetCurrent();}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:19,


示例20: ResourceCenterPopGrowthProductionResearchPhase

void Planet::PopGrowthProductionResearchPhase() {    UniverseObject::PopGrowthProductionResearchPhase();    bool just_conquered = m_just_conquered;    // do not do production if planet was just conquered    m_just_conquered = false;    if (!just_conquered)        ResourceCenterPopGrowthProductionResearchPhase();    PopCenterPopGrowthProductionResearchPhase();    // check for planets with zero population.  If they have a species set, then    // they probably just starved    if (!SpeciesName().empty() && GetMeter(METER_POPULATION)->Current() == 0.0) {        if (Empire* empire = Empires().Lookup(this->Owner())) {            // generate starvation sitrep for empire that owns this depopulated planet            empire->AddSitRepEntry(CreatePlanetStarvedToDeathSitRep(this->ID()));            // record depopulation of planet with species while owned by this empire            std::map<std::string, int>::iterator species_it =                empire->SpeciesShipsLost().find(SpeciesName());            if (species_it == empire->SpeciesPlanetsDepoped().end())                empire->SpeciesPlanetsDepoped()[SpeciesName()] = 1;            else                species_it->second++;        }        // remove species        SetSpecies("");    }    if (!just_conquered) {        GetMeter(METER_SHIELD)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_SHIELD));        GetMeter(METER_DEFENSE)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_DEFENSE));        GetMeter(METER_TROOPS)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_TROOPS));        GetMeter(METER_REBEL_TROOPS)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_REBEL_TROOPS));        GetMeter(METER_SUPPLY)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_SUPPLY));    }    StateChangedSignal();}
开发者ID:J-d-H,项目名称:freeorion,代码行数:41,


示例21: ResourceCenterPopGrowthProductionResearchPhase

void Planet::PopGrowthProductionResearchPhase() {    UniverseObject::PopGrowthProductionResearchPhase();    bool just_conquered = m_just_conquered;    // do not do production if planet was just conquered    m_just_conquered = false;    if (!just_conquered)        ResourceCenterPopGrowthProductionResearchPhase();    PopCenterPopGrowthProductionResearchPhase();    // check for colonies without positive population, and change to outposts    if (!SpeciesName().empty() && GetMeter(METER_POPULATION)->Current() <= 0.0f) {        if (Empire* empire = GetEmpire(this->Owner())) {            empire->AddSitRepEntry(CreatePlanetDepopulatedSitRep(this->ID()));            if (!HasTag(TAG_STAT_SKIP_DEPOP)) {                // record depopulation of planet with species while owned by this empire                std::map<std::string, int>::iterator species_it = empire->SpeciesPlanetsDepoped().find(SpeciesName());                if (species_it == empire->SpeciesPlanetsDepoped().end())                    empire->SpeciesPlanetsDepoped()[SpeciesName()] = 1;                else                    species_it->second++;            }        }        // remove species        PopCenter::Reset();    }    if (!just_conquered) {        GetMeter(METER_SHIELD)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_SHIELD));        GetMeter(METER_DEFENSE)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_DEFENSE));        GetMeter(METER_TROOPS)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_TROOPS));        GetMeter(METER_REBEL_TROOPS)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_REBEL_TROOPS));        GetMeter(METER_SUPPLY)->SetCurrent(Planet::NextTurnCurrentMeterValue(METER_SUPPLY));    }    StateChangedSignal();}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:40,


示例22: GetSpecies

bool Planet::Colonize(int empire_id, const std::string& species_name, double population) {    const Species* species = nullptr;    // if desired pop > 0, we want a colony, not an outpost, so we need to do some checks    if (population > 0.0) {        // check if specified species exists and get reference        species = GetSpecies(species_name);        if (!species) {            ErrorLogger() << "Planet::Colonize couldn't get species already on planet with name: " << species_name;            return false;        }        // check if specified species can colonize this planet        if (EnvironmentForSpecies(species_name) < PE_HOSTILE) {            ErrorLogger() << "Planet::Colonize: can't colonize planet already populated by species " << species_name;            return false;        }    }    // reset the planet to unowned/unpopulated    if (!OwnedBy(empire_id)) {        Reset();    } else {        PopCenter::Reset();        for (int building_id : m_buildings)            if (auto building = GetBuilding(building_id))                building->Reset();        m_just_conquered = false;        m_is_about_to_be_colonized = false;        m_is_about_to_be_invaded = false;        m_is_about_to_be_bombarded = false;        SetOwner(ALL_EMPIRES);    }    // if desired pop > 0, we want a colony, not an outpost, so we have to set the colony species    if (population > 0.0)        SetSpecies(species_name);    // find a default focus. use first defined available focus.    // AvailableFoci function should return a vector of all names of    // available foci.    std::vector<std::string> available_foci = AvailableFoci();    if (species && !available_foci.empty()) {        bool found_preference = false;        for (const std::string& focus : available_foci) {            if (!focus.empty() && focus == species->PreferredFocus()) {                SetFocus(focus);                found_preference = true;                break;            }        }        if (!found_preference)            SetFocus(*available_foci.begin());    } else {        DebugLogger() << "Planet::Colonize unable to find a focus to set for species " << species_name;    }    // set colony population    GetMeter(METER_POPULATION)->SetCurrent(population);    GetMeter(METER_TARGET_POPULATION)->SetCurrent(population);    BackPropagateMeters();    // set specified empire as owner    SetOwner(empire_id);    // if there are buildings on the planet, set the specified empire as their owner too    for (auto& building : Objects().FindObjects<Building>(BuildingIDs()))    { building->SetOwner(empire_id); }    return true;}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:72,


示例23: GetBuildingType

void Planet::Conquer(int conquerer) {    m_just_conquered = true;    // deal with things on production queue located at this planet    Empire::ConquerProductionQueueItemsAtLocation(ID(), conquerer);    // deal with UniverseObjects (eg. buildings) located on this planet    for (auto& building : Objects().FindObjects<Building>(m_buildings)) {        const BuildingType* type = GetBuildingType(building->BuildingTypeName());        // determine what to do with building of this type...        const CaptureResult cap_result = type->GetCaptureResult(building->Owner(), conquerer, this->ID(), false);        if (cap_result == CR_CAPTURE) {            // replace ownership            building->SetOwner(conquerer);        } else if (cap_result == CR_DESTROY) {            // destroy object            //DebugLogger() << "Planet::Conquer destroying object: " << building->Name();            this->RemoveBuilding(building->ID());            if (auto system = GetSystem(this->SystemID()))                system->Remove(building->ID());            GetUniverse().Destroy(building->ID());        } else if (cap_result == CR_RETAIN) {            // do nothing        }    }    // replace ownership    SetOwner(conquerer);    GetMeter(METER_SUPPLY)->SetCurrent(0.0f);    GetMeter(METER_SUPPLY)->BackPropagate();    GetMeter(METER_INDUSTRY)->SetCurrent(0.0f);    GetMeter(METER_INDUSTRY)->BackPropagate();    GetMeter(METER_RESEARCH)->SetCurrent(0.0f);    GetMeter(METER_RESEARCH)->BackPropagate();    GetMeter(METER_TRADE)->SetCurrent(0.0f);    GetMeter(METER_TRADE)->BackPropagate();    GetMeter(METER_CONSTRUCTION)->SetCurrent(0.0f);    GetMeter(METER_CONSTRUCTION)->BackPropagate();    GetMeter(METER_DEFENSE)->SetCurrent(0.0f);    GetMeter(METER_DEFENSE)->BackPropagate();    GetMeter(METER_SHIELD)->SetCurrent(0.0f);    GetMeter(METER_SHIELD)->BackPropagate();    GetMeter(METER_HAPPINESS)->SetCurrent(0.0f);    GetMeter(METER_HAPPINESS)->BackPropagate();    GetMeter(METER_DETECTION)->SetCurrent(0.0f);    GetMeter(METER_DETECTION)->BackPropagate();}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:50,


示例24: GetMeter

void UniverseObject::ClampMeters(){ GetMeter(METER_STEALTH)->ClampCurrentToRange(); }
开发者ID:adesst,项目名称:freeorion-1,代码行数:2,



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


C++ GetMethod函数代码示例
C++ GetMessageW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。