Revert "Convert Scenario Status/Settings dialog pair to GUI2"
This reverts commit bb49be8428
.
This commit is contained in:
parent
bb49be8428
commit
8a9a466a29
9 changed files with 236 additions and 1146 deletions
|
@ -1,830 +0,0 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Definition of the window to show scenario stats and settings.
|
||||
###
|
||||
|
||||
#
|
||||
# A HORRIBLE, HORRIBLE hack to make sure all headers are two lines tall.
|
||||
# For space reasons, some headers are split into two lines, but since widgets can
|
||||
# only have one linked_group, I cannot link them to a fixed_height group to make
|
||||
# sure they all share heights.
|
||||
#
|
||||
#define _GUI_LIST_HEADER_TEXT _TEXT
|
||||
label = {_TEXT} + "
|
||||
"
|
||||
#enddef
|
||||
|
||||
#define _GUI_GAME_STATUS_LIST
|
||||
[listbox]
|
||||
id = "game_stats_list"
|
||||
definition = "default"
|
||||
|
||||
[header]
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_0"
|
||||
definition = "listbox_header"
|
||||
linked_group = "leader"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Leader")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_1"
|
||||
definition = "listbox_header"
|
||||
linked_group = "team"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Team")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_2"
|
||||
definition = "listbox_header"
|
||||
linked_group = "gold"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Gold")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
[toggle_button]
|
||||
id = "sort_3"
|
||||
definition = "listbox_header"
|
||||
linked_group = "villages"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Villages")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_4"
|
||||
definition = "listbox_header"
|
||||
linked_group = "units"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Units")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_5"
|
||||
definition = "listbox_header"
|
||||
linked_group = "upkeep"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Upkeep")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_6"
|
||||
definition = "listbox_header"
|
||||
linked_group = "income"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Income")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[/row]
|
||||
[/header]
|
||||
|
||||
[list_definition]
|
||||
[row]
|
||||
[column]
|
||||
vertical_grow = "true"
|
||||
horizontal_grow = "true"
|
||||
|
||||
[toggle_panel]
|
||||
definition = "default"
|
||||
return_value_id = "ok"
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# To preseve alignment with the header, we wrap the grid in borders
|
||||
# instead of the child cells
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[grid]
|
||||
linked_group = "leader"
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[image]
|
||||
id = "team_leader_image"
|
||||
definition = "default"
|
||||
[/image]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
[label]
|
||||
id = "team_leader_name"
|
||||
definition = "default"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_name"
|
||||
definition = "default"
|
||||
linked_group = "team"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_gold"
|
||||
definition = "default_small"
|
||||
linked_group = "gold"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_villages"
|
||||
definition = "default_small"
|
||||
linked_group = "villages"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_units"
|
||||
definition = "default_small"
|
||||
linked_group = "units"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_upkeep"
|
||||
definition = "default_small"
|
||||
linked_group = "upkeep"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_income"
|
||||
definition = "default_small"
|
||||
linked_group = "income"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/toggle_panel]
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/listbox]
|
||||
#enddef
|
||||
|
||||
#define _GUI_SCENARIO_SETTINGS_PAGE
|
||||
[listbox]
|
||||
id = "scenario_settings_list"
|
||||
definition = "default"
|
||||
|
||||
[header]
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_0"
|
||||
definition = "listbox_header"
|
||||
linked_group = "leader"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Leader")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_1"
|
||||
definition = "listbox_header"
|
||||
linked_group = "side"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Side")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_2"
|
||||
definition = "listbox_header"
|
||||
linked_group = "start_gold"
|
||||
|
||||
label = _ "Starting
|
||||
Gold"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
[toggle_button]
|
||||
id = "sort_3"
|
||||
definition = "listbox_header"
|
||||
linked_group = "base_income"
|
||||
|
||||
label = _ "Base
|
||||
Income"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_4"
|
||||
definition = "listbox_header"
|
||||
linked_group = "village_gold"
|
||||
|
||||
label = _ "Gold Per
|
||||
Village"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_5"
|
||||
definition = "listbox_header"
|
||||
linked_group = "village_support"
|
||||
|
||||
label = _ "Support Per
|
||||
Village"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_6"
|
||||
definition = "listbox_header"
|
||||
linked_group = "fog"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Fog")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_7"
|
||||
definition = "listbox_header"
|
||||
linked_group = "shroud"
|
||||
|
||||
{_GUI_LIST_HEADER_TEXT ( _ "Shroud")}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[/row]
|
||||
[/header]
|
||||
|
||||
[list_definition]
|
||||
[row]
|
||||
[column]
|
||||
vertical_grow = "true"
|
||||
horizontal_grow = "true"
|
||||
|
||||
[toggle_panel]
|
||||
definition = "default"
|
||||
return_value_id = "ok"
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# To preseve alignment with the header, we wrap the grid in borders
|
||||
# instead of the child cells
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[grid]
|
||||
linked_group = "leader"
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[image]
|
||||
id = "team_leader_image"
|
||||
definition = "default"
|
||||
[/image]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
[label]
|
||||
id = "team_leader_name"
|
||||
definition = "default"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_side"
|
||||
definition = "default"
|
||||
linked_group = "side"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_start_gold"
|
||||
definition = "default_small"
|
||||
linked_group = "start_gold"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_base_income"
|
||||
definition = "default_small"
|
||||
linked_group = "base_income"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_village_gold"
|
||||
definition = "default_small"
|
||||
linked_group = "village_gold"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_village_support"
|
||||
definition = "default_small"
|
||||
linked_group = "village_support"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_fog"
|
||||
definition = "default_small"
|
||||
linked_group = "fog"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "team_shroud"
|
||||
definition = "default_small"
|
||||
linked_group = "shroud"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/toggle_panel]
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/listbox]
|
||||
#enddef
|
||||
|
||||
#define _GUI_STATS_TAB_BAR
|
||||
[toggle_panel]
|
||||
linked_group = "tabs"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
{_GUI_STATS_TAB_PADDING}
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = all
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "tab_label"
|
||||
wrap = true
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
{_GUI_STATS_TAB_PADDING}
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/toggle_panel]
|
||||
#enddef
|
||||
|
||||
#define _GUI_STATS_TAB_PADDING
|
||||
[column]
|
||||
border = all
|
||||
border_size = 5
|
||||
|
||||
[spacer]
|
||||
width = 10
|
||||
[/spacer]
|
||||
|
||||
[/column]
|
||||
#enddef
|
||||
|
||||
[window]
|
||||
id = "game_stats"
|
||||
description = "Game status and scenario settings dialog."
|
||||
|
||||
[resolution]
|
||||
definition = "default"
|
||||
automatic_placement = "true"
|
||||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_height = 700
|
||||
|
||||
[linked_group]
|
||||
id = "header"
|
||||
fixed_height = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "tabs"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "leader"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "team"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "gold"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "villages"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "units"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "upkeep"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "income"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "side"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "start_gold"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "base_income"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "village_gold"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "village_support"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "fog"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "shroud"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip"
|
||||
[/tooltip]
|
||||
|
||||
[helptip]
|
||||
id = "tooltip"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = "true"
|
||||
|
||||
[label]
|
||||
definition = "title"
|
||||
label = _ "Current Status"
|
||||
id = "title"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
vertical_grow = "true"
|
||||
|
||||
[stacked_widget]
|
||||
id = "pager"
|
||||
definition = "default"
|
||||
|
||||
[stack]
|
||||
|
||||
[layer]
|
||||
[row]
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = "true"
|
||||
|
||||
{_GUI_GAME_STATUS_LIST}
|
||||
[/column]
|
||||
[/row]
|
||||
[/layer]
|
||||
|
||||
[layer]
|
||||
[row]
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = "true"
|
||||
|
||||
{_GUI_SCENARIO_SETTINGS_PAGE}
|
||||
[/column]
|
||||
[/row]
|
||||
[/layer]
|
||||
|
||||
[/stack]
|
||||
|
||||
[/stacked_widget]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
{GUI_HORIZONTAL_SPACER_LINE}
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = all
|
||||
border_size = 5
|
||||
horizontal_alignment = "center"
|
||||
|
||||
[horizontal_listbox]
|
||||
id = "tab_bar"
|
||||
|
||||
[list_definition]
|
||||
[row]
|
||||
[column]
|
||||
{_GUI_STATS_TAB_BAR}
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/horizontal_listbox]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
[column]
|
||||
[spacer]
|
||||
height = 10
|
||||
[/spacer]
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
grow_factor=0
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
[button]
|
||||
id = "ok"
|
||||
definition = "default"
|
||||
label = _ "Scroll To"
|
||||
[/button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
[button]
|
||||
id = "cancel"
|
||||
definition = "default"
|
||||
label = _ "Close"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window]
|
||||
|
||||
#undef _GUI_GAME_STATUS_LIST
|
||||
#undef _GUI_SCENARIO_SETTINGS_PAGE
|
||||
#undef _GUI_STATS_TAB_BAR
|
||||
#undef _GUI_STATS_TAB_PADDING
|
||||
#undef _GUI_LIST_HEADER_TEXT
|
|
@ -556,8 +556,6 @@
|
|||
<Unit filename="../../src/gui/dialogs/game_load.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_save.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_save.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_stats.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_stats.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_version.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_version.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/gamestate_inspector.cpp" />
|
||||
|
|
|
@ -808,7 +808,6 @@ set(wesnoth-main_SRC
|
|||
gui/dialogs/game_delete.cpp
|
||||
gui/dialogs/game_load.cpp
|
||||
gui/dialogs/game_save.cpp
|
||||
gui/dialogs/game_stats.cpp
|
||||
gui/dialogs/game_version.cpp
|
||||
gui/dialogs/gamestate_inspector.cpp
|
||||
gui/dialogs/label_settings.cpp
|
||||
|
|
|
@ -385,7 +385,6 @@ wesnoth_sources = Split("""
|
|||
gui/dialogs/game_delete.cpp
|
||||
gui/dialogs/game_load.cpp
|
||||
gui/dialogs/game_save.cpp
|
||||
gui/dialogs/game_stats.cpp
|
||||
gui/dialogs/game_version.cpp
|
||||
gui/dialogs/gamestate_inspector.cpp
|
||||
gui/dialogs/label_settings.cpp
|
||||
|
|
|
@ -1,271 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-lib"
|
||||
|
||||
#include "gui/dialogs/game_stats.hpp"
|
||||
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/core/log.hpp"
|
||||
#include "gui/dialogs/helper.hpp"
|
||||
#include "gui/dialogs/message.hpp"
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
#include "gui/widgets/list.hpp"
|
||||
#else
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#endif
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
#include "gui/widgets/image.hpp"
|
||||
#include "gui/widgets/label.hpp"
|
||||
#include "gui/widgets/stacked_widget.hpp"
|
||||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "display.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "game_classification.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "marked-up_text.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "play_controller.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "units/map.hpp"
|
||||
#include "units/ptr.hpp"
|
||||
#include "units/unit.hpp"
|
||||
|
||||
#include "utils/functional.hpp"
|
||||
|
||||
static lg::log_domain log_display("display");
|
||||
#define LOG_DP LOG_STREAM(info, log_display)
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
REGISTER_DIALOG(game_stats)
|
||||
|
||||
tgame_stats::tgame_stats(game_board& board, const int viewing_team)
|
||||
: board_(board)
|
||||
, viewing_team_(board_.teams()[viewing_team])
|
||||
{
|
||||
for(const auto& team : board_.teams()) {
|
||||
team_data_.push_back(board_.calculate_team_data(team, team.side()));
|
||||
}
|
||||
}
|
||||
|
||||
void tgame_stats::pre_show(twindow& window)
|
||||
{
|
||||
tlistbox& stats_list = find_widget<tlistbox>(&window, "game_stats_list", false);
|
||||
tlistbox& settings_list = find_widget<tlistbox>(&window, "scenario_settings_list", false);
|
||||
|
||||
for(const auto& team : board_.teams()) {
|
||||
if(team.hidden()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> row_data_stats;
|
||||
string_map column_stats;
|
||||
|
||||
const bool known = viewing_team_.knows_about_team(team.side() - 1);
|
||||
const bool enemy = viewing_team_.is_enemy(team.side());
|
||||
|
||||
const team_data& data = team_data_[team.side() - 1];
|
||||
|
||||
unit_const_ptr leader = board_.units().find_leader(team.side()).get_shared_ptr();
|
||||
|
||||
std::string leader_name;
|
||||
std::string leader_image;
|
||||
|
||||
if(leader) {
|
||||
const bool fogged = viewing_team_.fogged(leader->get_location());
|
||||
|
||||
// Add leader image. If it's fogged show only a random leader image.
|
||||
if(!fogged || known || game_config::debug) {
|
||||
leader_image = leader->absolute_image() + leader->image_mods();
|
||||
leader_name = leader->name();
|
||||
} else {
|
||||
leader_image = formatter() << "units/unknown-unit.png" << "~RC(magenta>" << team.color() << ")";
|
||||
leader_name = _("Unknown");
|
||||
}
|
||||
|
||||
if(resources::controller) {
|
||||
if(resources::controller->get_classification().campaign_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER) {
|
||||
leader_name = team.side_name();
|
||||
}
|
||||
}
|
||||
|
||||
leader_name = "<span color='" + team::get_side_highlight_pango(team.side() - 1) + "'>" + leader_name + "</span>";
|
||||
}
|
||||
|
||||
//
|
||||
// Status list
|
||||
//
|
||||
column_stats["use_markup"] = "true";
|
||||
|
||||
column_stats["label"] = leader_image;
|
||||
row_data_stats.insert(std::make_pair("team_leader_image", column_stats));
|
||||
|
||||
column_stats["label"] = leader_name;
|
||||
row_data_stats.insert(std::make_pair("team_leader_name", column_stats));
|
||||
|
||||
column_stats["label"] = data.teamname.empty() ? team.team_name() : data.teamname;
|
||||
row_data_stats.insert(std::make_pair("team_name", column_stats));
|
||||
|
||||
// We don't spare more info (only name) so let's go on next side ...
|
||||
if(!known && !game_config::debug) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string gold_str;
|
||||
if(game_config::debug || !enemy || !viewing_team_.uses_fog()) {
|
||||
gold_str = utils::half_signed_value(data.gold);
|
||||
}
|
||||
|
||||
column_stats["label"] = gold_str;
|
||||
row_data_stats.insert(std::make_pair("team_gold", column_stats));
|
||||
|
||||
std::string village_count = std::to_string(data.villages);
|
||||
if(!viewing_team_.uses_fog() && !viewing_team_.uses_shroud()) {
|
||||
village_count += "/" + std::to_string(board_.map().villages().size());
|
||||
}
|
||||
|
||||
column_stats["label"] = village_count;
|
||||
row_data_stats.insert(std::make_pair("team_villages", column_stats));
|
||||
|
||||
column_stats["label"] = std::to_string(data.units);
|
||||
row_data_stats.insert(std::make_pair("team_units", column_stats));
|
||||
|
||||
column_stats["label"] = std::to_string(data.upkeep);
|
||||
row_data_stats.insert(std::make_pair("team_upkeep", column_stats));
|
||||
|
||||
const std::string income = utils::signed_value(data.net_income);
|
||||
column_stats["label"] = data.net_income < 0 ? "<span color='#ff0000'>" + income + "</span>" : income;
|
||||
row_data_stats.insert(std::make_pair("team_income", column_stats));
|
||||
|
||||
stats_list.add_row(row_data_stats);
|
||||
|
||||
//
|
||||
// Settings list
|
||||
//
|
||||
std::map<std::string, string_map> row_data_settings;
|
||||
string_map column_settings;
|
||||
|
||||
column_settings["use_markup"] = "true";
|
||||
|
||||
column_settings["label"] = leader_image;
|
||||
row_data_settings.insert(std::make_pair("team_leader_image", column_settings));
|
||||
|
||||
column_settings["label"] = leader_name;
|
||||
row_data_settings.insert(std::make_pair("team_leader_name", column_settings));
|
||||
|
||||
column_settings["label"] = std::to_string(team.side());
|
||||
row_data_settings.insert(std::make_pair("team_side", column_settings));
|
||||
|
||||
column_settings["label"] = std::to_string(team.start_gold());
|
||||
row_data_settings.insert(std::make_pair("team_start_gold", column_settings));
|
||||
|
||||
column_settings["label"] = std::to_string(team.base_income());
|
||||
row_data_settings.insert(std::make_pair("team_base_income", column_settings));
|
||||
|
||||
column_settings["label"] = std::to_string(team.village_gold());
|
||||
row_data_settings.insert(std::make_pair("team_village_gold", column_settings));
|
||||
|
||||
column_settings["label"] = std::to_string(team.village_support());
|
||||
row_data_settings.insert(std::make_pair("team_village_support", column_settings));
|
||||
|
||||
column_settings["label"] = team.uses_fog() ? _("yes") : _("no");
|
||||
row_data_settings.insert(std::make_pair("team_fog", column_settings));
|
||||
|
||||
column_settings["label"] = team.uses_shroud() ? _("yes") : _("no");;
|
||||
row_data_settings.insert(std::make_pair("team_shroud", column_settings));
|
||||
|
||||
settings_list.add_row(row_data_settings);
|
||||
}
|
||||
|
||||
// Sorting options for the status list
|
||||
stats_list.register_sorting_option(0, [this](const int i) {
|
||||
const std::string name = (*board_.units().find_leader(board_.teams()[i].side()).get_shared_ptr()).name();
|
||||
return !name.empty() ? name : "Unknown"; });
|
||||
|
||||
stats_list.register_sorting_option(1, [this](const int i) { return board_.teams()[i].user_team_name().str(); });
|
||||
stats_list.register_sorting_option(2, [this](const int i) { return board_.teams()[i].gold(); });
|
||||
stats_list.register_sorting_option(3, [this](const int i) { return board_.teams()[i].villages(); });
|
||||
stats_list.register_sorting_option(4, [this](const int i) { return team_data_[i].units; });
|
||||
stats_list.register_sorting_option(5, [this](const int i) { return team_data_[i].upkeep; });
|
||||
stats_list.register_sorting_option(6, [this](const int i) { return team_data_[i].net_income; });
|
||||
|
||||
// Sorting options for the settings list
|
||||
settings_list.register_sorting_option(0, [this](const int i) {
|
||||
const std::string name = (*board_.units().find_leader(board_.teams()[i].side()).get_shared_ptr()).name();
|
||||
return !name.empty() ? name : "Unknown"; });
|
||||
|
||||
settings_list.register_sorting_option(1, [this](const int i) { return board_.teams()[i].side(); });
|
||||
settings_list.register_sorting_option(2, [this](const int i) { return board_.teams()[i].start_gold(); });
|
||||
settings_list.register_sorting_option(3, [this](const int i) { return board_.teams()[i].base_income(); });
|
||||
settings_list.register_sorting_option(4, [this](const int i) { return board_.teams()[i].village_gold(); });
|
||||
settings_list.register_sorting_option(5, [this](const int i) { return board_.teams()[i].village_support(); });
|
||||
settings_list.register_sorting_option(6, [this](const int i) { return board_.teams()[i].uses_fog(); });
|
||||
settings_list.register_sorting_option(7, [this](const int i) { return board_.teams()[i].uses_shroud(); });
|
||||
|
||||
//
|
||||
// Set up tab control
|
||||
//
|
||||
tlistbox& tab_bar = find_widget<tlistbox>(&window, "tab_bar", false);
|
||||
|
||||
window.keyboard_capture(&tab_bar);
|
||||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(*tab_bar,
|
||||
std::bind(&tgame_stats::on_tab_select,
|
||||
*this, std::ref(window)));
|
||||
#else
|
||||
tab_bar.set_callback_value_change(
|
||||
dialog_callback<tgame_stats, &tgame_stats::on_tab_select>);
|
||||
#endif
|
||||
|
||||
std::map<std::string, string_map> list_data;
|
||||
|
||||
list_data["tab_label"]["label"] = _("Game Stats");
|
||||
tab_bar.add_row(list_data);
|
||||
|
||||
list_data["tab_label"]["label"] = _("Scenario Settings");
|
||||
tab_bar.add_row(list_data);
|
||||
|
||||
tab_bar.select_row(0);
|
||||
|
||||
on_tab_select(window);
|
||||
}
|
||||
|
||||
void tgame_stats::on_tab_select(twindow& window)
|
||||
{
|
||||
const int i = find_widget<tlistbox>(&window, "tab_bar", false).get_selected_row();
|
||||
|
||||
find_widget<tstacked_widget>(&window, "pager", false).select_layer(i);
|
||||
|
||||
// There are only two tabs, so this is simple
|
||||
find_widget<tlabel>(&window, "title", false).set_label(
|
||||
i == 0 ? _("Current Status") : _("Scenario Settings")
|
||||
);
|
||||
}
|
||||
|
||||
void tgame_stats::post_show(twindow& window)
|
||||
{
|
||||
if(get_retval() == twindow::OK) {
|
||||
const int selected_tab = find_widget<tlistbox>(&window, "tab_bar", false).get_selected_row();
|
||||
|
||||
const std::string list_id = selected_tab == 0 ? "game_stats_list" : "scenario_settings_list";
|
||||
selected_index_ = find_widget<tlistbox>(&window, list_id, false).get_selected_row();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -11,31 +11,19 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#ifndef GUI_DIALOGS_GAME_STATS_HPP_INCLUDED
|
||||
#define GUI_DIALOGS_GAME_STATS_HPP_INCLUDED
|
||||
#ifndef GUI_DIALOGS_UNIT_RECRUIT_HPP_INCLUDED
|
||||
#define GUI_DIALOGS_UNIT_RECRUIT_HPP_INCLUDED
|
||||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
#include "map/location.hpp"
|
||||
#include "units/ptr.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace gui2 {
|
||||
|
||||
class display;
|
||||
class game_board;
|
||||
class team;
|
||||
class team_data;
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
class ttext_;
|
||||
|
||||
class tgame_stats : public tdialog
|
||||
class tunit_advance : public tdialog
|
||||
{
|
||||
typedef std::vector<unit_const_ptr> unit_ptr_vector;
|
||||
public:
|
||||
tgame_stats(game_board& board, const int viewing_team);
|
||||
tunit_advance(const unit_ptr_vector& samples, size_t real);
|
||||
|
||||
int get_selected_index() const
|
||||
{
|
||||
|
@ -43,27 +31,22 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
// TODO: don't like having this
|
||||
game_board& board_;
|
||||
|
||||
const team& viewing_team_;
|
||||
|
||||
std::vector<team_data> team_data_;
|
||||
|
||||
int selected_index_;
|
||||
|
||||
void on_tab_select(twindow& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(twindow& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void post_show(twindow& window);
|
||||
|
||||
void list_item_clicked(twindow& window);
|
||||
|
||||
void show_help(twindow& window);
|
||||
|
||||
const unit_ptr_vector& previews_;
|
||||
|
||||
size_t selected_index_, real_;
|
||||
};
|
||||
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_GAME_STATS_HPP_INCLUDED */
|
||||
#endif /* ! GUI_DIALOGS_UNIT_RECRUIT_HPP_INCLUDED */
|
|
@ -51,7 +51,6 @@
|
|||
#include "gui/dialogs/multiplayer/mp_change_control.hpp"
|
||||
#include "gui/dialogs/simple_item_selector.hpp"
|
||||
#include "gui/dialogs/edit_text.hpp"
|
||||
#include "gui/dialogs/game_stats.hpp"
|
||||
#include "gui/dialogs/unit_create.hpp"
|
||||
#include "gui/dialogs/unit_recall.hpp"
|
||||
#include "gui/dialogs/unit_recruit.hpp"
|
||||
|
@ -207,16 +206,231 @@ private:
|
|||
gui::DIALOG_RESULT extra_result_;
|
||||
};
|
||||
} //end anonymous namespace
|
||||
|
||||
void menu_handler::status_table(int selected)
|
||||
{
|
||||
gui2::tgame_stats dlg(board(), gui_->viewing_team());
|
||||
std::stringstream heading;
|
||||
heading << HEADING_PREFIX << _("Leader") << COLUMN_SEPARATOR << ' ' << COLUMN_SEPARATOR
|
||||
<< _("Team") << COLUMN_SEPARATOR
|
||||
<< _("Gold") << COLUMN_SEPARATOR
|
||||
<< _("Villages") << COLUMN_SEPARATOR
|
||||
<< _("status^Units") << COLUMN_SEPARATOR
|
||||
<< _("Upkeep") << COLUMN_SEPARATOR
|
||||
<< _("Income");
|
||||
|
||||
dlg.show(gui_->video());
|
||||
gui::menu::basic_sorter sorter;
|
||||
sorter.set_redirect_sort(0,1).set_alpha_sort(1).set_alpha_sort(2).set_numeric_sort(3)
|
||||
.set_numeric_sort(4).set_numeric_sort(5).set_numeric_sort(6).set_numeric_sort(7);
|
||||
|
||||
if(dlg.get_retval() == gui2::twindow::OK) {
|
||||
gui_->scroll_to_leader(teams()[dlg.get_selected_index()].side());
|
||||
std::vector<std::string> items;
|
||||
std::vector<bool> leader_bools;
|
||||
items.push_back(heading.str());
|
||||
|
||||
const team& viewing_team = teams()[gui_->viewing_team()];
|
||||
|
||||
unsigned total_villages = 0;
|
||||
// a variable to check if there are any teams to show in the table
|
||||
bool status_table_empty = true;
|
||||
|
||||
//if the player is under shroud or fog, they don't get
|
||||
//to see details about the other sides, only their own
|
||||
//side, allied sides and a ??? is shown to demonstrate
|
||||
//lack of information about the other sides But he see
|
||||
//all names with in colors
|
||||
for(size_t n = 0; n != teams().size(); ++n) {
|
||||
if(teams()[n].hidden()) {
|
||||
continue;
|
||||
}
|
||||
status_table_empty=false;
|
||||
|
||||
const bool known = viewing_team.knows_about_team(n);
|
||||
const bool enemy = viewing_team.is_enemy(n+1);
|
||||
|
||||
std::stringstream str;
|
||||
|
||||
const team_data data = board().calculate_team_data(teams()[n],n+1);
|
||||
|
||||
unit_map::const_iterator leader = units().find_leader(n + 1);
|
||||
std::string leader_name;
|
||||
//output the number of the side first, and this will
|
||||
//cause it to be displayed in the correct color
|
||||
if(leader != units().end()) {
|
||||
const bool fogged = viewing_team.fogged(leader->get_location());
|
||||
// Add leader image. If it's fogged
|
||||
// show only a random leader image.
|
||||
if (!fogged || known || game_config::debug) {
|
||||
str << IMAGE_PREFIX << leader->absolute_image();
|
||||
#ifndef LOW_MEM
|
||||
str << leader->image_mods();
|
||||
#endif
|
||||
leader_bools.push_back(true);
|
||||
leader_name = leader->name();
|
||||
} else {
|
||||
str << IMAGE_PREFIX << std::string("units/unknown-unit.png");
|
||||
#ifndef LOW_MEM
|
||||
str << "~RC(magenta>" << teams()[n].color() << ")";
|
||||
#endif
|
||||
leader_bools.push_back(false);
|
||||
leader_name = "Unknown";
|
||||
}
|
||||
|
||||
if (pc_.get_classification().campaign_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER)
|
||||
leader_name = teams()[n].side_name();
|
||||
|
||||
} else {
|
||||
leader_bools.push_back(false);
|
||||
}
|
||||
str << COLUMN_SEPARATOR << team::get_side_highlight(n)
|
||||
<< leader_name << COLUMN_SEPARATOR
|
||||
<< (data.teamname.empty() ? teams()[n].team_name() : data.teamname)
|
||||
<< COLUMN_SEPARATOR;
|
||||
|
||||
if(!known && !game_config::debug) {
|
||||
// We don't spare more info (only name)
|
||||
// so let's go on next side ...
|
||||
items.push_back(str.str());
|
||||
continue;
|
||||
}
|
||||
|
||||
if(game_config::debug) {
|
||||
str << utils::half_signed_value(data.gold) << COLUMN_SEPARATOR;
|
||||
} else if(enemy && viewing_team.uses_fog()) {
|
||||
str << ' ' << COLUMN_SEPARATOR;
|
||||
} else {
|
||||
str << utils::half_signed_value(data.gold) << COLUMN_SEPARATOR;
|
||||
}
|
||||
str << data.villages;
|
||||
if(!(viewing_team.uses_fog() || viewing_team.uses_shroud())) {
|
||||
str << "/" << map().villages().size();
|
||||
}
|
||||
str << COLUMN_SEPARATOR
|
||||
<< data.units << COLUMN_SEPARATOR << data.upkeep << COLUMN_SEPARATOR
|
||||
<< (data.net_income < 0 ? font::BAD_TEXT : font::NULL_MARKUP) << utils::signed_value(data.net_income);
|
||||
total_villages += data.villages;
|
||||
items.push_back(str.str());
|
||||
}
|
||||
if (total_villages > map().villages().size()) {
|
||||
ERR_NG << "Logic error: map has " << map().villages().size() << " villages but status table shows " << total_villages << " owned in total" << std::endl;
|
||||
}
|
||||
|
||||
if (status_table_empty)
|
||||
{
|
||||
// no sides to show - display empty table
|
||||
std::stringstream str;
|
||||
str << " ";
|
||||
for (int i=0;i<7;++i)
|
||||
str << COLUMN_SEPARATOR << " ";
|
||||
leader_bools.push_back(false);
|
||||
items.push_back(str.str());
|
||||
}
|
||||
int result = 0;
|
||||
{
|
||||
leader_scroll_dialog slist(*gui_, _("Current Status"), leader_bools, selected, gui::DIALOG_FORWARD);
|
||||
slist.add_button(new gui::dialog_button(gui_->video(), _("More >"),
|
||||
gui::button::TYPE_PRESS, gui::DIALOG_FORWARD),
|
||||
gui::dialog::BUTTON_EXTRA_LEFT);
|
||||
slist.set_menu(items, &sorter);
|
||||
slist.get_menu().move_selection(selected);
|
||||
result = slist.show();
|
||||
selected = slist.get_menu().selection();
|
||||
} // this will kill the dialog before scrolling
|
||||
|
||||
if (result >= 0)
|
||||
gui_->scroll_to_leader(selected+1);
|
||||
else if (result == gui::DIALOG_FORWARD)
|
||||
scenario_settings_table(selected);
|
||||
}
|
||||
|
||||
void menu_handler::scenario_settings_table(int selected)
|
||||
{
|
||||
std::stringstream heading;
|
||||
heading << HEADING_PREFIX << _("scenario settings^Leader") << COLUMN_SEPARATOR
|
||||
<< COLUMN_SEPARATOR
|
||||
<< _("scenario settings^Side") << COLUMN_SEPARATOR
|
||||
<< _("scenario settings^Start\nGold") << COLUMN_SEPARATOR
|
||||
<< _("scenario settings^Base\nIncome") << COLUMN_SEPARATOR
|
||||
<< _("scenario settings^Gold Per\nVillage") << COLUMN_SEPARATOR
|
||||
<< _("scenario settings^Support Per\nVillage") << COLUMN_SEPARATOR
|
||||
<< _("scenario settings^Fog") << COLUMN_SEPARATOR
|
||||
<< _("scenario settings^Shroud");
|
||||
|
||||
gui::menu::basic_sorter sorter;
|
||||
sorter.set_redirect_sort(0,1).set_alpha_sort(1).set_numeric_sort(2)
|
||||
.set_numeric_sort(3).set_numeric_sort(4).set_numeric_sort(5)
|
||||
.set_numeric_sort(6).set_alpha_sort(7).set_alpha_sort(8);
|
||||
|
||||
std::vector<std::string> items;
|
||||
std::vector<bool> leader_bools;
|
||||
items.push_back(heading.str());
|
||||
|
||||
const team& viewing_team = teams()[gui_->viewing_team()];
|
||||
bool settings_table_empty = true;
|
||||
bool fogged;
|
||||
|
||||
for(size_t n = 0; n != teams().size(); ++n) {
|
||||
if(teams()[n].hidden()) {
|
||||
continue;
|
||||
}
|
||||
settings_table_empty = false;
|
||||
|
||||
std::stringstream str;
|
||||
unit_map::const_iterator leader = units().find_leader(n + 1);
|
||||
|
||||
if(leader != units().end()) {
|
||||
// Add leader image. If it's fogged
|
||||
// show only a random leader image.
|
||||
fogged=viewing_team.fogged(leader->get_location());
|
||||
if (!fogged || viewing_team.knows_about_team(n)) {
|
||||
str << IMAGE_PREFIX << leader->absolute_image();
|
||||
leader_bools.push_back(true);
|
||||
} else {
|
||||
str << IMAGE_PREFIX << std::string("units/unknown-unit.png");
|
||||
leader_bools.push_back(false);
|
||||
}
|
||||
#ifndef LOW_MEM
|
||||
str << leader->image_mods();
|
||||
#endif
|
||||
} else {
|
||||
leader_bools.push_back(false);
|
||||
}
|
||||
|
||||
str << COLUMN_SEPARATOR << team::get_side_highlight(n)
|
||||
<< teams()[n].side_name() << COLUMN_SEPARATOR
|
||||
<< n + 1 << COLUMN_SEPARATOR
|
||||
<< teams()[n].start_gold() << COLUMN_SEPARATOR
|
||||
<< teams()[n].base_income() << COLUMN_SEPARATOR
|
||||
<< teams()[n].village_gold() << COLUMN_SEPARATOR
|
||||
<< teams()[n].village_support() << COLUMN_SEPARATOR
|
||||
<< (teams()[n].uses_fog() ? _("yes") : _("no")) << COLUMN_SEPARATOR
|
||||
<< (teams()[n].uses_shroud() ? _("yes") : _("no")) << COLUMN_SEPARATOR;
|
||||
|
||||
items.push_back(str.str());
|
||||
}
|
||||
|
||||
if (settings_table_empty)
|
||||
{
|
||||
// no sides to show - display empty table
|
||||
std::stringstream str;
|
||||
for (int i=0;i<8;++i)
|
||||
str << " " << COLUMN_SEPARATOR;
|
||||
leader_bools.push_back(false);
|
||||
items.push_back(str.str());
|
||||
}
|
||||
int result = 0;
|
||||
{
|
||||
leader_scroll_dialog slist(*gui_, _("Scenario Settings"), leader_bools, selected, gui::DIALOG_BACK);
|
||||
slist.set_menu(items, &sorter);
|
||||
slist.get_menu().move_selection(selected);
|
||||
slist.add_button(new gui::dialog_button(gui_->video(), _(" < Back"),
|
||||
gui::button::TYPE_PRESS, gui::DIALOG_BACK),
|
||||
gui::dialog::BUTTON_EXTRA_LEFT);
|
||||
result = slist.show();
|
||||
selected = slist.get_menu().selection();
|
||||
} // this will kill the dialog before scrolling
|
||||
|
||||
if (result >= 0)
|
||||
gui_->scroll_to_leader(selected+1);
|
||||
else if (result == gui::DIALOG_BACK)
|
||||
status_table(selected);
|
||||
}
|
||||
|
||||
void menu_handler::save_map()
|
||||
|
|
|
@ -117,6 +117,7 @@ private:
|
|||
//void do_speak(const std::string& message, bool allies_only);
|
||||
// std::vector<std::string> create_unit_table(const statistics::stats::str_int_map& m,unsigned int team);
|
||||
bool has_friends() const;
|
||||
void scenario_settings_table(int selected=0);
|
||||
|
||||
game_display* gui_;
|
||||
play_controller & pc_;
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "gui/dialogs/game_load.hpp"
|
||||
#include "gui/dialogs/game_version.hpp"
|
||||
#include "gui/dialogs/game_save.hpp"
|
||||
#include "gui/dialogs/game_stats.hpp"
|
||||
#include "gui/dialogs/gamestate_inspector.hpp"
|
||||
#include "gui/dialogs/label_settings.hpp"
|
||||
#include "gui/dialogs/language_selection.hpp"
|
||||
|
@ -386,7 +385,6 @@ BOOST_AUTO_TEST_CASE(test_gui2)
|
|||
test<gui2::tgame_save>();
|
||||
test<gui2::tgame_save_message>();
|
||||
test<gui2::tgame_save_oos>();
|
||||
//test<gui2::tgame_stats>();
|
||||
test<gui2::tgamestate_inspector>();
|
||||
test<gui2::tlanguage_selection>();
|
||||
// test<gui2::tloadscreen>(); TODO: enable
|
||||
|
@ -478,7 +476,6 @@ BOOST_AUTO_TEST_CASE(test_gui2)
|
|||
list.erase(std::remove(list.begin(), list.end(), "unit_recruit"), list.end());
|
||||
list.erase(std::remove(list.begin(), list.end(), "unit_recall"), list.end());
|
||||
list.erase(std::remove(list.begin(), list.end(), "unit_list"), list.end());
|
||||
list.erase(std::remove(list.begin(), list.end(), "game_stats"), list.end());
|
||||
|
||||
// Test size() instead of empty() to get the number of offenders
|
||||
BOOST_CHECK_EQUAL(list.size(), 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue