Exemple #1
0
//------------------------------------------------------------------------------
// shutdownNotification() -- Shutdown the simulation
//------------------------------------------------------------------------------
bool Antenna::shutdownNotification()
{
    setSystem(0);
    clearQueues();

    return BaseClass::shutdownNotification();
}
Exemple #2
0
void Antenna::deleteData()
{
   setSystem(0);
   setSlotGainPattern(0);

   clearQueues();
}
Exemple #3
0
//------------------------------------------------------------------------------
// shutdownNotification() -- We're shutting down
//------------------------------------------------------------------------------
bool Datalink::shutdownNotification()
{
   clearQueues();
   setRadio(0);
   setTrackManager(0);
   setTrackManagerName(0);

   return BaseClass::shutdownNotification();
}
Exemple #4
0
void Datalink::deleteData()
{
   if (inQueue != 0 && outQueue != 0) {
      clearQueues();
      delete inQueue;
      delete outQueue;
      inQueue = 0;
      outQueue = 0;
   }
   setRadio(0);
   setRadioName(0);
   setTrackManager(0);
}
Exemple #5
0
//------------------------------------------------------------------------------
// reset() -- Reset parameters
//------------------------------------------------------------------------------
void Datalink::reset()
{
   clearQueues();
   // ---
   // Do we need to find the track manager?
   // ---
   if (getTrackManager() == 0 && getTrackManagerName() != 0) {
        // We have a name of the track manager, but not the track manager itself
        const char* name = *getTrackManagerName();
        // Get the named track manager from the onboard computer
        Player* ownship = dynamic_cast<Player*>( findContainerByType(typeid(Player)) );
        if (ownship != 0) {
            OnboardComputer* obc = ownship->getOnboardComputer();
            if (obc != 0) {
               setTrackManager(obc->getTrackManagerByName(name));
            }
        }    
        if (getTrackManager() == 0) {
            // The assigned track manager was not found!
            //if (isMessageEnabled(MSG_ERROR)) {
            //std::cerr << "Datalink ERROR -- track manager, " << name << ", was not found!" << std::endl;
            //}
        }
   }
   // ---
   // Do we need to find the comm radio?
   // ---
   if (getRadio() == 0 && getRadioName() != 0) {
        // We have a name of the radio, but not the radio itself
        const char* name = *getRadioName();
        // Get the named radio from the component list of radios
        Player* ownship = dynamic_cast<Player*>( findContainerByType(typeid(Player)) );
        if (ownship != 0) {
            CommRadio* cr = dynamic_cast<CommRadio*>(ownship->getRadioByName(name));
            setRadio(cr);
        }
        CommRadio* rad = getRadio();
        if (rad == 0) {
            // The assigned radio was not found!
            if (isMessageEnabled(MSG_ERROR)) {
            std::cerr << "Datalink ERROR -- radio, " << name << ", was not found!" << std::endl;
        }
        }
        else {
            rad->setDatalink(this);
            rad->setReceiverEnabledFlag(true);
            rad->setTransmitterEnableFlag(true);
        }
   }
   BaseClass::reset();
}
Exemple #6
0
void Datalink::deleteData()
{
   if (inQueue != nullptr && outQueue != nullptr) {
      clearQueues();
      delete inQueue;
      delete outQueue;
      inQueue = nullptr;
      outQueue = nullptr;
   }
   setRadio(nullptr);
   setRadioName(nullptr);
   setTrackManager(nullptr);
   setTrackManagerName(nullptr);
}
Exemple #7
0
int Map::load(std::string fname) {
	FileParser infile;
	maprow *cur_layer = NULL;

	clearEvents();
	clearLayers();
	clearQueues();

	// @CLASS Map|Description of maps/
	if (!infile.open(fname))
		return 0;

	this->filename = fname;

	while (infile.next()) {
		if (infile.new_section) {

			// for sections that are stored in collections, add a new object here
			if (infile.section == "enemy")
				enemies.push(Map_Enemy());
			else if (infile.section == "enemygroup")
				enemy_groups.push(Map_Group());
			else if (infile.section == "npc")
				npcs.push(Map_NPC());
			else if (infile.section == "event")
				events.push_back(Event());

		}
		if (infile.section == "header")
			loadHeader(infile);
		else if (infile.section == "layer")
			loadLayer(infile, &cur_layer);
		else if (infile.section == "enemy")
			loadEnemy(infile);
		else if (infile.section == "enemygroup")
			loadEnemyGroup(infile, &enemy_groups.back());
		else if (infile.section == "npc")
			loadNPC(infile);
		else if (infile.section == "event")
			EventManager::loadEvent(infile, &events.back());
	}

	infile.close();

	return 0;
}
MapRenderer::~MapRenderer() {
	if (music != NULL) {
		Mix_HaltMusic();
		Mix_FreeMusic(music);
	}

	tip_buf.clear();
	clearLayers();
	clearEvents();
	clearQueues();
	delete tip;

	/* unload sounds */
	snd->reset();
	while (!sids.empty()) {
		snd->unload(sids.back());
		sids.pop_back();
	}
}
int Map::load(const std::string& fname) {
	FileParser infile;

	clearEvents();
	clearLayers();
	clearQueues();

	music_filename = "";

	// @CLASS Map|Description of maps/
	if (!infile.open(fname))
		return 0;

	this->filename = fname;

	while (infile.next()) {
		if (infile.new_section) {

			// for sections that are stored in collections, add a new object here
			if (infile.section == "enemy")
				enemy_groups.push(Map_Group());
			else if (infile.section == "npc")
				npcs.push(Map_NPC());
			else if (infile.section == "event")
				events.push_back(Event());

		}
		if (infile.section == "header")
			loadHeader(infile);
		else if (infile.section == "layer")
			loadLayer(infile);
		else if (infile.section == "enemy")
			loadEnemyGroup(infile, &enemy_groups.back());
		else if (infile.section == "npc")
			loadNPC(infile);
		else if (infile.section == "event")
			EventManager::loadEvent(infile, &events.back());
	}

	infile.close();

	// create a temporary EffectDef for immunity; will be used for map StatBlocks
	EffectDef immunity_effect;
	immunity_effect.id = "MAP_EVENT_IMMUNITY";
	immunity_effect.type = "immunity";

	// create StatBlocks for events that need powers
	for (unsigned i=0; i<events.size(); ++i) {
		Event_Component *ec_power = events[i].getComponent(EC_POWER);
		if (ec_power) {
			statblocks.push_back(StatBlock());
			StatBlock *statb = &statblocks.back();

			if (!statb) {
				logError("Map: Could not create StatBlock for Event.");
				continue;
			}

			// store the index of this StatBlock so that we can find it when the event is activated
			ec_power->y = static_cast<int>(statblocks.size())-1;

			statb->starting[STAT_ACCURACY] = 1000; // always hit the target

			Event_Component *ec_path = events[i].getComponent(EC_POWER_PATH);
			if (ec_path) {
				// source is power path start
				statb->pos.x = static_cast<float>(ec_path->x) + 0.5f;
				statb->pos.y = static_cast<float>(ec_path->y) + 0.5f;
			}
			else {
				// source is event location
				statb->pos.x = static_cast<float>(events[i].location.x) + 0.5f;
				statb->pos.y = static_cast<float>(events[i].location.y) + 0.5f;
			}

			Event_Component *ec_damage = events[i].getComponent(EC_POWER_DAMAGE);
			if (ec_damage) {
				statb->starting[STAT_DMG_MELEE_MIN] = statb->starting[STAT_DMG_RANGED_MIN] = statb->starting[STAT_DMG_MENT_MIN] = ec_damage->a;
				statb->starting[STAT_DMG_MELEE_MAX] = statb->starting[STAT_DMG_RANGED_MAX] = statb->starting[STAT_DMG_MENT_MAX] = ec_damage->b;
			}

			// this is used to store cooldown ticks for a map power
			// the power id, type, etc are not used
			statb->powers_ai.resize(1);

			// make this StatBlock immune to negative status effects
			// this is mostly to prevent a player with a damage return bonus from damaging this StatBlock
			statb->effects.addEffect(immunity_effect, 0, 0, false, -1, 0, SOURCE_TYPE_ENEMY);
		}
	}

	// ensure that our map contains a collison layer
	if (std::find(layernames.begin(), layernames.end(), "collision") == layernames.end()) {
		layernames.push_back("collision");
		layers.resize(layers.size()+1);
		layers.back().resize(w);
		for (size_t i=0; i<layers.back().size(); ++i) {
			layers.back()[i].resize(h, 0);
		}
		collision_layer = static_cast<int>(layers.size())-1;
	}

	return 0;
}
OperationsDispatcher::~OperationsDispatcher()
{
    clearQueues();
}
Exemple #11
0
int Map::load(const std::string& fname) {
	FileParser infile;

	clearEvents();
	clearLayers();
	clearQueues();

	music_filename = "";

	collision_layer = -1;
	w = 1;
	h = 1;
	hero_pos_enabled = false;
	hero_pos.x = 0;
	hero_pos.y = 0;

	// @CLASS Map|Description of maps/
	if (!infile.open(fname))
		return 0;

	logInfo("Map: Loading map '%s'", fname.c_str());

	this->filename = fname;

	while (infile.next()) {
		if (infile.new_section) {

			// for sections that are stored in collections, add a new object here
			if (infile.section == "enemy")
				enemy_groups.push(Map_Group());
			else if (infile.section == "npc")
				npcs.push(Map_NPC());
			else if (infile.section == "event")
				events.push_back(Event());

		}
		if (infile.section == "header")
			loadHeader(infile);
		else if (infile.section == "layer")
			loadLayer(infile);
		else if (infile.section == "enemy")
			loadEnemyGroup(infile, &enemy_groups.back());
		else if (infile.section == "npc")
			loadNPC(infile);
		else if (infile.section == "event")
			EventManager::loadEvent(infile, &events.back());
	}

	infile.close();

	// create StatBlocks for events that need powers
	for (unsigned i=0; i<events.size(); ++i) {
		Event_Component *ec_power = events[i].getComponent(EC_POWER);
		if (ec_power) {
			// store the index of this StatBlock so that we can find it when the event is activated
			ec_power->y = addEventStatBlock(events[i]);
		}
	}

	// ensure that our map contains a collision layer
	if (std::find(layernames.begin(), layernames.end(), "collision") == layernames.end()) {
		layernames.push_back("collision");
		layers.resize(layers.size()+1);
		layers.back().resize(w);
		for (size_t i=0; i<layers.back().size(); ++i) {
			layers.back()[i].resize(h, 0);
		}
		collision_layer = static_cast<int>(layers.size())-1;
	}

	if (!hero_pos_enabled) {
		logError("Map: Hero spawn position (hero_pos) not defined in map header. Defaulting to (0,0).");
	}

	return 0;
}
Exemple #12
0
void CamClient::newStream()
{
	// remove the old streams
	
    if (m_avmuxPortHighRate != -1)
        clientRemoveService(m_avmuxPortHighRate);
    m_avmuxPortHighRate = -1;

    if (m_avmuxPortLowRate != -1)
        clientRemoveService(m_avmuxPortLowRate);
    m_avmuxPortLowRate = -1;

    // and start the new streams

    QSettings *settings = SyntroUtils::getSettings();

    settings->beginGroup(CAMCLIENT_STREAM_GROUP);

    m_highRateMinInterval = settings->value(CAMCLIENT_HIGHRATEVIDEO_MININTERVAL).toInt();
    m_highRateMaxInterval = settings->value(CAMCLIENT_HIGHRATEVIDEO_MAXINTERVAL).toInt();
    m_highRateNullInterval = settings->value(CAMCLIENT_HIGHRATEVIDEO_NULLINTERVAL).toInt();

    m_lowRateMinInterval = settings->value(CAMCLIENT_LOWRATEVIDEO_MININTERVAL).toInt();
    m_lowRateMaxInterval = settings->value(CAMCLIENT_LOWRATEVIDEO_MAXINTERVAL).toInt();
    m_lowRateNullInterval = settings->value(CAMCLIENT_LOWRATEVIDEO_NULLINTERVAL).toInt();

    m_generateLowRate = settings->value(CAMCLIENT_GENERATE_LOWRATE).toBool();
    m_lowRateHalfRes = settings->value(CAMCLIENT_LOWRATE_HALFRES).toBool();
 
    m_avmuxPortHighRate = clientAddService(SYNTRO_STREAMNAME_AVMUX, SERVICETYPE_MULTICAST, true);
    if (m_generateLowRate)
        m_avmuxPortLowRate = clientAddService(SYNTRO_STREAMNAME_AVMUXLR, SERVICETYPE_MULTICAST, true);

    settings->endGroup();

    m_gotAudioFormat = false;
    m_gotVideoFormat = false;

    settings->beginGroup(CAMCLIENT_MOTION_GROUP);

    m_tilesToSkip = settings->value(CAMCLIENT_MOTION_TILESTOSKIP).toInt();
    m_intervalsToSkip = settings->value(CAMCLIENT_MOTION_INTERVALSTOSKIP).toInt();
    m_minDelta = settings->value(CAMCLIENT_MOTION_MIN_DELTA).toInt();
    m_minNoise = settings->value(CAMCLIENT_MOTION_MIN_NOISE).toInt();
    m_deltaInterval = settings->value(CAMCLIENT_MOTION_DELTA_INTERVAL).toInt();
    m_preroll = settings->value(CAMCLIENT_MOTION_PREROLL).toInt();
    m_postroll = settings->value(CAMCLIENT_MOTION_POSTROLL).toInt();

    settings->endGroup();

    delete settings;

    m_cd.setDeltaThreshold(m_minDelta);
    m_cd.setNoiseThreshold(m_minNoise);
    m_cd.setTilesToSkip(m_tilesToSkip);
    m_cd.setIntervalsToSkip(m_intervalsToSkip);

    qint64 now = QDateTime::currentMSecsSinceEpoch();

    m_lastFrameTime = now;
    m_lastLowRateFrameTime = now;
    m_lastFullFrameTime = now;
    m_lastLowRateFullFrameTime = now;
    m_lastPrerollFrameTime = now;
    m_lastLowRatePrerollFrameTime = now;
    m_lastChangeTime = now;
    m_imageChanged = false;

    m_cd.setUninitialized();

    clearQueues();

    m_avParams.avmuxSubtype = SYNTRO_RECORD_TYPE_AVMUX_MJPPCM;
    m_avParams.videoSubtype = SYNTRO_RECORD_TYPE_VIDEO_MJPEG;
    m_avParams.audioSubtype = SYNTRO_RECORD_TYPE_AUDIO_PCM;
}
Exemple #13
0
void CamClient::appClientConnected()
{
    clearQueues();
}
Exemple #14
0
void CamClient::appClientExit()
{
    clearQueues();
}
Exemple #15
0
//------------------------------------------------------------------------------
// reset() -- Reset parameters
//------------------------------------------------------------------------------
void Antenna::reset()
{
    BaseClass::reset();
    clearQueues();
}