* Sets up the screens and draws the lines for the finance buttons * to toggle on and off */
| 953 | * to toggle on and off |
| 954 | */ |
| 955 | void GraphsState::drawFinanceLines() |
| 956 | { |
| 957 | //set up arrays |
| 958 | int upperLimit = 0; |
| 959 | int lowerLimit = 0; |
| 960 | int incomeTotals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 961 | int balanceTotals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 962 | int expendTotals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 963 | int maintTotals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 964 | int scoreTotals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 965 | maintTotals[0] = _game->getSavedGame()->getBaseMaintenance() / 1000; |
| 966 | |
| 967 | // start filling those arrays with score values |
| 968 | // determine which is the highest one being displayed, so we can adjust the scale |
| 969 | for (size_t entry = 0; entry != _game->getSavedGame()->getFundsList().size(); ++entry) |
| 970 | { |
| 971 | size_t invertedEntry = _game->getSavedGame()->getFundsList().size() - (1 + entry); |
| 972 | maintTotals[entry] += _game->getSavedGame()->getMaintenances().at(invertedEntry) / 1000; |
| 973 | balanceTotals[entry] = _game->getSavedGame()->getFundsList().at(invertedEntry) / 1000; |
| 974 | scoreTotals[entry] = _game->getSavedGame()->getResearchScores().at(invertedEntry); |
| 975 | |
| 976 | for (std::vector<Region*>::iterator iter = _game->getSavedGame()->getRegions()->begin(); iter != _game->getSavedGame()->getRegions()->end(); ++iter) |
| 977 | { |
| 978 | scoreTotals[entry] += (*iter)->getActivityXcom().at(invertedEntry) - (*iter)->getActivityAlien().at(invertedEntry); |
| 979 | } |
| 980 | |
| 981 | if (_financeToggles.at(2)) |
| 982 | { |
| 983 | if (maintTotals[entry] > upperLimit) |
| 984 | { |
| 985 | upperLimit = maintTotals[entry]; |
| 986 | } |
| 987 | if (maintTotals[entry] < lowerLimit) |
| 988 | { |
| 989 | lowerLimit = maintTotals[entry]; |
| 990 | } |
| 991 | } |
| 992 | if (_financeToggles.at(3)) |
| 993 | { |
| 994 | if (balanceTotals[entry] > upperLimit) |
| 995 | { |
| 996 | upperLimit = balanceTotals[entry]; |
| 997 | } |
| 998 | if (balanceTotals[entry] < lowerLimit) |
| 999 | { |
| 1000 | lowerLimit = balanceTotals[entry]; |
| 1001 | } |
| 1002 | } |
| 1003 | if (_financeToggles.at(4)) |
| 1004 | { |
| 1005 | if (scoreTotals[entry] > upperLimit) |
| 1006 | { |
| 1007 | upperLimit = scoreTotals[entry]; |
| 1008 | } |
| 1009 | if (scoreTotals[entry] < lowerLimit) |
| 1010 | { |
| 1011 | lowerLimit = scoreTotals[entry]; |
| 1012 | } |
nothing calls this directly
no test coverage detected