void playsingle_controller::report_victory(
	std::ostringstream &report, int player_gold, int remaining_gold,
	int finishing_bonus_per_turn, int turns_left, int finishing_bonus)
{
	end_level_data &end_level = get_end_level_data();
	report << _("Remaining gold: ")
		   << remaining_gold << "\n";
	if(end_level.gold_bonus) {
		if (turns_left > -1) {
			report << _("Early finish bonus: ")
				   << finishing_bonus_per_turn
				   << " " << _("per turn") << "\n"
				   << "<b>" << _("Turns finished early: ")
				   << turns_left << "</b>\n"
				   << _("Bonus: ")
				   << finishing_bonus << "\n";
	  	}
		report << _("Gold: ")
		       << (remaining_gold + finishing_bonus);
	}
	if (remaining_gold > 0) {
		report << '\n' << _("Carry over percentage: ") << end_level.carryover_percentage;
	}
	if(end_level.carryover_add) {
		report << "\n<b>" << _("Bonus Gold: ") << player_gold <<"</b>";
	} else {
		report << "\n<b>" << _("Retained Gold: ") << player_gold << "</b>";
	}

	std::string goldmsg;
	utils::string_map symbols;
	symbols["gold"] = lexical_cast_default<std::string>(player_gold);
	// Note that both strings are the same in english, but some languages will
	// want to translate them differently.
	if(end_level.carryover_add) {
		goldmsg = vngettext(
			"You will start the next scenario with $gold "
			"on top of the defined minimum starting gold.",
			"You will start the next scenario with $gold "
			"on top of the defined minimum starting gold.",
			player_gold, symbols);

	} else {
		goldmsg = vngettext(
			"You will start the next scenario with $gold "
			"or its defined minimum starting gold, "
			"whichever is higher.",
			"You will start the next scenario with $gold "
			"or its defined minimum starting gold, "
			"whichever is higher.",
			player_gold, symbols);
	}

	// xgettext:no-c-format
	report << '\n' << goldmsg;
}
Exemple #2
0
void campaign_controller::report_victory(
	std::ostringstream &report, team& t,
	int finishing_bonus_per_turn, int turns_left, int finishing_bonus)
{
	report << "<small>" << _("Remaining gold: ") << utils::half_signed_value(t.gold()) << "</small>";

	if(t.carryover_bonus() != 0) {
		if (turns_left > -1) {
			report << "\n\n<b>" << _("Turns finished early: ") << turns_left << "</b>\n"
				   << "<small>" << _("Early finish bonus: ") << finishing_bonus_per_turn << _(" per turn") << "</small>\n"
				   << "<small>" << _("Total bonus: ") << finishing_bonus << "</small>\n";
		}
		report << "<small>" << _("Total gold: ") << utils::half_signed_value(t.gold() + finishing_bonus) << "</small>";
	}
	if (t.gold() > 0) {
		report << "\n<small>" << _("Carryover percentage: ") << t.carryover_percentage() << "</small>";
	}
	if(t.carryover_add()) {
		report << "\n\n<big><b>" << _("Bonus gold: ") << utils::half_signed_value(t.carryover_gold()) << "</b></big>";
	} else {
		report << "\n\n<big><b>" << _("Retained gold: ") << utils::half_signed_value(t.carryover_gold()) << "</b></big>";
	}

	std::string goldmsg;
	utils::string_map symbols;

	symbols["gold"] = lexical_cast_default<std::string>(t.carryover_gold());

	// Note that both strings are the same in English, but some languages will
	// want to translate them differently.
	if(t.carryover_add()) {
		if(t.carryover_gold() > 0) {
			goldmsg = vngettext(
					"You will start the next scenario with $gold "
					"on top of the defined minimum starting gold.",
					"You will start the next scenario with $gold "
					"on top of the defined minimum starting gold.",
					t.carryover_gold(), symbols);

		} else {
			goldmsg = vngettext(
					"You will start the next scenario with "
					"the defined minimum starting gold.",
					"You will start the next scenario with "
					"the defined minimum starting gold.",
					t.carryover_gold(), symbols);
		}
	} else {
		goldmsg = vngettext(
			"You will start the next scenario with $gold "
			"or its defined minimum starting gold, "
			"whichever is higher.",
			"You will start the next scenario with $gold "
			"or its defined minimum starting gold, "
			"whichever is higher.",
			t.carryover_gold(), symbols);
	}

	// xgettext:no-c-format
	report << "\n" << goldmsg;
}
Exemple #3
0
	/**
	 * Shows the various on-screen messages, for use after movement.
	 */
	void unit_mover::feedback() const
	{
		// Alias some resources.
		game_display &disp = *resources::screen;

		bool redraw = false;
		bool playing_team_is_viewing = disp.playing_team() == disp.viewing_team()
		                               ||  disp.show_everything();

		// Multiple messages may be displayed simultaneously
		// this variable is used to keep them from overlapping
		std::string message_prefix = "";

		// Ambush feedback?
		if ( ambushed_ ) {
			// Suppress the message for observers if the ambusher(s) cannot be seen.
			bool show_message = playing_team_is_viewing;
			BOOST_FOREACH(const map_location &ambush, to_reveal_) {
				if ( !disp.fogged(ambush) )
					show_message = true;
			}
			if ( show_message ) {
				disp.announce(message_prefix + ambush_string_, font::BAD_COLOR);
				message_prefix += " \n";
				redraw = true;
			}
		}

		// Failed teleport feedback?
		if ( playing_team_is_viewing  &&  teleport_failed_ ) {
			std::string teleport_string = _("Failed teleport! Exit not empty");
			disp.announce(message_prefix + teleport_string, font::BAD_COLOR);
			message_prefix += " \n";
			redraw = true;
		}

		// Sighted units feedback?
		if ( playing_team_is_viewing  &&  (enemy_count_ != 0 || friend_count_ != 0) ) {
			// Create the message to display (depends on whether friends,
			// enemies, or both were sighted, and on how many of each).
			utils::string_map symbols;
			symbols["enemies"] = lexical_cast<std::string>(enemy_count_);
			symbols["friends"] = lexical_cast<std::string>(friend_count_);
			std::string message;
			SDL_Color msg_color;
			if ( friend_count_ != 0  &&  enemy_count_ != 0 ) {
				// Both friends and enemies sighted -- neutral message.
				symbols["friendphrase"] = vngettext("Part of 'Units sighted! (...)' sentence^1 friendly", "$friends friendly", friend_count_, symbols);
				symbols["enemyphrase"] = vngettext("Part of 'Units sighted! (...)' sentence^1 enemy", "$enemies enemy", enemy_count_, symbols);
				message = vgettext("Units sighted! ($friendphrase, $enemyphrase)", symbols);
				msg_color = font::NORMAL_COLOR;
			} else if ( enemy_count_ != 0 ) {
				// Only enemies sighted -- bad message.
				message = vngettext("Enemy unit sighted!", "$enemies enemy units sighted!", enemy_count_, symbols);
				msg_color = font::BAD_COLOR;
			} else if ( friend_count_ != 0 ) {
				// Only friends sighted -- good message.
				message = vngettext("Friendly unit sighted", "$friends friendly units sighted", friend_count_, symbols);
				msg_color = font::GOOD_COLOR;
			}

			disp.announce(message_prefix + message, msg_color);
			message_prefix += " \n";
			redraw = true;
		}

		// Suggest "continue move"?
		if ( playing_team_is_viewing && sighted_stop_ && !resources::whiteboard->is_executing_actions() ) {
			// See if the "Continue Move" action has an associated hotkey
			std::string name = hotkey::get_names(hotkey::HOTKEY_CONTINUE_MOVE);
			if ( !name.empty() ) {
				utils::string_map symbols;
				symbols["hotkey"] = name;
				std::string message = vgettext("(press $hotkey to keep moving)", symbols);
				disp.announce(message_prefix + message, font::NORMAL_COLOR);
				message_prefix += " \n";
				redraw = true;
			}
		}

		// Update the screen.
		if ( redraw )
			disp.draw();
	}