News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Network map should allow filtering by players with negative net wealth

Started by ACarlotti, July 13, 2018, 05:51:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ACarlotti

At the moment the network map only allows filtering by players with positive net wealth. This patch (taken from Extended, so line numbers are probably wrong) fixes this bug, allowing filtering by any player with convoys.

diff --git a/gui/map_frame.cc b/gui/map_frame.cc
index ef1e47900..dd3a89a39 100644
--- a/gui/map_frame.cc
+++ b/gui/map_frame.cc
@@ -239,7 +239,7 @@ map_frame_t::map_frame_t() :
        viewed_player_c.append_element( new gui_scrolled_list_t::const_text_scrollitem_t(translator::translate("All"), COL_BLACK));
        viewable_players[ 0 ] = -1;
        for(  int np = 0, count = 1;  np < MAX_PLAYER_COUNT;  np++  ) {
-               if(  welt->get_player( np )  &&  welt->get_player( np )->has_money_or_assets()) {
+               if(  welt->get_player( np )  &&  welt->get_player( np )->get_finance()->has_convoi()  ) {
                        viewed_player_c.append_element( new gui_scrolled_list_t::const_text_scrollitem_t(welt->get_player( np )->get_name(), welt->get_player( np )->get_player_color1()+4));
                        viewable_players[ count++ ] = np;
                }

(I think the function "has_money_or_assets" is misleadingly named, and this probably contributed to the bug arising in the first place.)

Dwachs

Parsley, sage, rosemary, and maggikraut.