Giter VIP home page Giter VIP logo

Comments (10)

Wedge009 avatar Wedge009 commented on April 28, 2024 1

I think this needs to be factored out:

wesnoth/src/reports.cpp

Lines 866 to 902 in e235d9a

tooltip << _("Weapon range: ") << "<b>" << range << "</b>\n"
<< _("Damage type: ") << "<b>" << lang_type << "</b>\n"
<< _("Damage versus: ") << '\n';
// Show this weapon damage and resistance against all the different units.
// We want weak resistances (= good damage) first.
std::map<int, std::set<std::string>, std::greater<int>> resistances;
std::set<std::string> seen_types;
const team &unit_team = rc.dc().get_team(u.side());
const team &viewing_team = rc.teams()[rc.screen().viewing_team()];
for (const unit &enemy : rc.units())
{
if (enemy.incapacitated()) //we can't attack statues so don't display them in this tooltip
continue;
if (!unit_team.is_enemy(enemy.side()))
continue;
const map_location &loc = enemy.get_location();
const bool see_all = game_config::debug || rc.screen().show_everything();
if (!enemy.is_visible_to_team(viewing_team, see_all))
continue;
bool new_type = seen_types.insert(enemy.type_id()).second;
if (new_type) {
int resistance = enemy.resistance_against(at, false, loc);
resistances[resistance].insert(enemy.type_name());
}
}
for (const auto& resist : resistances) {
int damage_with_resistance = round_damage(specials_damage, damage_multiplier * resist.first, damage_divisor);
tooltip << "<b>" << damage_with_resistance << "</b> "
<< "<span color='" << attack_info_percent_color(resist.first-100).to_hex_string() << "'>"
<< "<i>(" << utils::signed_percent(resist.first-100) << ")</i>"
<< naps
<< " : \t" // spaces to align the tab to a multiple of 8
<< utils::join(resist.second, " " + font::unicode_bullet + " ") << '\n';
}
const string_with_tooltip damage_versus {flush(str), flush(tooltip)};

...so it can be re-used here (called by both unit recruit and recall dialogues):

const std::string range_png = std::string("icons/profiles/") + a.range() + "_attack.png~SCALE_INTO_SHARP(16,16)";
const std::string type_png = std::string("icons/profiles/") + a.type() + ".png~SCALE_INTO_SHARP(16,16)";
const bool range_png_exists = ::image::locator(range_png).file_exists();
const bool type_png_exists = ::image::locator(type_png).file_exists();
const t_string& range = string_table["range_" + a.range()];
const t_string& type = string_table["type_" + a.type()];
const std::string label = (formatter()
<< font::span_color(font::unit_type_color)
<< a.damage() << font::weapon_numbers_sep << a.num_attacks()
<< " " << a.name() << "</span>").str();
auto& subsection = header_node.add_child(
"item_image",
{
{ "image_range", { { "label", range_png } } },
{ "image_type", { { "label", type_png } } },
{ "name", { { "label", label }, { "use_markup", "true" } } },
}
);
find_widget<styled_widget>(&subsection, "image_range", true).set_tooltip(range);
find_widget<styled_widget>(&subsection, "image_type", true).set_tooltip(type);
if(!range_png_exists || !type_png_exists) {
add_name_tree_node(
subsection,
"item",
(formatter()
<< font::span_color(font::weapon_details_color)
<< range << font::weapon_details_sep
<< type << "</span>"
).str()
);
}

But I don't know if they are even compatible (eg GUI1 vs GUI2). I recall the unit preview pane is a much newer development compared with the unit details given in the side-bar (especially with the nice little icons for alignment, race, weapon range and attack type).

from wesnoth.

wesnoth-bugs avatar wesnoth-bugs commented on April 28, 2024

Modified on 2005-09-24

ott wrote:

See https://savannah.nongnu.org/bugs/index.php?func=detailitem&amp;item_id=10454 for Savannah history.

ott set priority: 1 - Later

from wesnoth.

wesnoth-bugs avatar wesnoth-bugs commented on April 28, 2024

Modified on 2007-08-29

esr changed status: None -> Wont Fix

esr wrote:

In 1.3.x. this information is one click away through the "Profile" button. Thus a tooltip would be rather superfluous. Marking this Wont Fix.

from wesnoth.

wesnoth-bugs avatar wesnoth-bugs commented on April 28, 2024

Modified on 2007-08-29

anonymous wrote:

The profile key is also present in 1.2 and earlier. I however agree that tooltipping this would not be terribly useful, and it would be superfluous.

from wesnoth.

wesnoth-bugs avatar wesnoth-bugs commented on April 28, 2024

Modified on 2007-09-13

soliton changed status: Wont Fix -> None

soliton wrote:

The requested information is not present in the unit's profile..

It would certainly make sense and be useful to have the same tooltips in the recruit/recalling preview pane as in the side panel. The way attacks are represented in either view should also be synchronized. Currently it differs for no apparent reason.

from wesnoth.

wesnoth-bugs avatar wesnoth-bugs commented on April 28, 2024

Modified on 2007-09-19

hajo changed priority: 1 - Later -> 3 - Low

from wesnoth.

CelticMinstrel avatar CelticMinstrel commented on April 28, 2024

@sigurdfdragon Are you sure this is superfluous? At least one person in the GNA discussion didn't think so.

from wesnoth.

sigurdfdragon avatar sigurdfdragon commented on April 28, 2024

hmmm... not sure

from wesnoth.

Pentarctagon avatar Pentarctagon commented on April 28, 2024

@Vultraz What's your opinion on whether the tooltip should be there?

from wesnoth.

Wedge009 avatar Wedge009 commented on April 28, 2024

Pinging @soliton- from Gna discussion.

It's funny that I never really noticed this feature, but I can confirm that the weapon information against known enemies is not readily available in the recall/recruit lists. Thus it's not superfluous - it'd be nice to have, but I also note that often at the recruit/recall stage one may not always know who the enemies will be, so perhaps its usefulness is limited. At any rate the current state of the recall/recruit lists surely are already much nicer and well detailed than when this was originally requested in 2004. Low priority perhaps?

from wesnoth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.