Ejemplo n.º 1
0
void tside_list::fill_table(int catalog)
{
	const team& viewing_team = teams_[gui_.viewing_team()];

	std::map<int, size_t> art_map;
	art_map[hero::number_market] = 0;
	art_map[hero::number_tower] = 0;
	
	for (size_t n = 0; n != teams_.size(); ++n) {
		if (teams_[n].is_empty() || teams_[n].hidden()) {
			continue;
		}
		const bool known = viewing_team.knows_about_team(n, network::nconnections() > 0);
		const bool enemy = viewing_team.is_enemy(n + 1);
		std::stringstream str;

		const team_data data = calculate_team_data(teams_[n], n + 1);

		/*** Add list item ***/
		string_map table_item;
		std::map<std::string, string_map> table_item_item;

		// table_item["label"] = data.teamname.empty() ? teams_[n].team_name() : data.teamname;
		table_item["label"] = teams_[n].name();
		table_item_item.insert(std::make_pair("side", table_item));

		if (catalog == STATUS_PAGE) {
			hero* leader = teams_[n].leader();
			std::string leader_name;
			leader_name = leader->name();
			table_item["label"] = leader->name();
			table_item_item.insert(std::make_pair("leader", table_item));

			str.str("");
			if (teams_[n].is_human()) {
				str << _("Local Player");
			} else if (teams_[n].is_ai()) {
				str << _("Computer Player");
			} else if (teams_[n].is_network()) {
				str << _("Network Player");
			} else if (teams_[n].is_empty()) {
				str << _("(Empty slot)");
			} else {
				str << _("Unknown");
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("controller", table_item));

			table_item["label"] = teams_[n].uses_fog()? _("yes") : _("no");
			table_item_item.insert(std::make_pair("fog", table_item));

			table_item["label"] = teams_[n].uses_shroud()? _("yes") : _("no");
			table_item_item.insert(std::make_pair("shroud", table_item));

		} else if (catalog == MILITARY_PAGE) {
			str.str("");
			str << data.villages;
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("villages", table_item));

			str.str("");
			str << data.units;
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("units", table_item));

			str.str("");
			int navigation = teams_[n].navigation();
			str << unit_types.find(unit_types.id_from_navigation(navigation))->type_name();
			str << "(" << navigation / game_config::navigation_per_level << "." << navigation % game_config::navigation_per_level << ")";
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("navigation_civi", table_item));

			str.str("");
			str << teams_[n].holded_cards().size();
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("card", table_item));

		} else if (catalog == DIPLOMATISM_PAGE) {
			const std::map<int, diplomatism_data>& diplomatisms = teams_[n].diplomatisms();
			str.str("");
			for (std::map<int, diplomatism_data>::const_iterator it = diplomatisms.begin(); it != diplomatisms.end(); ++ it) {
				if (it->first - 1 != n && it->second.ally_) {
					str << " " << teams_[it->first - 1].name();
				}
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("ally", table_item));

			str.str("");
			for (std::map<int, diplomatism_data>::const_iterator it = diplomatisms.begin(); it != diplomatisms.end(); ++ it) {
				if (it->second.forbid_turns_) {
					str << " " << teams_[it->first - 1].name() << "(" << it->second.forbid_turns_ << ")";
				}
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("forbid", table_item));

		} else if (catalog == GOLD_PAGE) {
			str.str("");
			if (game_config::debug) {
				str << data.gold;
			} else if(enemy && viewing_team.uses_fog()) {
				str << "--";
			} else {
				str << data.gold;
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("gold_gold", table_item));

			str.str("");
			str << data.upkeep;
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("upkeep", table_item));

			str.str("");
			str << data.net_income;
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("net_income", table_item));

			str.str("");
			str << teams_[n].start_gold();
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("start_gold", table_item));

			str.str("");
			str << teams_[n].base_income();
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("base_gold", table_item));

			str.str("");
			str << teams_[n].village_gold();
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("village_gold", table_item));

		} else if (catalog == FEATURE_PAGE) {
			hero* leader = teams_[n].leader();

			table_item["label"] = leader->feature_str(leader->side_feature_);
			table_item_item.insert(std::make_pair("feature", table_item));

			str.str("");
			const std::vector<arms_feature>& features = teams_[n].features();
			for (std::vector<arms_feature>::const_iterator it = features.begin(); it != features.end(); ++ it) {
				if (it != features.begin()) {
					str << ", (";
				} else {
					str << "(";
				}
				str << ">=" << it->level_;
				str << " " << hero::arms_str(it->arms_);
				str << "-->" << hero::feature_str(it->feature_) << ")";
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("features", table_item));

		} else if (catalog == ARTIFICAL_PAGE) {

			const std::vector<artifical*>& holded_cities = teams_[n].holded_cities();
			for (std::map<int, size_t>::iterator itor = art_map.begin(); itor != art_map.end(); ++ itor) {
				itor->second = 0;
			}
			for (std::vector<artifical*>::const_iterator itor = holded_cities.begin(); itor != holded_cities.end(); ++ itor) {
				artifical* city = *itor;
				std::vector<artifical*>& arts = city->field_arts();
				for (std::vector<artifical*>::const_iterator itor2 = arts.begin(); itor2 != arts.end(); ++ itor2) {
					artifical* art = *itor2;
					int master = art->type()->master();
					if (art_map.find(master) != art_map.end()) {
						art_map[master] = art_map[master] + 1;
					}
				}
			}

			for (std::map<int, size_t>::const_iterator itor = art_map.begin(); itor != art_map.end(); ++ itor) {
				str.str("");
				str << itor->second;
				table_item["label"] = str.str();
				if (itor->first == hero::number_market) {
					table_item_item.insert(std::make_pair("market", table_item));
				} else {
					table_item_item.insert(std::make_pair("tower", table_item));
				}
			}

		} else if (catalog == PLAN_PAGE) {
			const bool survived = units_.side_survived(n + 1);
			ai_plan& plan = ai::manager::get_active_ai_plan_for_side(n + 1);

			str.str("");
			if (survived) {
				if (teams_[n].is_ai() || rpg::stratum != hero_stratum_leader) {
					if (plan.mrs_[0].target == mr_data::TARGET_INTERIOR) {
						str << _("Interior");
					} else if (plan.mrs_[0].target == mr_data::TARGET_GUARD) {
						str << _("Guard");
					} else if (plan.mrs_[0].target == mr_data::TARGET_AGGRESS) {
						str << _("Aggress");
					} else if (plan.mrs_[0].target == mr_data::TARGET_CHAOTIC) {
						str << _("Chaotic");
					} 
				}
				str << "(" << teams_[n].city_rect().x << ", " << teams_[n].city_rect().y << ", " << teams_[n].city_rect().w << ", " << teams_[n].city_rect().h << ")";
				
			} else {
				str << "---";
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("city_rectangle", table_item));

			str.str("");
			if (survived && (teams_[n].is_ai() || rpg::stratum != hero_stratum_leader)) {
				for (std::vector<mr_data>::const_iterator mr = plan.mrs_.begin(); mr != plan.mrs_.end(); ++ mr) {
					if (mr != plan.mrs_.begin()) {
						str << ", ";
					}
					str << "(" << mr->consider_rect.x << ", " << mr->consider_rect.y << ", " << mr->consider_rect.w << ", " << mr->consider_rect.h << ")";
				}
			} else {
				str << "---";
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("consider_rectangle", table_item));

			str.str("");
			if (survived && (teams_[n].is_ai() || rpg::stratum != hero_stratum_leader) && !plan.mrs_[0].own_front_cities.empty()) {
				str << "[" << plan.mrs_[0].own_front_cities.size() << "]";
				str << "(" << plan.mrs_[0].own_front_cities[0]->get_location().x << ", " << plan.mrs_[0].own_front_cities[0]->get_location().y << ")";
				str << plan.mrs_[0].own_front_cities[0]->name();
			} else {
				str << "---";
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("front_cities[0]", table_item));

			str.str("");
			if (survived && (teams_[n].is_ai() || rpg::stratum != hero_stratum_leader) && !plan.mrs_[0].enemy_cities.empty()) {
				str << "[" << plan.mrs_[0].enemy_cities.size() << "]";
				str << "(" << plan.mrs_[0].enemy_cities[0]->get_location().x << ", " << plan.mrs_[0].enemy_cities[0]->get_location().y << ")";
				str << plan.mrs_[0].enemy_cities[0]->name();
			} else {
				str << "---";
			}
			table_item["label"] = str.str();
			table_item_item.insert(std::make_pair("enemy_cities[0]", table_item));
		}
		hero_table_->add_row(table_item_item);
		tgrid* grid_ptr = hero_table_->get_row_grid(hero_table_->get_item_count() - 1);
		ttoggle_panel* toggle = dynamic_cast<ttoggle_panel*>(grid_ptr->find("_toggle", true));
		toggle->set_data(n);
	}
}
Ejemplo n.º 2
0
report generate_report(TYPE type,
                       std::map<reports::TYPE, std::string> report_contents,
                       const team &current_team, int current_side, int playing_side,
                       const map_location& loc, const map_location& mouseover, const map_location& displayed_unit_hex,
                       const std::set<std::string> &observers,
                       const config& level, bool show_everything)
{
	unit_map &units = *resources::units;
	gamemap &map = *resources::game_map;
	std::vector<team> &teams = *resources::teams;

	const unit *u = NULL;

	if((int(type) >= int(UNIT_REPORTS_BEGIN) && int(type) < int(UNIT_REPORTS_END)) || type == POSITION){
		u = get_visible_unit(units, displayed_unit_hex, current_team, show_everything);
		if (!u && type != POSITION) {
			return report();
		}
	}

	std::ostringstream str;

	switch(type) {
	case UNIT_NAME:
		str << "<b>" << u->name() << "</b>";
		return report(str.str(), "", u->name());
	case UNIT_TYPE:
		str << span_color(font::unit_type_color) << u->type_name() << naps;
		return report(str.str(), "", u->unit_description());
	case UNIT_RACE:
		str << span_color(font::race_color)
			<< u->race()->name(u->gender()) << naps;
		break;
	case UNIT_SIDE: {
		std::string flag_icon = teams[u->side() - 1].flag_icon();
		std::string old_rgb = game_config::flag_rgb;
		std::string new_rgb = team::get_side_colour_index(u->side());
		std::string mods = "~RC(" + old_rgb + ">" + new_rgb + ")";

		if(flag_icon.empty()) {
			flag_icon = game_config::flag_icon_image;
		}

		image::locator flag_icon_img(flag_icon, mods);
		return report("", flag_icon_img, teams[u->side() - 1].current_player());
	}
	case UNIT_LEVEL:
		str << u->level();
		break;
	case UNIT_AMLA: {
	  report res;
		const std::vector<std::pair<std::string,std::string> > &amla_icons=u->amla_icons();
	  for(std::vector<std::pair<std::string,std::string> >::const_iterator i=amla_icons.begin();i!=amla_icons.end();i++){
	    res.add_image(i->first,i->second);
	  }
	  return(res);
	}
	case UNIT_TRAITS:
		return report(u->traits_description(), "", u->modification_description("trait"));

	case UNIT_STATUS: {
		report res;
		if (map.on_board(displayed_unit_hex) &&
		    u->invisible(displayed_unit_hex, units, teams))
		{
			add_status(res, "misc/invisible.png", N_("invisible: "),
				N_("This unit is invisible. It cannot be seen or attacked by enemy units."));
		}
		if (u->get_state(unit::STATE_SLOWED)) {
			add_status(res, "misc/slowed.png", N_("slowed: "),
				N_("This unit has been slowed. It will only deal half its normal damage when attacking and its movement cost is doubled."));
		}
		if (u->get_state(unit::STATE_POISONED)) {
			add_status(res, "misc/poisoned.png", N_("poisoned: "),
				N_("This unit is poisoned. It will lose 8 HP every turn until it can seek a cure to the poison in a village or from a friendly unit with the 'cures' ability.\n\nUnits cannot be killed by poison alone. The poison will not reduce it below 1 HP."));
		}
		if (u->get_state(unit::STATE_PETRIFIED)) {
			add_status(res, "misc/petrified.png", N_("petrified: "),
				N_("This unit has been petrified. It may not move or attack."));
		}
		return res;
	}

	case UNIT_ALIGNMENT: {
		const std::string &align = unit_type::alignment_description(u->alignment(), u->gender());
		const std::string &align_id = unit_type::alignment_id(u->alignment());
		std::stringstream ss;
		int cm = combat_modifier(units, displayed_unit_hex, u->alignment(), u->is_fearless());
		ss << align << " (" << (cm >= 0 ? "+" : "−") << abs(cm) << "%)";
		return report(ss.str(), "", string_table[align_id + "_description"]);
	}
	case UNIT_ABILITIES: {
		report res;
		const std::vector<std::string> &abilities = u->ability_tooltips();
		for(std::vector<std::string>::const_iterator i = abilities.begin(); i != abilities.end(); ++i) {
			str << gettext(i->c_str());
			if(i+2 != abilities.end())
				str << ",";
			++i;
			res.add_text(flush(str), *i);
		}

		return res;
	}
	case UNIT_HP: {
		std::ostringstream tooltip;
		str << span_color(u->hp_color()) << u->hitpoints()
			<< '/' << u->max_hitpoints() << naps;

		std::set<std::string> resistances_table;

		string_map resistances = u->get_base_resistances();

		bool att_def_diff = false;
		for(string_map::iterator resist = resistances.begin();
				resist != resistances.end(); ++resist) {
			std::ostringstream line;
			line << gettext(resist->first.c_str()) << ": ";

			// Some units have different resistances when
			// attacking or defending.
			int res_att = 100 - u->resistance_against(resist->first, true, displayed_unit_hex);
			int res_def = 100 - u->resistance_against(resist->first, false, displayed_unit_hex);
			if (res_att == res_def) {
				line << res_def << "%\n";
			} else {
				line << res_att << "% / " << res_def << "%\n";
				att_def_diff = true;
			}
			resistances_table.insert(line.str());
		}

		tooltip << _("Resistances: ");
		if (att_def_diff)
			tooltip << _("(Att / Def)");
		tooltip << "\n";

		// the STL set will give alphabetical sorting
		for(std::set<std::string>::iterator line = resistances_table.begin();
				line != resistances_table.end(); ++line) {
			tooltip << (*line);
		}

		return report(str.str(), "", tooltip.str());
	}
	case UNIT_XP: {
		std::ostringstream tooltip;

		str << span_color(u->xp_color()) << u->experience()
			<< '/' << u->max_experience() << naps;

		tooltip << _("Experience Modifier: ") << ((level["experience_modifier"] != "") ? level["experience_modifier"] : "100") << "%";
		return report(str.str(), "", tooltip.str());
	}
	case UNIT_ADVANCEMENT_OPTIONS: {
		report res;
		const std::map<std::string,std::string> &adv_icons = u->advancement_icons();
		for(std::map<std::string,std::string>::const_iterator i=adv_icons.begin();i!=adv_icons.end();i++){
			res.add_image(i->first,i->second);
		}
		return res;
	}
	case UNIT_DEFENSE: {
		const t_translation::t_terrain terrain = map[displayed_unit_hex];
		int def = 100 - u->defense_modifier(terrain);
		SDL_Color color = int_to_color(game_config::red_to_green(def));
		str << span_color(color) << def << "%</span>";
		break;
	}
	case UNIT_MOVES: {
		float movement_frac = 1.0;
		if (u->side() == playing_side) {
			movement_frac = static_cast<float>(u->movement_left()) / std::max(1.0f, static_cast<float>(u->total_movement()));
			if (movement_frac > 1.0)
				movement_frac = 1.0;
		}

		int grey = 128 + static_cast<int>((255-128) * movement_frac);
		SDL_Color c = { grey, grey, grey, 0 };
		str << span_color(c) << u->movement_left()
			<< '/' << u->total_movement() << naps;
		break;
	}
	case UNIT_WEAPONS: {
		report res;
		std::ostringstream tooltip;

		size_t team_index = u->side() - 1;
		if(team_index >= teams.size()) {
			std::cerr << "illegal team index in reporting: " << team_index << "\n";
			return res;
		}

		foreach (const attack_type &at, u->attacks())
		{
			at.set_specials_context(displayed_unit_hex, map_location(), *u);
			std::string lang_type = gettext(at.type().c_str());
			str << span_color(font::weapon_color);
			if (u->get_state(unit::STATE_SLOWED)) {
				str << round_damage(at.damage(), 1, 2) << '-';
			} else {
				str << at.damage() << '-';
			}
			int nattacks = at.num_attacks();
			// Compute swarm attacks:
			unit_ability_list swarm = at.get_specials("swarm");
			if(!swarm.empty()) {
				int swarm_max_attacks = swarm.highest("swarm_attacks_max",nattacks).first;
				int swarm_min_attacks = swarm.highest("swarm_attacks_min").first;
				int hitp = u->hitpoints();
				int mhitp = u->max_hitpoints();

				nattacks = swarm_min_attacks + (swarm_max_attacks - swarm_min_attacks) * hitp / mhitp;

			}
			str << nattacks;
			str << ' ' << at.name() << ' ' << at.accuracy_parry_description();
			tooltip << at.name() << "\n";
			int effdmg;
			if (u->get_state(unit::STATE_SLOWED)) {
				effdmg = round_damage(at.damage(),1,2);
			} else {
				effdmg = at.damage();
			}
			tooltip << effdmg   << ' ' << _n("tooltip^damage", "damage",  effdmg) << ", ";
			tooltip << nattacks << ' ' << _n("tooltip^attack", "attacks", nattacks);

			int accuracy = at.accuracy();
			if(accuracy) {
				// Help xgettext with a directive to recognise the string as a non C printf-like string
				// xgettext:no-c-format
				tooltip << " " << (accuracy > 0 ? "+" : "") << accuracy << _("tooltip^% accuracy");
			}

			int parry = at.parry();
			if(parry) {
				// xgettext:no-c-format
				tooltip << " " << (parry > 0 ? "+" : "") << parry << _("tooltip^% parry");
			}

			str << "</span>\n";
			res.add_text(flush(str), flush(tooltip));

			std::string range = gettext(at.range().c_str());
			str << span_color(font::weapon_details_color) << "  "
				<< range << "--" << lang_type << "</span>\n";

			tooltip << _("weapon range: ") << range <<"\n";
			tooltip << _("damage type: ")  << lang_type << "\n";
			// Find all the unit types on the map, and
			// show this weapon's bonus against all the different units.
			// Don't show invisible units, except if they are in our team or allied.
			std::set<std::string> seen_units;
			std::map<int,std::vector<std::string> > resistances;
			for(unit_map::const_iterator u_it = units.begin(); u_it != units.end(); ++u_it) {
				if(teams[team_index].is_enemy(u_it->second.side()) &&
				   !current_team.fogged(u_it->first) &&
				   seen_units.count(u_it->second.type_id()) == 0 &&
				   ( !current_team.is_enemy(u_it->second.side()) ||
				     !u_it->second.invisible(u_it->first,units,teams)))
				{
					seen_units.insert(u_it->second.type_id());
					int resistance = u_it->second.resistance_against(at, false, u_it->first) - 100;
					resistances[resistance].push_back(u_it->second.type_name());
				}
			}

			for(std::map<int,std::vector<std::string> >::reverse_iterator resist = resistances.rbegin(); resist != resistances.rend(); ++resist) {
				std::sort(resist->second.begin(),resist->second.end());
				tooltip << (resist->first >= 0 ? "+" : "") << resist->first << "% " << _("vs") << " ";
				for(std::vector<std::string>::const_iterator i = resist->second.begin(); i != resist->second.end(); ++i) {
					if(i != resist->second.begin()) {
						tooltip << ", ";
					}

					tooltip << *i;
				}
				tooltip << "\n";
			}

			res.add_text(flush(str), flush(tooltip));


			const std::vector<t_string> &specials = at.special_tooltips();

			if(! specials.empty()) {
				for(std::vector<t_string>::const_iterator sp_it = specials.begin(); sp_it != specials.end(); ++sp_it) {
					str << span_color(font::weapon_details_color)
						<< "  " << *sp_it << "</span>\n";
					++sp_it;
					tooltip << *sp_it << '\n';
				}
				res.add_text(flush(str), flush(tooltip));
			}
		}

		return res;
	}
	case UNIT_IMAGE:
	{
//		const std::vector<Uint32>& old_rgb = u->second.team_rgb_range();
//		color_range new_rgb = team::get_side_color_range(u->second.side());
		return report("", image::locator(u->absolute_image(), u->image_mods()), "");
	}
	case UNIT_PROFILE:
		return report("", u->profile(), "");
	case TIME_OF_DAY: {
		time_of_day tod = resources::tod_manager->time_of_day_at(units, mouseover, *resources::game_map);
		const std::string tod_image = tod.image + (preferences::flip_time() ? "~FL(horiz)" : "");

		// Don't show illuminated time on fogged/shrouded tiles
		if (current_team.fogged(mouseover) || current_team.shrouded(mouseover)) {
			tod = resources::tod_manager->get_time_of_day(false, mouseover);
		}
		std::stringstream tooltip;

		tooltip << tod.name << "\n"
				<< _("Lawful units: ")
				<< (tod.lawful_bonus > 0 ? "+" : "") << tod.lawful_bonus << "%\n"
				<< _("Neutral units: ") << "0%\n"
				<< _("Chaotic units: ")
				<< (tod.lawful_bonus < 0 ? "+" : "") << (tod.lawful_bonus*-1) << "%";

		return report("",tod_image,tooltip.str());
	}
	case TURN: {
		str << resources::tod_manager->turn();
		int nb = resources::tod_manager->number_of_turns();
		if (nb != -1) str << '/' << nb;
		break;
	}
	// For the following status reports, show them in gray text
	// when it is not the active player's turn.
	case GOLD: {
		char const *end = naps;
		if (current_side != playing_side)
			str << span_color(font::GRAY_COLOUR);
		else if (current_team.gold() < 0)
			str << span_color(font::BAD_COLOUR);
		else
			end = "";
		str << current_team.gold() << end;
		break;
	}
	case VILLAGES: {
		const team_data data = calculate_team_data(current_team,current_side,units);
		if (current_side != playing_side)
			str << span_color(font::GRAY_COLOUR);
		str << data.villages << '/';
		if (current_team.uses_shroud()) {
			int unshrouded_villages = 0;
			std::vector<map_location>::const_iterator i = map.villages().begin();
			for (; i != map.villages().end(); i++) {
				if (!current_team.shrouded(*i))
					unshrouded_villages++;
			}
			str << unshrouded_villages;
		} else {
			str << map.villages().size();
		}
		if (current_side != playing_side)
			str << naps;
		break;
	}
	case NUM_UNITS: {
		if (current_side != playing_side)
			str << span_color(font::GRAY_COLOUR);
		str << side_units(units, current_side);
		if (current_side != playing_side)
			str << naps;
		break;
	}
	case UPKEEP: {
		const team_data data = calculate_team_data(current_team,current_side,units);
		if (current_side != playing_side)
			str << span_color(font::GRAY_COLOUR);
		str << data.expenses << " (" << data.upkeep << ")";
		if (current_side != playing_side)
			str << naps;
		break;
	}
	case EXPENSES: {
		const team_data data = calculate_team_data(current_team,current_side,units);
		if (current_side != playing_side)
			str << span_color(font::GRAY_COLOUR);
		str << data.expenses;
		if (current_side != playing_side)
			str << naps;
		break;
	}
	case INCOME: {
		team_data data = calculate_team_data(current_team, current_side, units);
		char const *end = naps;
		if (current_side != playing_side)
			str << span_color(font::GRAY_COLOUR);
		else if (data.net_income < 0)
			str << span_color(font::BAD_COLOUR);
		else
			end = "";
		str << data.net_income << end;
		break;
	}
	case TERRAIN: {
		if(!map.on_board(mouseover) || current_team.shrouded(mouseover))
			break;

		const t_translation::t_terrain terrain = map.get_terrain(mouseover);
		if (terrain == t_translation::OFF_MAP_USER)
			break;

		const t_translation::t_list& underlying = map.underlying_union_terrain(terrain);

		if(map.is_village(mouseover)) {
			int owner = village_owner(mouseover, teams) + 1;
			if(owner == 0 || current_team.fogged(mouseover)) {
				str << map.get_terrain_info(terrain).income_description();
			} else if(owner == current_side) {
				str << map.get_terrain_info(terrain).income_description_own();
			} else if(current_team.is_enemy(owner)) {
				str << map.get_terrain_info(terrain).income_description_enemy();
			} else {
				str << map.get_terrain_info(terrain).income_description_ally();
			}
			str << " ";
		} else {
		        str << map.get_terrain_info(terrain).description();
		}

		if(underlying.size() != 1 || underlying.front() != terrain) {
			str << " (";

			for(t_translation::t_list::const_iterator i =
					underlying.begin(); i != underlying.end(); ++i) {

			str << map.get_terrain_info(*i).name();
				if(i+1 != underlying.end()) {
					str << ",";
				}
			}
			str << ")";
		}
		break;
	}
	case POSITION: {
		if(!map.on_board(mouseover)) {
			break;
		}

		const t_translation::t_terrain terrain = map[mouseover];

		if (terrain == t_translation::OFF_MAP_USER)
			break;

		str << mouseover;

		if (!u)
			break;
		if(displayed_unit_hex != mouseover && displayed_unit_hex != loc)
			break;
		if(current_team.shrouded(mouseover))
			break;

		int move_cost = u->movement_cost(terrain);
		int defense = 100 - u->defense_modifier(terrain);

		if(move_cost < unit_movement_type::UNREACHABLE) {
			str << " (" << defense << "%," << move_cost << ")";
		} else if (mouseover == displayed_unit_hex) {
			str << " (" << defense << "%,-)";
		} else {
			str << " (-)";
		}

		break;
	}

	case SIDE_PLAYING: {
		std::string flag_icon = teams[playing_side-1].flag_icon();
		std::string old_rgb = game_config::flag_rgb;
		std::string new_rgb = team::get_side_colour_index(playing_side);
		std::string mods = "~RC(" + old_rgb + ">" + new_rgb + ")";

		if(flag_icon.empty()) {
			flag_icon = game_config::flag_icon_image;
		}

		image::locator flag_icon_img(flag_icon, mods);
		return report("",flag_icon_img,teams[playing_side-1].current_player());
	}

	case OBSERVERS: {
		if(observers.empty()) {
			return report();
		}

		str << _("Observers:") << "\n";

		for(std::set<std::string>::const_iterator i = observers.begin(); i != observers.end(); ++i) {
			str << *i << "\n";
		}

		return report("",game_config::observer_image,str.str());
	}
	case SELECTED_TERRAIN: {
		std::map<TYPE, std::string>::const_iterator it =
			report_contents.find(SELECTED_TERRAIN);
		if (it != report_contents.end()) {
			return report(it->second);
		}
		else {
			return report();
		}
	}
	case EDIT_LEFT_BUTTON_FUNCTION: {
		std::map<TYPE, std::string>::const_iterator it =
			report_contents.find(EDIT_LEFT_BUTTON_FUNCTION);
		if (it != report_contents.end()) {
			return report(it->second);
		}
		else {
			return report();
		}
	}
	case REPORT_COUNTDOWN: {
		int min;
		int sec;
		if (current_team.countdown_time() > 0){
			sec = current_team.countdown_time() / 1000;
			char const *end = naps;
			if (current_side != playing_side)
				str << span_color(font::GRAY_COLOUR);
			else if (sec < 60)
				str << "<span foreground=\"#c80000\">";
			else if (sec < 120)
				str << "<span foreground=\"#c8c800\">";
			else
				end = "";

			min = sec / 60;
			str << min << ":";
			sec = sec % 60;
			if (sec < 10) {
				str << "0";
			}
			str << sec << end;
			break;
		} // Intentional fall-through to REPORT_CLOCK
		  // if the time countdown isn't valid.
		  // If there is no turn time limit,
		  // then we display the clock instead.
		}
	case REPORT_CLOCK: {
		time_t t = std::time(NULL);
		struct tm *lt = std::localtime(&t);
		if (lt) {
			char temp[10];
			size_t s = std::strftime(temp, 10, preferences::clock_format().c_str(), lt);
			if(s>0) {
				return report(temp);
			} else {
				return report();
			}
		} else {
			return report();
		}
	}
	default:
		assert(false);
		break;
	}
	return report(str.str());
}