MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / drawCountryLines

Method drawCountryLines

src/Geoscape/GraphsState.cpp:626–799  ·  view source on GitHub ↗

* Sets up the screens and draws the lines for country buttons * to toggle on and off */

Source from the content-addressed store, hash-verified

624 * to toggle on and off
625 */
626void GraphsState::drawCountryLines()
627{
628 //calculate the totals, and set up our upward maximum
629 int upperLimit = 0;
630 int lowerLimit = 0;
631 int totals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
632 for (size_t entry = 0; entry != _game->getSavedGame()->getFundsList().size(); ++entry)
633 {
634 int total = 0;
635 if (_alien)
636 {
637 for (size_t iter = 0; iter != _game->getSavedGame()->getCountries()->size(); ++iter)
638 {
639 total += _game->getSavedGame()->getCountries()->at(iter)->getActivityAlien().at(entry);
640 if (_game->getSavedGame()->getCountries()->at(iter)->getActivityAlien().at(entry) > upperLimit && _countryToggles.at(iter)->_pushed)
641 {
642 upperLimit = _game->getSavedGame()->getCountries()->at(iter)->getActivityAlien().at(entry);
643 }
644 }
645 }
646 else if (_income)
647 {
648 for (size_t iter = 0; iter != _game->getSavedGame()->getCountries()->size(); ++iter)
649 {
650 total += _game->getSavedGame()->getCountries()->at(iter)->getFunding().at(entry) / 1000;
651 if (_game->getSavedGame()->getCountries()->at(iter)->getFunding().at(entry) / 1000 > upperLimit && _countryToggles.at(iter)->_pushed)
652 {
653 upperLimit = _game->getSavedGame()->getCountries()->at(iter)->getFunding().at(entry) / 1000;
654 }
655 }
656 }
657 else
658 {
659 for (size_t iter = 0; iter != _game->getSavedGame()->getCountries()->size(); ++iter)
660 {
661 total += _game->getSavedGame()->getCountries()->at(iter)->getActivityXcom().at(entry);
662 if (_game->getSavedGame()->getCountries()->at(iter)->getActivityXcom().at(entry) > upperLimit && _countryToggles.at(iter)->_pushed)
663 {
664 upperLimit = _game->getSavedGame()->getCountries()->at(iter)->getActivityXcom().at(entry);
665 }
666 if (_game->getSavedGame()->getCountries()->at(iter)->getActivityXcom().at(entry) < lowerLimit && _countryToggles.at(iter)->_pushed)
667 {
668 lowerLimit = _game->getSavedGame()->getCountries()->at(iter)->getActivityXcom().at(entry);
669 }
670
671 }
672 }
673 if (_countryToggles.back()->_pushed && total > upperLimit)
674 upperLimit = total;
675 }
676
677 //adjust the scale to fit the upward maximum
678 double range = upperLimit - lowerLimit;
679 double low = lowerLimit;
680 int grids = 9; // cells in grid
681 int check = _income ? 50 : 10;
682 while (range > check * grids)
683 {

Callers

nothing calls this directly

Calls 5

getSavedGameMethod · 0.80
getCountriesMethod · 0.80
drawLineMethod · 0.80
clearMethod · 0.45
setVisibleMethod · 0.45

Tested by

no test coverage detected