draw and give tooltips for more map features

This commit is contained in:
2025-08-06 13:45:40 -05:00
parent b64f5fc814
commit a5cc323f00
5 changed files with 86 additions and 20 deletions

View File

@@ -1456,12 +1456,43 @@ void handle_one_minimap_event(const sf::Event& event) {
std::string tooltip_text = "";
if(is_explored(tile.x, tile.y)){
// Area rectangle hovered
const std::vector<info_rect_t>& area_desc = is_out() ? univ.out->area_desc : univ.town->area_desc;
for(info_rect_t area : area_desc){
if(area.contains(tile)){
tooltip_text += area.descr + " |";
}
}
// Sign hovered
const std::vector<sign_loc_t>& sign_locs = is_out() ? univ.out->sign_locs : univ.town->sign_locs;
for(sign_loc_t sign : sign_locs){
if(sign == tile){
tooltip_text += "Sign: " + sign.text + " |";
}
}
// Town entrance hovered
if(is_out()){
const std::vector<spec_loc_t>& city_locs = univ.out->city_locs;
for(spec_loc_t city : city_locs){
if(city == tile){
tooltip_text += univ.scenario.towns[city.spec]->name + " |";
}
}
}
// Vehicle hovered
for(auto& boat : univ.party.boats) {
if(!vehicle_is_here(boat)) continue;
if(boat.loc == tile){
tooltip_text += (boat.property ? "Boat (Not Yours)" : "Your Boat");
}
}
for(auto& horse : univ.party.horses) {
if(!vehicle_is_here(horse)) continue;
if(horse.loc == tile){
tooltip_text += (horse.property ? "Horses (Not Yours)" : "Your Horses");
}
}
}
if(tooltip_text != last_tooltip_text)
draw_map(false, tooltip_text);