void OnlineRaceLogic::onCarState(const Net::CarState &p_carState) { const CL_String &playerName = p_carState.getName(); if (hasPlayer(playerName)) { const CL_NetGameEvent serialData = p_carState.getSerializedData(); getPlayer(playerName).getCar().deserialize(serialData); } else { cl_log_event(LOG_ERROR, "Player %1 do not exists", playerName); } }
void OnlineRaceLogic::onPlayerJoined(const CL_String &p_name) { // check player existence if (!hasPlayer(p_name)) { // create new player m_remotePlayers.push_back( CL_SharedPtr<RemotePlayer>(new RemotePlayer(p_name)) ); RemotePlayer &player = *m_remotePlayers.back(); addPlayer(&player); // add his car to the level getLevel().addCar(&player.getCar()); display(cl_format(_("Player %1 joined"), p_name)); } else { cl_log_event(LOG_ERROR, "Player named '%1' already in list", p_name); } }
void np::HubConstructionComponent::addPlayer( np::NeuroPlayer* player, ac::es::EntityPtr proxyHub ) { if ( !hasPlayer( player)) slots.push_back( np::HubConstructionSlot( player, 0.0, proxyHub)); }