Skip to content

Commit

Permalink
feat(UI): Moved code for writing route error message to 'map' interfa…
Browse files Browse the repository at this point in the history
  • Loading branch information
nickshanks authored Sep 8, 2024
1 parent 1147fcf commit 7697671
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
16 changes: 16 additions & 0 deletions data/_ui/interfaces.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.


# Colors used to reflect the active or hovered interface button.
color "hover" 1. 1. 1. 0.
color "active" .75 .75 .75 0.
Expand Down Expand Up @@ -194,6 +195,11 @@ color "map wormhole" .5 .2 .9 1.
color "map orbits fleet destination" 1. 1. 1. 1.
color "map danger none" .1 .6 0. .4

# Colors used for the routing issue text in the map panel when
# a route to the selected system cannot be determined.
color "map route error text" 1. 0. 0. 1.
color "map route error shadow" 0. 0. 0. 1.

# Miscellaneous colors
color "wormholes: Ember Waste" .7 .1 .3

Expand Down Expand Up @@ -1431,6 +1437,16 @@ interface "map"
value "max zoom" 2
value "min zoom" -2

anchor top
string "route error"
center 1 59
size 18
color "map route error shadow"
string "route error"
center 0 58
size 18
color "map route error text"



interface "info panel"
Expand Down
9 changes: 3 additions & 6 deletions source/MapPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ namespace {
}

const Color black(0.f, 1.f);
const Color red(1.f, 0.f, 0.f, 1.f);

// Hovering an escort pip for this many frames activates the tooltip.
const int HOVER_TIME = 60;
Expand Down Expand Up @@ -411,13 +410,11 @@ void MapPanel::FinishDrawing(const string &buttonCondition)
{
static const string UNAVAILABLE = "You have no available route to this system.";
static const string UNKNOWN = "You have not yet mapped a route to this system.";
const Font &font = FontSet::Get(18);

const string &message = player.CanView(*selectedSystem) ? UNAVAILABLE : UNKNOWN;
Point point(-font.Width(message) / 2, Screen::Top() + 40);
font.Draw(message, point + Point(1, 1), black);
font.Draw(message, point, red);
info.SetString("route error", message);
}

mapInterface->Draw(info, this);
}


Expand Down

0 comments on commit 7697671

Please sign in to comment.