Exemplo n.º 1
0
void D2StatData::ungroup(Array<D2ItemStat>& list)
{
  Array<D2ItemStat> dest;
  for (int i = 0; i < list.length(); i++)
  {
    if (list[i].stat->id >= GROUP_BASE)
    {
      for (int j = 0; j < 512; j++)
      {
        if (stats[j].group != list[i].stat->id - GROUP_BASE)
          continue;
        D2ItemStat stat;
        stat.stat = &stats[j];
        if (stats[j].groupindex == 0)
          stat.value1 = list[i].param;
        else if (stats[j].groupindex == 1)
          stat.value1 = list[i].value1;
        else if (stats[j].groupindex == 2)
          stat.value1 = list[i].value2;
        addStat(dest, stat);
      }
    }
    else
      addStat(dest, list[i]);
  }
  list = dest;
}
Exemplo n.º 2
0
void D2StatData::group(Array<D2ItemStat>& list)
{
  Array<D2ItemStat> dest;
  int groups[32]; int ngroups = 0;
  for (int i = 0; i < list.length(); i++)
  {
    if (list[i].stat->group >= 0)
    {
      int j;
      for (j = 0; j < ngroups; j++)
        if (groups[j] == list[i].stat->group)
          break;
      if (j == ngroups)
        groups[ngroups++] = list[i].stat->group;
    }
    else
      addStat(dest, list[i]);
  }
  for (int i = 0; i < ngroups; i++)
  {
    D2ItemStat stat;
    stat.stat = &stats[groups[i] + GROUP_BASE];
    bool first = true;
    for (int j = 0; j < list.length(); j++)
    {
      if (list[j].stat->group != groups[i])
        continue;
      if (list[j].stat->groupindex == 0)
        stat.param = list[j].value1;
      else if (list[j].stat->groupindex == 1)
      {
        if (first)
        {
          stat.value1 = list[j].value1;
          first = false;
        }
        else if (list[j].value1 < stat.value1)
          stat.value1 = list[j].value1;
      }
      else if (list[j].stat->groupindex == 2)
        stat.value2 = list[j].value1;
    }
    addStat(dest, stat);
    for (int j = 0; j < list.length(); j++)
    {
      if (list[j].stat->group != groups[i])
        continue;
      if (list[j].stat->groupindex == 0)
        list[j].value1 -= stat.param;
      else if (list[j].stat->groupindex == 1)
        list[j].value1 -= stat.value1;
      else if (list[j].stat->groupindex == 2)
        list[j].value1 -= stat.value2;
      if (list[j].value1)
        addStat(dest, list[j]);
    }
  }
  list = dest;
}
Exemplo n.º 3
0
struct oneStat *totalSplice(struct blatStats *stats)
/* Return sum of 5' and 3' splice sites. */
{
static struct oneStat acc;
ZeroVar(&acc);
addStat(&stats->splice5, &acc);
addStat(&stats->splice3, &acc);
return &acc;
}
Exemplo n.º 4
0
struct oneStat *totalUtr(struct blatStats *stats)
/* Return sum of 5' and 3' UTRs. */
{
static struct oneStat acc;
ZeroVar(&acc);
addStat(&stats->utr5, &acc);
addStat(&stats->utr3, &acc);
return &acc;
}
Exemplo n.º 5
0
struct oneStat *totalIntron(struct blatStats *stats)
/* Return sum of all intron regions. */
{
static struct oneStat acc;
ZeroVar(&acc);
addStat(&stats->firstIntron, &acc);
addStat(&stats->middleIntron, &acc);
addStat(&stats->endIntron, &acc);
addStat(&stats->onlyIntron, &acc);
return &acc;
}
Exemplo n.º 6
0
struct oneStat *totalCds(struct blatStats *stats)
/* Return sum of all CDS regions. */
{
static struct oneStat acc;
ZeroVar(&acc);
addStat(&stats->firstCds, &acc);
addStat(&stats->middleCds, &acc);
addStat(&stats->endCds, &acc);
addStat(&stats->onlyCds, &acc);
return &acc;
}
void Statsdb::addDocsIndexed ( ) {

	if ( ! isClockInSync() ) return;

	// only once per five seconds
	long now = getTimeLocal();
	static long s_lastTime = 0;
	if ( now - s_lastTime < 5 ) return;
	s_lastTime = now;

	long long total = 0LL;
	static long long s_lastTotal = 0LL;
	// every 5 seconds update docs indexed count
	for ( long i = 0 ; i < g_hostdb.m_numHosts ; i++ ) {
		Host *h = &g_hostdb.m_hosts[i];
		// must have something
		if ( h->m_docsIndexed <= 0 ) return;
		// add it up
		total += h->m_docsIndexed;
	}
	// divide by # of groups
	total /= g_hostdb.getNumGroups();
	// skip if no change
	if ( total == s_lastTotal ) return;

	s_lastTotal = total;

	// add it if changed though
	long long nowms = gettimeofdayInMillisecondsGlobal();
	addStat ( MAX_NICENESS,"docs_indexed", nowms, nowms, (float)total );
}
Exemplo n.º 8
0
void Statsdb::addDocsIndexed ( ) {

	if ( ! isClockInSync() ) return;
	if ( g_hostdb.hasDeadHost() ) return;


	// only host #0 needs this
	if ( g_hostdb.m_hostId != 0 ) return;

	// only once per five seconds
	int32_t now = getTimeLocal();
	static int32_t s_lastTime = 0;
	if ( now - s_lastTime < 5 ) return;
	int32_t interval = now - s_lastTime;
	s_lastTime = now;

	int64_t total = 0LL;
	static int64_t s_lastTotal = 0LL;
	// every 5 seconds update docs indexed count
	for ( int32_t i = 0 ; i < g_hostdb.m_numHosts ; i++ ) {
		Host *h = &g_hostdb.m_hosts[i];
		// must have something
		if ( h->m_pingInfo.m_totalDocsIndexed <= 0 ) continue;
		// add it up
		total += h->m_pingInfo.m_totalDocsIndexed;
	}
	// divide by # of groups
	total /= g_hostdb.getNumHostsPerShard();
	// skip if no change

	if ( total == s_lastTotal ) return;

    int32_t docsIndexedInInterval = total - s_lastTotal;
    float docsPerSecond = docsIndexedInInterval / (float)interval;

	log("build: total docs indexed: %f. docs per second %f %i %i", (float)total, docsPerSecond, docsIndexedInInterval, interval);

	// add it if changed though
	int64_t nowms = gettimeofdayInMillisecondsGlobal();
	addStat ( MAX_NICENESS,"docs_indexed", nowms, nowms, (float)total );
    // Prevent a datapoint which adds all of the docs indexed to date.
    if( s_lastTotal != 0 ) {
        addStat ( MAX_NICENESS,"docs_per_second", nowms, nowms, docsPerSecond );
    }

	s_lastTotal = total;
}
Exemplo n.º 9
0
void LLFrameStatView::setup(const LLFrameStats &frame_stats)
{
	S32 i;
	for (i = 0; i < LLFrameStats::NUM_STATS; i++)
	{
		addStat(&gFrameStats.getStat(i),
				gFrameStats.getStatLabel(i),
				gFrameStats.getStatColor(i));
	}
}
Exemplo n.º 10
0
// Result format:  (variable)
// team index | rank | score * 100 | num stats | stats
void ReplayBuilder::addResult(Team *team) {
  resultsData_->addInt(team->index);

  TeamResult *teamResult = &(team->result);
  resultsData_->addInt(teamResult->rank);
  resultsData_->addInt(round(teamResult->score * 100));

  int numStats = teamResult->numStats;
  ScoreStat **stats = teamResult->stats;
  resultsData_->addInt(numStats);
  for (int x = 0; x < numStats; x++) {
    addStat(stats[x]);
  }
}
Exemplo n.º 11
0
void D2StatData::addPreset(Array<D2ItemStat>& list, char const* propname, int par, int val1, int val2)
{
  if (!props.has(propname))
    return;
  if (!strcmp(propname, "dmg-pois"))
  {
    val1 = (val1 * par + 128) / 256;
    val2 = (val2 * par + 128) / 256;
  }
  ItemProp& prop = props.get(propname);
  for (int i = 0; i < prop.length(); i++)
  {
    D2ItemStat stat;
    stat.stat = prop[i].second.first;
    if (prop[i].first == 21) stat.param = prop[i].second.second;
    stat.value1 = stat.value2 = 0;
    switch (prop[i].first)
    {
    case 12:
    case 36:
      break;
    case 15:
      stat.value1 = val1;
      break;
    case 16:
      stat.value1 = val2;
      break;
    case 17:
      stat.value1 = par;
      break;
    case 11:
    case 19:
      stat.value1 = val1;
      stat.value2 = val2;
      stat.param = par;
      break;
    case 10:
    case 22:
      stat.param = par;
      // fall through
    default:
      if (val1 == val2)
        stat.value1 = val1;
    }
    if (stat.value1 || stat.value2)
      addStat(list, stat);
  }
}
Exemplo n.º 12
0
	ArticleStateArmor::ArticleStateArmor(ArticleDefinitionArmor *defs) : ArticleState(defs->id), _row(0)
	{
		Armor *armor = _game->getMod()->getArmor(defs->id);

		// add screen elements
		_txtTitle = new Text(300, 17, 5, 24);

		// Set palette
		setPalette("PAL_BATTLEPEDIA");

		ArticleState::initLayout();

		// add other elements
		add(_txtTitle);

		// Set up objects
		_btnOk->setColor(Palette::blockOffset(0)+15);
		_btnPrev->setColor(Palette::blockOffset(0)+15);
		_btnNext->setColor(Palette::blockOffset(0)+15);

		_txtTitle->setColor(Palette::blockOffset(14)+15);
		_txtTitle->setBig();
		_txtTitle->setText(tr(defs->title));

		_image = new Surface(320, 200, 0, 0);
		add(_image);

		std::string look = armor->getSpriteInventory();
		look += "M0.SPK";
		if (!CrossPlatform::fileExists(FileMap::getFilePath("UFOGRAPH/" + look)) && !_game->getMod()->getSurface(look))
		{
			look = armor->getSpriteInventory() + ".SPK";
		}
		_game->getMod()->getSurface(look)->blit(_image);


		_lstInfo = new TextList(150, 96, 150, 46);
		add(_lstInfo);

		_lstInfo->setColor(Palette::blockOffset(14)+15);
		_lstInfo->setColumns(2, 125, 25);
		_lstInfo->setDot(true);

		_txtInfo = new Text(300, 56, 8, 150);
		add(_txtInfo);

		_txtInfo->setColor(Palette::blockOffset(14)+15);
		_txtInfo->setWordWrap(true);
		_txtInfo->setText(tr(defs->text));

		// Add armor values
		addStat("STR_FRONT_ARMOR", armor->getFrontArmor());
		addStat("STR_LEFT_ARMOR", armor->getSideArmor());
		addStat("STR_RIGHT_ARMOR", armor->getSideArmor());
		addStat("STR_REAR_ARMOR", armor->getRearArmor());
		addStat("STR_UNDER_ARMOR", armor->getUnderArmor());

		_lstInfo->addRow(0);
		++_row;

		// Add damage modifiers
		for (int i = 0; i < Armor::DAMAGE_TYPES; ++i)
		{
			ItemDamageType dt = (ItemDamageType)i;
			int percentage = (int)Round(armor->getDamageModifier(dt) * 100.0f);
			std::string damage = getDamageTypeText(dt);
			if (percentage != 100 && damage != "STR_UNKNOWN")
			{
				addStat(damage, Text::formatPercentage(percentage));
			}
		}

		_lstInfo->addRow(0);
		++_row;

		// Add unit stats
		addStat("STR_TIME_UNITS", armor->getStats()->tu, true);
		addStat("STR_STAMINA", armor->getStats()->stamina, true);
		addStat("STR_HEALTH", armor->getStats()->health, true);
		addStat("STR_BRAVERY", armor->getStats()->bravery, true);
		addStat("STR_REACTIONS", armor->getStats()->reactions, true);
		addStat("STR_FIRING_ACCURACY", armor->getStats()->firing, true);
		addStat("STR_THROWING_ACCURACY", armor->getStats()->throwing, true);
		addStat("STR_MELEE_ACCURACY", armor->getStats()->melee, true);
		addStat("STR_STRENGTH", armor->getStats()->strength, true);
		addStat("STR_PSIONIC_STRENGTH", armor->getStats()->psiStrength, true);
		addStat("STR_PSIONIC_SKILL", armor->getStats()->psiSkill, true);

		centerAllSurfaces();
	}
Exemplo n.º 13
0
//called from the frame queue controller to get frame data for display
VideoData* YUVReader::pullFrame(int frameNumber)
{
  if (DEBUG)
    printf("Getting frame number %d\n", frameNumber);

  //deal with frame number wrapping
  if (frameNumber < 0)
  {
    frameNumber *= -1;
    frameNumber %= (lastFrameNum + 1);
    frameNumber = lastFrameNum - frameNumber;
  }

  if (frameNumber > lastFrameNum)
    frameNumber %= (lastFrameNum + 1);

  /* allocate new storage:
   *  1) work out dimensions for the planes
   *  2) create contiguous storage (we already know the frame_size)
   *  3) create aliases for any other planes
   */
  VideoData* frame = new VideoData();
  frame->data.packing_format = packing_format;
  frame->data.chroma_format = chroma_format;
  setPlaneDimensions(*(PictureData<void>*) &frame->data, packing_format,
      chroma_format, videoWidth, videoHeight);

  frame->data.plane[0].data = std::shared_ptr<DataPtr>(
      new DataPtr_valloc(frame_size));
  void* const data = frame->data.plane[0].data->ptr;
  uint8_t* ptr = (uint8_t*) data;
  for (unsigned i = 1; i < frame->data.plane.size(); i++)
  {
    ptr += frame->data.plane[i - 1].length;
    frame->data.plane[i].data = std::shared_ptr<DataPtr>(new DataPtr_alias(ptr));
  }
  /* xxx: fixup plane numbering if required (eg YV12 vs I420) */

  //set frame number and first/last flags
  frame->frame_number = frameNumber;
  frame->is_first_frame = (frameNumber == firstFrameNum);
  frame->is_last_frame = (frameNumber == lastFrameNum);
  frame->is_interlaced = interlacedSource;

  frame->sample_aspect_ratio_numerator = sample_aspect_ratio_numerator;
  frame->sample_aspect_ratio_denominator = sample_aspect_ratio_denominator;
  frame->data.sar = (float) sample_aspect_ratio_numerator
      / (float) sample_aspect_ratio_denominator;

  //seek to requested frame
  off64_t offset = (off64_t) frame_size * (off64_t) frameNumber;
  off64_t sret = lseek64(fd, offset, SEEK_SET);
  if (!sret && offset != 0)
    perror("LSEEK");

  QTime timer;
  timer.restart();

  for (unsigned done = 0; done < frame_size;)
  {
    int len = read(fd, (uint8_t*) data + done, frame_size - done);
    if (len <= 0)
    {
      std::stringstream ss;
      ss << "read() @ frame" << frameNumber << "(" << offset << "+" << done
          << " of " << frame_size << ")";
      perror(ss.str().c_str());
      break;
    }
    done += len;
  }

  if (bit_shift > 0)
  {
    shiftPlanar16PixelData(frame->data, bit_shift);
  }

  Stats::Section& stats = Stats::getSection("YUV Reader");
  addStat(stats, "Read", timer.elapsed(), "ms");
  addStat(stats, "VideoWidth", videoWidth);
  addStat(stats, "VideoHeight", videoHeight);
  addStat(stats, "FirstFrame", firstFrameNum);
  addStat(stats, "LastFrame", lastFrameNum);
  addStat(stats, "VideoFormat", fileType.toLatin1().data());

  return frame;
}
Exemplo n.º 14
0
	ArticleStateTFTDArmor::ArticleStateTFTDArmor(ArticleDefinitionTFTD *defs) : ArticleStateTFTD(defs), _row(0)
	{
		Armor *armor = _game->getMod()->getArmor(defs->id, true);

		_lstInfo = new TextList(150, 64, 168, 110);
		add(_lstInfo);

		_lstInfo->setColor(Palette::blockOffset(0)+2);
		_lstInfo->setColumns(2, 125, 25);
		_lstInfo->setDot(true);

		// Add armor values
		addStat("STR_FRONT_ARMOR", armor->getFrontArmor());
		addStat("STR_LEFT_ARMOR", armor->getLeftSideArmor());
		addStat("STR_RIGHT_ARMOR", armor->getRightSideArmor());
		addStat("STR_REAR_ARMOR", armor->getRearArmor());
		addStat("STR_UNDER_ARMOR", armor->getUnderArmor());

		_lstInfo->addRow(0);
		++_row;

		// Add damage modifiers
		for (int i = 0; i < DAMAGE_TYPES; ++i)
		{
			ItemDamageType dt = (ItemDamageType)i;
			int percentage = (int)Round(armor->getDamageModifier(dt) * 100.0f);
			std::string damage = getDamageTypeText(dt);
			if (percentage != 100 && damage != "STR_UNKNOWN")
			{
				addStat(damage, Text::formatPercentage(percentage));
			}
		}

		_lstInfo->addRow(0);
		++_row;

		// Add unit stats
		addStat("STR_TIME_UNITS", armor->getStats()->tu, true);
		addStat("STR_STAMINA", armor->getStats()->stamina, true);
		addStat("STR_HEALTH", armor->getStats()->health, true);
		addStat("STR_BRAVERY", armor->getStats()->bravery, true);
		addStat("STR_REACTIONS", armor->getStats()->reactions, true);
		addStat("STR_FIRING_ACCURACY", armor->getStats()->firing, true);
		addStat("STR_THROWING_ACCURACY", armor->getStats()->throwing, true);
		addStat("STR_MELEE_ACCURACY", armor->getStats()->melee, true);
		addStat("STR_STRENGTH", armor->getStats()->strength, true);
		addStat("STR_PSIONIC_STRENGTH", armor->getStats()->psiStrength, true);
		addStat("STR_PSIONIC_SKILL", armor->getStats()->psiSkill, true);

		centerAllSurfaces();
	}
Exemplo n.º 15
0
/**
 * Prepares debriefing: gathers Aliens, Corpses, Artefacts, UFO Components.
 * Adds the items to the craft.
 * Also calculates the soldiers experience, and possible promotions.
 * If aborted, only the things on the exit area are recovered.
 */
void DebriefingState::prepareDebriefing()
{
	_stats.push_back(new DebriefingStat("STR_ALIENS_KILLED", false));
	_stats.push_back(new DebriefingStat("STR_ALIEN_CORPSES_RECOVERED", false));
	_stats.push_back(new DebriefingStat("STR_LIVE_ALIENS_RECOVERED", false));
	_stats.push_back(new DebriefingStat("STR_ALIEN_ARTIFACTS_RECOVERED", false));
	_stats.push_back(new DebriefingStat("STR_ALIEN_BASE_CONTROL_DESTROYED", false));
	_stats.push_back(new DebriefingStat("STR_CIVILIANS_KILLED_BY_ALIENS", false));
	_stats.push_back(new DebriefingStat("STR_CIVILIANS_KILLED_BY_XCOM_OPERATIVES", false));
	_stats.push_back(new DebriefingStat("STR_CIVILIANS_SAVED", false));
	_stats.push_back(new DebriefingStat("STR_XCOM_OPERATIVES_KILLED", false));
	//_stats.push_back(new DebriefingStat("STR_XCOM_OPERATIVES_RETIRED_THROUGH_INJURY", false));
	_stats.push_back(new DebriefingStat("STR_XCOM_OPERATIVES_MISSING_IN_ACTION", false));
	_stats.push_back(new DebriefingStat("STR_TANKS_DESTROYED", false));
	_stats.push_back(new DebriefingStat("STR_XCOM_CRAFT_LOST", false));
	_stats.push_back(new DebriefingStat("STR_UFO_POWER_SOURCE", true));
	_stats.push_back(new DebriefingStat("STR_UFO_NAVIGATION", true));
	_stats.push_back(new DebriefingStat("STR_UFO_CONSTRUCTION", true));
	_stats.push_back(new DebriefingStat("STR_ALIEN_FOOD", true));
	_stats.push_back(new DebriefingStat("STR_ALIEN_REPRODUCTION", true));
	_stats.push_back(new DebriefingStat("STR_ALIEN_ENTERTAINMENT", true));
	_stats.push_back(new DebriefingStat("STR_ALIEN_SURGERY", true));
	_stats.push_back(new DebriefingStat("STR_EXAMINATION_ROOM", true));
	_stats.push_back(new DebriefingStat("STR_ALIEN_ALLOYS", true));
	_stats.push_back(new DebriefingStat("STR_ELERIUM_115", true));

	SavedGame *save = _game->getSavedGame();
	SavedBattleGame *battle = save->getBattleGame();
	bool aborted = battle->isAborted();
	Craft* craft = 0;
	std::vector<Craft*>::iterator craftIterator;
	Base* base = 0;

	int playerInExitArea = 0; // if this stays 0 the craft is lost...
	int playersSurvived = 0; // if this stays 0 the craft is lost...

	for (std::vector<Base*>::iterator i = save->getBases()->begin(); i != save->getBases()->end(); ++i)
	{

		// in case we have a craft - check which craft it is about
		for (std::vector<Craft*>::iterator j = (*i)->getCrafts()->begin(); j != (*i)->getCrafts()->end(); ++j)
		{
			if ((*j)->isInBattlescape())
			{
				craft = (*j);
				base = (*i);
				craftIterator = j;
				craft->returnToBase();
				craft->setLowFuel(true);
				craft->setInBattlescape(false);
			}
		}
	}

	// UFO crash/landing site disappears
	for (std::vector<Ufo*>::iterator i = save->getUfos()->begin(); i != save->getUfos()->end(); ++i)
	{
		if ((*i)->isInBattlescape())
		{
			delete *i;
			save->getUfos()->erase(i);
			break;
		}
	}

	// lets see what happens with units
	for (std::vector<BattleUnit*>::iterator j = battle->getUnits()->begin(); j != battle->getUnits()->end(); ++j)
	{
		UnitStatus status = (*j)->getStatus();
		UnitFaction faction = (*j)->getFaction();
		int value = (*j)->getValue();
		Soldier *soldier = save->getSoldier((*j)->getId());

		if (status == STATUS_DEAD)
		{
			if (faction == FACTION_HOSTILE)
			{
				addStat("STR_ALIENS_KILLED", 1, value);
			}
			if (faction == FACTION_PLAYER)
			{
				if (soldier != 0)
				{
					addStat("STR_XCOM_OPERATIVES_KILLED", 1, -value);
					for (std::vector<Soldier*>::iterator i = base->getSoldiers()->begin(); i != base->getSoldiers()->end(); ++i)
					{
						if ((*i) == soldier)
						{
							delete (*i);
							base->getSoldiers()->erase(i);
							break;
						}
					}
				}
				else
				{
					// non soldier player = tank
					addStat("STR_TANKS_DESTROYED", 1, -value);
				}
			}
		}
		else if (status == STATUS_UNCONSCIOUS)
		{
			if (faction == FACTION_HOSTILE && (!aborted || (*j)->isInExitArea()))
			{
				addStat("STR_LIVE_ALIENS_RECOVERED", 1, value);
			}
		}
		else if (faction == FACTION_PLAYER)
		{
			playersSurvived++;
			if ((*j)->isInExitArea() || !aborted)
			{
				playerInExitArea++;
				(*j)->postMissionProcedures(save);
			}
			else
			{
				addStat("STR_XCOM_OPERATIVES_MISSING_IN_ACTION", 1, -value);
				for (std::vector<Soldier*>::iterator i = base->getSoldiers()->begin(); i != base->getSoldiers()->end(); ++i)
				{
					if ((*i) == soldier)
					{
						delete (*i);
						base->getSoldiers()->erase(i);
						break;
					}
				}
			}
		}
	}
	if (((playerInExitArea == 0 && aborted) || (playersSurvived == 0)) && craft != 0)
	{
		addStat("STR_XCOM_CRAFT_LOST", 1, -200);
		delete craft;
		base->getCrafts()->erase(craftIterator);
		for (std::vector<Soldier*>::iterator i = base->getSoldiers()->begin(); i != base->getSoldiers()->end();)
		{
			if ((*i)->getCraft() == craft)
			{
				delete (*i);
				i = base->getSoldiers()->erase(i);
			}
			else
			{
				 ++i;
			}
		}
		_txtTitle->setText(_game->getLanguage()->getString("STR_CRAFT_IS_LOST"));
		return;
	}

	if (!aborted && playersSurvived > 0) 	// RECOVER UFO : run through all tiles to recover UFO components and items
	{
		if (battle->getMissionType() == "STR_BASE_DEFENCE")
		{
			_txtTitle->setText(_game->getLanguage()->getString("STR_BASE_IS_SAVED"));
		}
		else
		{
			_txtTitle->setText(_game->getLanguage()->getString("STR_UFO_IS_RECOVERED"));
		}

		for (int i = 0; i < battle->getHeight() * battle->getLength() * battle->getWidth(); ++i)
		{
			for (int part = 0; part < 4; part++)
			{
				if (battle->getTiles()[i]->getMapData(part))
				{
					switch (battle->getTiles()[i]->getMapData(part)->getSpecialType())
					{
					case UFO_POWER_SOURCE:
						addStat("STR_UFO_POWER_SOURCE", 1, 1); break;
					case DESTROY_OBJECTIVE:break; // this is the brain
					case UFO_NAVIGATION:
						addStat("STR_UFO_NAVIGATION", 1, 1); break;
					case ALIEN_FOOD:
						addStat("STR_ALIEN_FOOD", 1, 1); break;
					case ALIEN_REPRODUCTION:
						addStat("STR_ALIEN_REPRODUCTION", 1, 1); break;
					case ALIEN_ENTERTAINMENT:
						addStat("STR_ALIEN_ENTERTAINMENT", 1, 1); break;
					case ALIEN_SURGERY:
						addStat("STR_ALIEN_SURGERY", 1, 1); break;
					case UNKNOWN09:
						addStat("STR_UFO_CONSTRUCTION", 1, 1); break;
					case ALIEN_ALLOYS:
						addStat("STR_ALIEN_ALLOYS", 1, 1); break;
					case EXAM_ROOM:
						addStat("STR_EXAMINATION_ROOM", 1, 1); break;
					}

				}
			}
		}

		// alien alloys recovery values are divided by 10 or divided by 150 in case of an alien base
		int divider = battle->getMissionType()=="STR_ALIEN_BASE_ASSAULT"?150:10;
		for (std::vector<DebriefingStat*>::iterator i = _stats.begin(); i != _stats.end(); ++i)
		{
			if ((*i)->item == "STR_ALIEN_ALLOYS")
			{
				(*i)->qty = (*i)->qty / divider;
				(*i)->score = (*i)->score / divider;
				break;
			}

			/*if ((*i)->recovery && (*i)->qty > 0)
			{
				base->getItems()->addItem((*i)->item, (*i)->qty);
			}*/
		}
	}
	else
	{
		if (battle->getMissionType() == "STR_BASE_DEFENCE")
		{
			_txtTitle->setText(_game->getLanguage()->getString("STR_BASE_IS_LOST"));
		}
		else
		{
			_txtTitle->setText(_game->getLanguage()->getString("STR_UFO_IS_NOT_RECOVERED"));
		}
	}

}
Exemplo n.º 16
0
void addStats(struct blatStats *a, struct blatStats *acc)
/* Add stats in a to acc. */
{
addStat(&a->upstream100, &acc->upstream100);
addStat(&a->upstream200, &acc->upstream200);
addStat(&a->upstream400, &acc->upstream400);
addStat(&a->upstream800, &acc->upstream800);
addStat(&a->mrnaTotal, &acc->mrnaTotal);
addStat(&a->utr5, &acc->utr5);
addStat(&a->firstCds, &acc->firstCds);
addStat(&a->firstIntron, &acc->firstIntron);
addStat(&a->middleCds, &acc->middleCds);
addStat(&a->onlyCds, &acc->onlyCds);
addStat(&a->middleIntron, &acc->middleIntron);
addStat(&a->onlyIntron, &acc->onlyIntron);
addStat(&a->endCds, &acc->endCds);
addStat(&a->endIntron, &acc->endIntron);
addStat(&a->utr3, &acc->utr3);
addStat(&a->splice5, &acc->splice5);
addStat(&a->splice3, &acc->splice3);
addStat(&a->downstream200, &acc->downstream200);
}