MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / getGoalsStringForPlayer

Method getGoalsStringForPlayer

source/gamemap/GameMap.cpp:2508–2557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2506}
2507
2508std::string GameMap::getGoalsStringForPlayer(Player* player)
2509{
2510 bool playerIsAWinner = seatIsAWinner(player->getSeat());
2511 std::stringstream tempSS("");
2512 Seat* seat = player->getSeat();
2513 seat->resetGoalsChanged();
2514
2515 const std::string formatTitleOn = "[font='MedievalSharp-12'][colour='CCBBBBFF']";
2516 const std::string formatTitleOff = "[font='MedievalSharp-10'][colour='FFFFFFFF']";
2517
2518 if (playerIsAWinner)
2519 {
2520 tempSS << "Congratulations, you have completed this level.";
2521 }
2522 else if (seat->numFailedGoals() > 0)
2523 {
2524 // Loop over the list of completed goals for the seat we are sitting in an print them.
2525 tempSS << formatTitleOn << "Failed Goals:\n" << formatTitleOff
2526 << "(You cannot complete this level!)\n\n";
2527 for (unsigned int i = 0; i < seat->numFailedGoals(); ++i)
2528 {
2529 Goal *tempGoal = seat->getFailedGoal(i);
2530 tempSS << tempGoal->getFailedMessage(*seat) << "\n";
2531 }
2532 }
2533
2534 if (seat->numUncompleteGoals() > 0)
2535 {
2536 // Loop over the list of unmet goals for the seat we are sitting in an print them.
2537 tempSS << formatTitleOn << "Unfinished Goals:" << formatTitleOff << "\n\n";
2538 for (unsigned int i = 0; i < seat->numUncompleteGoals(); ++i)
2539 {
2540 Goal *tempGoal = seat->getUncompleteGoal(i);
2541 tempSS << tempGoal->getDescription(*seat) << "\n";
2542 }
2543 }
2544
2545 if (seat->numCompletedGoals() > 0)
2546 {
2547 // Loop over the list of completed goals for the seat we are sitting in an print them.
2548 tempSS << "\n" << formatTitleOn << "Completed Goals:" << formatTitleOff << "\n\n";
2549 for (unsigned int i = 0; i < seat->numCompletedGoals(); ++i)
2550 {
2551 Goal *tempGoal = seat->getCompletedGoal(i);
2552 tempSS << tempGoal->getSuccessMessage(*seat) << "\n";
2553 }
2554 }
2555
2556 return tempSS.str();
2557}
2558
2559int GameMap::addGoldToSeat(int gold, int seatId)
2560{

Callers 1

startNewTurnMethod · 0.80

Calls 11

resetGoalsChangedMethod · 0.80
numFailedGoalsMethod · 0.80
getFailedGoalMethod · 0.80
numUncompleteGoalsMethod · 0.80
getUncompleteGoalMethod · 0.80
numCompletedGoalsMethod · 0.80
getCompletedGoalMethod · 0.80
getSeatMethod · 0.45
getFailedMessageMethod · 0.45
getDescriptionMethod · 0.45
getSuccessMessageMethod · 0.45

Tested by

no test coverage detected