Пример #1
0
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();
}
Пример #2
0
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();
}
Пример #3
0
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();
}
Пример #4
0
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();
}