• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetUniverse函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ErrorLogger

void Building::Copy(std::shared_ptr<const UniverseObject> copied_object, int empire_id) {
    if (copied_object.get() == this)
        return;
    std::shared_ptr<const Building> copied_building = std::dynamic_pointer_cast<const Building>(copied_object);
    if (!copied_building) {
        ErrorLogger() << "Building::Copy passed an object that wasn't a Building";
        return;
    }

    int copied_object_id = copied_object->ID();
    Visibility vis = GetUniverse().GetObjectVisibilityByEmpire(copied_object_id, empire_id);
    std::set<std::string> visible_specials = GetUniverse().GetObjectVisibleSpecialsByEmpire(copied_object_id, empire_id);

    UniverseObject::Copy(copied_object, vis, visible_specials);

    if (vis >= VIS_BASIC_VISIBILITY) {
        this->m_planet_id =                 copied_building->m_planet_id;

        if (vis >= VIS_PARTIAL_VISIBILITY) {
            this->m_name =                      copied_building->m_name;

            this->m_building_type =             copied_building->m_building_type;
            this->m_produced_by_empire_id = copied_building->m_produced_by_empire_id;

            if (vis >= VIS_FULL_VISIBILITY) {
                this->m_ordered_scrapped =      copied_building->m_ordered_scrapped;
            }
        }
    }
}
开发者ID:MatGB,项目名称:freeorion,代码行数:30,代码来源:Building.cpp


示例2: GetUniverse

void CloneObjectsTest::testCloneMethod() {
    VMSymbol* methodSymbol = GetUniverse()->NewSymbol("myMethod");
    VMMethod* orig = GetUniverse()->NewMethod(methodSymbol, 0, 0);
    VMMethod* clone = orig->Clone();

    CPPUNIT_ASSERT((intptr_t)orig != (intptr_t)clone);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("class differs!!", orig->clazz, clone->clazz);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("objectSize differs!!", orig->objectSize, clone->objectSize);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("numberOfFields differs!!", orig->numberOfFields, clone->numberOfFields);

    CPPUNIT_ASSERT_EQUAL_MESSAGE("numberOfLocals differs!!",
            INT_VAL(load_ptr(orig->numberOfLocals)),
            INT_VAL(load_ptr(clone->numberOfLocals)));
    CPPUNIT_ASSERT_EQUAL_MESSAGE("bcLength differs!!",
            INT_VAL(load_ptr(orig->bcLength)),
            INT_VAL(load_ptr(clone->bcLength)));
    CPPUNIT_ASSERT_EQUAL_MESSAGE("maximumNumberOfStackElements differs!!",
            INT_VAL(load_ptr(orig->maximumNumberOfStackElements)),
            INT_VAL(load_ptr(clone->maximumNumberOfStackElements)));
    CPPUNIT_ASSERT_EQUAL_MESSAGE("numberOfArguments differs!!",
            INT_VAL(load_ptr(orig->numberOfArguments)),
            INT_VAL(load_ptr(clone->numberOfArguments)));
    CPPUNIT_ASSERT_EQUAL_MESSAGE("numberOfConstants differs!!",
            INT_VAL(load_ptr(orig->numberOfConstants)),
            INT_VAL(load_ptr(clone->numberOfConstants)));

    CPPUNIT_ASSERT_EQUAL_MESSAGE("GetHolder() differs!!", orig->GetHolder(), clone->GetHolder());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("GetSignature() differs!!", orig->GetSignature(), clone->GetSignature());
}
开发者ID:SOM-st,项目名称:SOMpp,代码行数:29,代码来源:CloneObjectsTest.cpp


示例3: BOOST_SERIALIZATION_NVP

void Empire::serialize(Archive& ar, const unsigned int version)
{
    ar  & BOOST_SERIALIZATION_NVP(m_id)
        & BOOST_SERIALIZATION_NVP(m_name)
        & BOOST_SERIALIZATION_NVP(m_player_name)
        & BOOST_SERIALIZATION_NVP(m_color)
        & BOOST_SERIALIZATION_NVP(m_capital_id)
        & BOOST_SERIALIZATION_NVP(m_techs)
        & BOOST_SERIALIZATION_NVP(m_meters)
        & BOOST_SERIALIZATION_NVP(m_research_queue)
        & BOOST_SERIALIZATION_NVP(m_research_progress)
        & BOOST_SERIALIZATION_NVP(m_production_queue)
        & BOOST_SERIALIZATION_NVP(m_available_building_types)
        & BOOST_SERIALIZATION_NVP(m_available_part_types)
        & BOOST_SERIALIZATION_NVP(m_available_hull_types)
        & BOOST_SERIALIZATION_NVP(m_supply_system_ranges)
        & BOOST_SERIALIZATION_NVP(m_supply_unobstructed_systems)
        & BOOST_SERIALIZATION_NVP(m_supply_starlane_traversals)
        & BOOST_SERIALIZATION_NVP(m_supply_starlane_obstructed_traversals)
        & BOOST_SERIALIZATION_NVP(m_available_system_exit_lanes)
        & BOOST_SERIALIZATION_NVP(m_fleet_supplyable_system_ids)
        & BOOST_SERIALIZATION_NVP(m_resource_supply_groups);

    if (GetUniverse().AllObjectsVisible() ||
        GetUniverse().EncodingEmpire() == ALL_EMPIRES ||
        m_id == GetUniverse().EncodingEmpire())
    {
        ar  & BOOST_SERIALIZATION_NVP(m_ship_designs)
            & BOOST_SERIALIZATION_NVP(m_sitrep_entries)
            & BOOST_SERIALIZATION_NVP(m_resource_pools)
            & BOOST_SERIALIZATION_NVP(m_population_pool)

            & BOOST_SERIALIZATION_NVP(m_explored_systems)
            & BOOST_SERIALIZATION_NVP(m_ship_names_used)

            & BOOST_SERIALIZATION_NVP(m_species_ships_owned)
            & BOOST_SERIALIZATION_NVP(m_ship_designs_owned)
            & BOOST_SERIALIZATION_NVP(m_species_colonies_owned)
            & BOOST_SERIALIZATION_NVP(m_outposts_owned)
            & BOOST_SERIALIZATION_NVP(m_building_types_owned)

            & BOOST_SERIALIZATION_NVP(m_empire_ships_destroyed)
            & BOOST_SERIALIZATION_NVP(m_ship_designs_destroyed)
            & BOOST_SERIALIZATION_NVP(m_species_ships_destroyed)
            & BOOST_SERIALIZATION_NVP(m_species_planets_invaded)

            & BOOST_SERIALIZATION_NVP(m_species_ships_produced)
            & BOOST_SERIALIZATION_NVP(m_ship_designs_produced)
            & BOOST_SERIALIZATION_NVP(m_species_ships_lost)
            & BOOST_SERIALIZATION_NVP(m_ship_designs_lost)
            & BOOST_SERIALIZATION_NVP(m_species_ships_scrapped)
            & BOOST_SERIALIZATION_NVP(m_ship_designs_scrapped)

            & BOOST_SERIALIZATION_NVP(m_species_planets_depoped)
            & BOOST_SERIALIZATION_NVP(m_species_planets_bombed)

            & BOOST_SERIALIZATION_NVP(m_building_types_produced)
            & BOOST_SERIALIZATION_NVP(m_building_types_scrapped);
    }
}
开发者ID:TeoTwawki,项目名称:freeorion,代码行数:60,代码来源:SerializeEmpire.cpp


示例4: if

void Parser::genPushVariable(MethodGenerationContext* mgenc,
        const StdString& var) {
    // The purpose of this function is to find out whether the variable to be
    // pushed on the stack is a local variable, argument, or object field. This
    // is done by examining all available lexical contexts, starting with the
    // innermost (i.e., the one represented by mgenc).
    size_t index = 0;
    int context = 0;
    bool is_argument = false;

    if (mgenc->FindVar(var, &index, &context, &is_argument)) {
        if (is_argument)
            bcGen->EmitPUSHARGUMENT(mgenc, index, context);
        else
            bcGen->EmitPUSHLOCAL(mgenc, index, context);
    } else if (mgenc->HasField(var)) {
        VMSymbol* fieldName = GetUniverse()->SymbolFor(var);
        mgenc->AddLiteralIfAbsent(fieldName);
        bcGen->EmitPUSHFIELD(mgenc, fieldName);
    } else {

        VMSymbol* global = GetUniverse()->SymbolFor(var);
        mgenc->AddLiteralIfAbsent(global);

        bcGen->EmitPUSHGLOBAL(mgenc, global);
    }
}
开发者ID:SOM-st,项目名称:SOMpp,代码行数:27,代码来源:Parser.cpp


示例5: GetSpeciesHomeworldsMap

void SpeciesManager::serialize(Archive& ar, const unsigned int version)
{
    // Don't need to send all the data about species, as this is derived from
    // content data files in species.txt that should be available to any
    // client or server.  Instead, just need to send the gamestate portion of
    // species: their homeworlds in the current game, and their opinions of
    // empires and eachother

    std::map<std::string, std::set<int> >                   species_homeworlds;
    std::map<std::string, std::map<int, double> >           empire_opinions;
    std::map<std::string, std::map<std::string, double> >   other_species_opinions;

    if (Archive::is_saving::value) {
        species_homeworlds =    GetSpeciesHomeworldsMap(GetUniverse().EncodingEmpire());
        empire_opinions =       GetSpeciesEmpireOpinionsMap(GetUniverse().EncodingEmpire());
        other_species_opinions= GetSpeciesSpeciesOpinionsMap(GetUniverse().EncodingEmpire());
    }

    ar  & BOOST_SERIALIZATION_NVP(species_homeworlds)
        & BOOST_SERIALIZATION_NVP(empire_opinions)
        & BOOST_SERIALIZATION_NVP(other_species_opinions);

    if (Archive::is_loading::value) {
        SetSpeciesHomeworlds(species_homeworlds);
        SetSpeciesEmpireOpinions(empire_opinions);
        SetSpeciesSpeciesOpinions(other_species_opinions);
    }
}
开发者ID:TeoTwawki,项目名称:freeorion,代码行数:28,代码来源:SerializeUniverse.cpp


示例6: Logger

void Fleet::Copy(const UniverseObject* copied_object, int empire_id) {
    if (copied_object == this)
        return;
    const Fleet* copied_fleet = universe_object_cast<Fleet*>(copied_object);
    if (!copied_fleet) {
        Logger().errorStream() << "Fleet::Copy passed an object that wasn't a Fleet";
        return;
    }

    int copied_object_id = copied_object->ID();
    Visibility vis = GetUniverse().GetObjectVisibilityByEmpire(copied_object_id, empire_id);
    std::set<std::string> visible_specials = GetUniverse().GetObjectVisibleSpecialsByEmpire(copied_object_id, empire_id);

    UniverseObject::Copy(copied_object, vis, visible_specials);

    if (vis >= VIS_BASIC_VISIBILITY) {
        this->m_ships =         copied_fleet->VisibleContainedObjects(empire_id);
        this->m_next_system =   copied_fleet->m_next_system;
        this->m_prev_system =   copied_fleet->m_prev_system;

        if (vis >= VIS_PARTIAL_VISIBILITY) {
            this->m_speed =                 copied_fleet->m_speed;

            if (vis >= VIS_FULL_VISIBILITY) {
                this->m_moving_to =             copied_fleet->m_moving_to;
                this->m_travel_route =          copied_fleet->m_travel_route;
                this->m_travel_distance =       copied_fleet->m_travel_distance;
                this->m_arrived_this_turn =     copied_fleet->m_arrived_this_turn;
                this->m_arrival_starlane =      copied_fleet->m_arrival_starlane;

            } else {
                int             moving_to =         copied_fleet->m_next_system;
                std::list<int>  travel_route;
                double          travel_distance =   copied_fleet->m_travel_distance;

                const std::list<int>& copied_fleet_route = copied_fleet->m_travel_route;

                ShortenRouteToEndAtSystem(travel_route, moving_to);
                if (!travel_route.empty() && travel_route.front() != 0 && travel_route.size() != copied_fleet_route.size()) {
                    if (moving_to == copied_fleet->m_moving_to)
                        moving_to = travel_route.back();
                    try {
                        travel_distance -= GetUniverse().ShortestPath(travel_route.back(),
                                                                      copied_fleet_route.back()).second;
                    } catch (...) {
                        Logger().debugStream() << "Fleet::Copy couldn't find route to system(s):"
                                               << " travel route back: " << travel_route.back()
                                               << " or copied fleet route back: " << copied_fleet_route.back();
                    }
                }

                this->m_moving_to = moving_to;
                this->m_travel_route = travel_route;
                this->m_travel_distance = travel_distance;
            }
        }
    }
}
开发者ID:adesst,项目名称:freeorion,代码行数:58,代码来源:Fleet.cpp


示例7: WriteDMX

/*
 * Write data to this port.
 */
bool EspNetOutputPort::WriteDMX(const DmxBuffer &buffer,
                                uint8_t priority) {
  if (!GetUniverse())
    return false;

  if (!m_node->SendDMX(m_helper.EspNetUniverseId(GetUniverse()), buffer))
    return false;
  return true;
  (void) priority;
}
开发者ID:Siliconsoul,项目名称:ola,代码行数:13,代码来源:EspNetPort.cpp


示例8: EmpireKnownObjects

ObjectMap& EmpireKnownObjects(int empire_id) {
#ifdef FREEORION_BUILD_SERVER
    return GetUniverse().EmpireKnownObjects(empire_id);
#else
    int client_empire_id = ClientApp::GetApp()->EmpireID();
    if (empire_id == ALL_EMPIRES || empire_id == client_empire_id)
        return Objects();
    return GetUniverse().EmpireKnownObjects(empire_id); // should be empty as of this writing, as other empires' known objects aren't sent to clients
#endif
}
开发者ID:Ablu,项目名称:freeorion,代码行数:10,代码来源:AppInterface.cpp


示例9: FindGameWords

void MessageWndEdit::FindGameWords() {
     // add player and empire names
    for (std::map<int, Empire*>::value_type& entry : Empires()) {
        m_game_words.insert(entry.second->Name());
        m_game_words.insert(entry.second->PlayerName());
    }
    // add system names
    for (std::shared_ptr<System> system : GetUniverse().Objects().FindObjects<System>()) {
        if (system->Name() != "")
            m_game_words.insert(system->Name());
    }
     // add ship names
    for (std::shared_ptr<Ship> ship : GetUniverse().Objects().FindObjects<Ship>()) {
        if (ship->Name() != "")
            m_game_words.insert(ship->Name());
    }
     // add ship design names

    for (const auto& design : GetPredefinedShipDesignManager().GetOrderedShipDesigns()) {
        if (!design->Name().empty())
            m_game_words.insert(UserString(design->Name()));
    }
     // add specials names
    for (const std::string& special_name : SpecialNames()) {
        if (special_name != "")
            m_game_words.insert(UserString(special_name));
    }
     // add species names
    for (const std::map<std::string, Species*>::value_type& entry : GetSpeciesManager()) {
        if (entry.second->Name() != "")
            m_game_words.insert(UserString(entry.second->Name()));
    }
     // add techs names
    for (const std::string& tech_name : GetTechManager().TechNames()) {
        if (tech_name != "")
            m_game_words.insert(UserString(tech_name));
    }
    // add building type names
    for (const auto& entry : GetBuildingTypeManager()) {
        if (entry.second->Name() != "")
            m_game_words.insert(UserString(entry.second->Name()));
    }
    // add ship hulls
    for (const auto& design : GetPredefinedShipDesignManager().GetOrderedShipDesigns()) {
        if (!design->Hull().empty())
            m_game_words.insert(UserString(design->Hull()));
    }
    // add ship parts
    for (const auto& design : GetPredefinedShipDesignManager().GetOrderedShipDesigns()) {
        for (const std::string& part_name : design->Parts()) {
            if (part_name != "")
                m_game_words.insert(UserString(part_name));
        }
    }
 }
开发者ID:MatGB,项目名称:freeorion,代码行数:55,代码来源:ChatWnd.cpp


示例10: GetUniverseObject

UniverseObject* GetUniverseObject(int object_id) {
#ifdef FREEORION_BUILD_SERVER
    return GetUniverse().Objects().Object(object_id);
#else
    // attempt to get live / up to date / mutable object
    UniverseObject* obj = GetUniverse().Objects().Object(object_id);
    // if not up to date info, use latest known out of date info about object
    if (!obj)
        obj = EmpireKnownObjects(ClientApp::GetApp()->EmpireID()).Object(object_id);
    return obj;
#endif
}
开发者ID:Ablu,项目名称:freeorion,代码行数:12,代码来源:AppInterface.cpp


示例11: MoveTo

void UniverseObject::MoveTo(double x, double y) {
    if (x < 0.0 || GetUniverse().UniverseWidth() < x || y < 0.0 || GetUniverse().UniverseWidth() < y)
        DebugLogger() << "UniverseObject::MoveTo : Placing object \"" + m_name + "\" off the map area.";

    if (m_x == x && m_y == y)
        return;

    m_x = x;
    m_y = y;

    StateChangedSignal();
}
开发者ID:adesst,项目名称:freeorion-1,代码行数:12,代码来源:UniverseObject.cpp


示例12: MoveTo

void UniverseObject::MoveTo(double x, double y) {
    //Logger().debugStream() << "UniverseObject::MoveTo(double x, double y)";
    if (x < 0.0 || GetUniverse().UniverseWidth() < x || y < 0.0 || GetUniverse().UniverseWidth() < y)
        Logger().debugStream() << "UniverseObject::MoveTo : Placing object \"" + m_name + "\" off the map area.";

    m_x = x;
    m_y = y;

    // remove object from its old system (unless object is a system, as that would attempt to remove it from itself)
    if (this->ID() != this->SystemID())
        if (System* system = GetSystem(this->SystemID()))
            system->Remove(this->ID());

    StateChangedSignal();
}
开发者ID:anarsky,项目名称:freeorion,代码行数:15,代码来源:UniverseObject.cpp


示例13: ErrorLogger

void Planet::Copy(std::shared_ptr<const UniverseObject> copied_object, int empire_id) {
    if (copied_object.get() == this)
        return;
    auto copied_planet = std::dynamic_pointer_cast<const Planet>(copied_object);
    if (!copied_planet) {
        ErrorLogger() << "Planet::Copy passed an object that wasn't a Planet";
        return;
    }

    int copied_object_id = copied_object->ID();
    Visibility vis = GetUniverse().GetObjectVisibilityByEmpire(copied_object_id, empire_id);
    std::set<std::string> visible_specials = GetUniverse().GetObjectVisibleSpecialsByEmpire(copied_object_id, empire_id);

    UniverseObject::Copy(copied_object, vis, visible_specials);
    PopCenter::Copy(copied_planet, vis);
    ResourceCenter::Copy(copied_planet, vis);

    if (vis >= VIS_BASIC_VISIBILITY) {
        this->m_name =                      copied_planet->m_name;

        this->m_buildings =                 copied_planet->VisibleContainedObjectIDs(empire_id);
        this->m_type =                      copied_planet->m_type;
        this->m_original_type =             copied_planet->m_original_type;
        this->m_size =                      copied_planet->m_size;
        this->m_orbital_period =            copied_planet->m_orbital_period;
        this->m_initial_orbital_position =  copied_planet->m_initial_orbital_position;
        this->m_rotational_period =         copied_planet->m_rotational_period;
        this->m_axial_tilt =                copied_planet->m_axial_tilt;
        this->m_just_conquered =            copied_planet->m_just_conquered;

        if (vis >= VIS_PARTIAL_VISIBILITY) {
            if (vis >= VIS_FULL_VISIBILITY) {
                this->m_is_about_to_be_colonized =  copied_planet->m_is_about_to_be_colonized;
                this->m_is_about_to_be_invaded   =  copied_planet->m_is_about_to_be_invaded;
                this->m_is_about_to_be_bombarded =  copied_planet->m_is_about_to_be_bombarded;
                this->m_ordered_given_to_empire_id =copied_planet->m_ordered_given_to_empire_id;
                this->m_last_turn_attacked_by_ship= copied_planet->m_last_turn_attacked_by_ship;
            } else {
                // copy system name if at partial visibility, as it won't be copied
                // by UniverseObject::Copy unless at full visibility, but players
                // should know planet names even if they don't own the planet
                GetUniverse().InhibitUniverseObjectSignals(true);
                this->Rename(copied_planet->Name());
                GetUniverse().InhibitUniverseObjectSignals(false);
            }
        }
    }
}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:48,代码来源:Planet.cpp


示例14: Order

FleetMoveOrder::FleetMoveOrder(int empire, int fleet_id, int start_system_id, int dest_system_id, bool append) :
    Order(empire),
    m_fleet(fleet_id),
    m_start_system(start_system_id),
    m_dest_system(dest_system_id),
    m_append(append)
{
    // perform sanity checks
    TemporaryPtr<const Fleet> fleet = GetFleet(FleetID());
    if (!fleet) {
        ErrorLogger() << "Empire with id " << EmpireID() << " ordered fleet with id " << FleetID() << " to move, but no such fleet exists";
        return;
    }

    TemporaryPtr<const System> destination_system = GetSystem(DestinationSystemID());
    if (!destination_system) {
        ErrorLogger() << "Empire with id " << EmpireID() << " ordered fleet to move to system with id " << DestinationSystemID() << " but no such system exists / is known to exist";
        return;
    }

    // verify that empire specified in order owns specified fleet
    if (!fleet->OwnedBy(EmpireID()) ) {
        ErrorLogger() << "Empire with id " << EmpireID() << " order to move but does not own fleet with id " << FleetID();
        return;
    }

    std::pair<std::list<int>, double> short_path = GetUniverse().ShortestPath(m_start_system, m_dest_system, empire);

    m_route.clear();
    std::copy(short_path.first.begin(), short_path.first.end(), std::back_inserter(m_route));

    // ensure a zero-length (invalid) route is not requested / sent to a fleet
    if (m_route.empty())
        m_route.push_back(m_start_system);
}
开发者ID:ianlintner,项目名称:freeorion,代码行数:35,代码来源:Order.cpp


示例15: GetFrame

void Interpreter::doSuperSend(long bytecodeIndex) {
    VMSymbol* signature = static_cast<VMSymbol*>(method->GetConstant(bytecodeIndex));

    VMFrame* ctxt = GetFrame()->GetOuterContext();
    VMMethod* realMethod = ctxt->GetMethod();
    VMClass* holder = realMethod->GetHolder();
    VMClass* super = holder->GetSuperClass();
    VMInvokable* invokable = static_cast<VMInvokable*>(super->LookupInvokable(signature));

    if (invokable != nullptr)
        (*invokable)(GetFrame());
    else {
        long numOfArgs = Signature::GetNumberOfArguments(signature);
        vm_oop_t receiver = GetFrame()->GetStackElement(numOfArgs - 1);
        VMArray* argumentsArray = GetUniverse()->NewArray(numOfArgs);

        for (long i = numOfArgs - 1; i >= 0; --i) {
            vm_oop_t o = GetFrame()->Pop();
            argumentsArray->SetIndexableField(i, o);
        }
        vm_oop_t arguments[] = {signature, argumentsArray};

        AS_OBJ(receiver)->Send(doesNotUnderstand, arguments, 2);
    }
}
开发者ID:jdegeete,项目名称:SOMpp,代码行数:25,代码来源:Interpreter.cpp


示例16: TraceLogger

boost::statechart::result WaitingForTurnData::react(const TurnUpdate& msg) {
    TraceLogger(FSM) << "(HumanClientFSM) PlayingGame.TurnUpdate";

    int current_turn = INVALID_GAME_TURN;

    try {
        ExtractTurnUpdateMessageData(msg.m_message,           Client().EmpireID(),    current_turn,
                                     Empires(),               GetUniverse(),          GetSpeciesManager(),
                                     GetCombatLogManager(),   GetSupplyManager(),     Client().Players());
    } catch (...) {
        Client().GetClientUI().GetMessageWnd()->HandleLogMessage(UserString("ERROR_PROCESSING_SERVER_MESSAGE") + "\n");
        return discard_event();
    }

    DebugLogger(FSM) << "Extracted TurnUpdate message for turn: " << current_turn;

    Client().SetCurrentTurn(current_turn);

    // if I am the host, do autosave
    if (Client().Networking().PlayerIsHost(Client().PlayerID()))
        Client().Autosave();

    Client().HandleTurnUpdate();

    return transit<PlayingTurn>();
}
开发者ID:matt474,项目名称:freeorion,代码行数:26,代码来源:HumanClientFSM.cpp


示例17: UpperLeft

void FleetButton::RenderUnpressed() {
    GG::Pt ul = UpperLeft(), lr = LowerRight();
    const double midX = static_cast<double>(Value(ul.x + lr.x))/2.0;
    const double midY = static_cast<double>(Value(ul.y + lr.y))/2.0;

    if (m_selected && m_selection_texture) {
        double sel_ind_scale = GetOptionsDB().Get<double>("UI.fleet-selection-indicator-size");
        double sel_ind_half_size = Value(Width()) * sel_ind_scale / 2.0;

        GG::Pt sel_ul = GG::Pt(GG::X(static_cast<int>(midX - sel_ind_half_size)), GG::Y(static_cast<int>(midY - sel_ind_half_size)));
        GG::Pt sel_lr = GG::Pt(GG::X(static_cast<int>(midX + sel_ind_half_size)), GG::Y(static_cast<int>(midY + sel_ind_half_size)));

        glColor(GG::CLR_WHITE);
        m_selection_texture->OrthoBlit(sel_ul, sel_lr);
    }

    glColor(Color());
    if (m_vertex_components.empty()) {
        if (m_size_icon)
            m_size_icon->OrthoBlit(ul);
        for (std::vector<boost::shared_ptr<GG::Texture> >::iterator it = m_head_icons.begin(); it != m_head_icons.end(); ++it)
            (*it)->OrthoBlit(ul);
    } else {
        std::vector<double> vertsXY;
        vertsXY.push_back(midX + m_vertex_components[0]);
        vertsXY.push_back(midY + m_vertex_components[1]);
        vertsXY.push_back(midX + m_vertex_components[2]);
        vertsXY.push_back(midY + m_vertex_components[3]);
        vertsXY.push_back(midX + m_vertex_components[4]);
        vertsXY.push_back(midY + m_vertex_components[5]);
        vertsXY.push_back(midX + m_vertex_components[6]);
        vertsXY.push_back(midY + m_vertex_components[7]);

        for (std::vector<boost::shared_ptr<GG::Texture> >::iterator it = m_head_icons.begin(); it != m_head_icons.end(); ++it)
            RenderTexturedQuad(vertsXY, *it);
        RenderTexturedQuad(vertsXY, m_size_icon);
    }


    // Scanlines for not currently-visible objects?
    int empire_id = HumanClientApp::GetApp()->EmpireID();
    if (!scanline_shader || empire_id == ALL_EMPIRES || !GetOptionsDB().Get<bool>("UI.system-fog-of-war"))
        return;

    bool at_least_one_fleet_visible = false;
    for (std::vector<int>::const_iterator it = m_fleets.begin(); it != m_fleets.end(); ++it) {
        if (GetUniverse().GetObjectVisibilityByEmpire(*it, empire_id) >= VIS_BASIC_VISIBILITY) {
            at_least_one_fleet_visible = true;
            break;
        }
    }
    if (at_least_one_fleet_visible)
        return;

    float fog_scanline_spacing = static_cast<float>(GetOptionsDB().Get<double>("UI.system-fog-of-war-spacing"));
    scanline_shader->Use();
    scanline_shader->Bind("scanline_spacing", fog_scanline_spacing);
    CircleArc(ul, lr, 0.0, TWO_PI, true);
    scanline_shader->stopUse();
}
开发者ID:J-d-H,项目名称:freeorion,代码行数:60,代码来源:FleetButton.cpp


示例18: GetNewDesignID

int GetNewDesignID() {
#ifdef FREEORION_BUILD_SERVER
    return GetUniverse().GenerateDesignID();
#else
    return ClientApp::GetApp()->GetNewDesignID();
#endif
}
开发者ID:Ablu,项目名称:freeorion,代码行数:7,代码来源:AppInterface.cpp


示例19: SetBackColor

void
JXMesaCamera::Render()
{
	if (!PrepareMesa())
		{
		return;
		}

	// erase everything

	SetBackColor(itsWidget->GetBackColor());
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// prepare the display

	PrepareTransforms();

	// render the scene

	GetUniverse()->RenderAll(*this);

	// display the scene

	glFlush();

	if (itsDoubleBufferFlag)
		{
		XMesaCopySubBuffer(itsXMBuffer, itsGLViewport.x,itsGLViewport.y,
						   itsGLViewport.width,itsGLViewport.height);
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:31,代码来源:JXMesaCamera.cpp


示例20: keyword

void Parser::keywordMessage(MethodGenerationContext* mgenc, bool super) {
    StdString kw = keyword();
    
    // special compilation for ifTrue and ifFalse
    if (!super && kw == "ifTrue:") {
        ifTrueMessage(mgenc);
        return;
    } else if (!super && kw == "ifFalse:") {
        ifFalseMessage(mgenc);
        return;
    }
    formula(mgenc);
    while (sym == Keyword) {
        kw.append(keyword());
        formula(mgenc);
    }

    VMSymbol* msg = GetUniverse()->SymbolFor(kw);

    mgenc->AddLiteralIfAbsent(msg);

    if (super)
        bcGen->EmitSUPERSEND(mgenc, msg);
    else
        bcGen->EmitSEND(mgenc, msg);

}
开发者ID:SOM-st,项目名称:SOMpp,代码行数:27,代码来源:Parser.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetUpdateRect函数代码示例发布时间:2022-05-30
下一篇:
C++ GetUnitOwner函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap