Merge branch 'master' into sdl2
|
@ -640,7 +640,7 @@ if(ENABLE_GAME)
|
|||
endif(ENABLE_HISTORY AND HISTORY_FOUND)
|
||||
endif(ENABLE_GAME)
|
||||
|
||||
if(ENABLE_GAME OR ENABLE_SERVER)
|
||||
if(ENABLE_GAME OR ENABLE_SERVER OR ENABLE_TOOLS OR ENABLE_TESTS)
|
||||
find_package( Boost 1.44 REQUIRED COMPONENTS filesystem )
|
||||
|
||||
if(NOT ENABLE_LIBINTL)
|
||||
|
@ -652,7 +652,7 @@ if(ENABLE_GAME OR ENABLE_SERVER)
|
|||
message("Warning: Using libintl on Windows instead of Boost.Locale may result in issues with translations and Unicode file paths!")
|
||||
endif()
|
||||
endif()
|
||||
endif(ENABLE_GAME OR ENABLE_SERVER)
|
||||
endif(ENABLE_GAME OR ENABLE_SERVER OR ENABLE_TOOLS OR ENABLE_TESTS)
|
||||
|
||||
if(ENABLE_POT_UPDATE_TARGET)
|
||||
find_package(TranslationTools REQUIRED)
|
||||
|
|
|
@ -18,6 +18,21 @@ CHANGES
|
|||
Example contents.
|
||||
[/rasection]
|
||||
|
||||
[rasection="New user files location on Windows by default"]
|
||||
[b]Short version:[/b]
|
||||
|
||||
The installer no longer provides a choice between storing user files in the installation dir and [c]Documents\My Games\WesnothX.Y[/c], forcing the latter instead (which no longer requires a command-line switch to be added to the game shortcut).
|
||||
|
||||
[b]Long version:[/b]
|
||||
|
||||
Up to Windows XP, mostly owing to the lack of user and process access control facilities on the mainstream Windows 9x series, applications would freely write user data into their installation paths without restriction. NT-based versions of Windows (including Windows XP) still supported this when running processes as accounts with administrator privileges, albeit at the risk of breaking things horribly in a proper multi-user environment. However, since Windows Vista, this practice is no longer recommended (and rightly so). Because there are too many applications that rely on the aforementioned broken scheme, Vista introduces User Access Control Virtualization to support legacy applications, by redirecting their writes to restricted paths to a user-dependent Virtual Store location.
|
||||
|
||||
Until now, the official Wesnoth installer has included the option to store user files either in the user’s Documents folder, or in the installation dir; the latter option forces Wesnoth to rely on UAC Virtualization if Wesnoth has been installed system-wide and then is run with normal user privileges. This has resulted in confusing documentation and countless forum threads on the matter of finding the actual location of Wesnoth’s user files on disk, mostly due to people choosing the install dir option [u]without a real need to do so[/u].
|
||||
|
||||
From this version onwards, the installer no longer provides the option to store user files in the installation dir, and the game itself defaults to using the Documents folder (more specifically, [c]Documents\My Games\WesnothX.Y[/c] where [c]X.Y[/c] represents the major and minor version numbers, such as [c]1.13[/c]) unless specifically instructed to do otherwise with the [c]--config-dir[/c] option in the command line. Additionally, [c]--config-dir[/c] paths can be either absolute, relative to [c]Documents\My Games[/c] (to support the previous installer approach to storing files in Documents), or relative to the process current working dir (usually the install dir) if either . or .. are provided as the first path component; this latter option is provided so that people can still install and run Wesnoth from removable media if they wish.
|
||||
|
||||
See also bug [bug]23753[/bug].[/rasection]
|
||||
|
||||
[rasection="New game version dialog"]
|
||||
Describe how awesome the new game version dialog is and how it replaces the old game paths dialog from 1.12.x
|
||||
[/rasection]
|
||||
|
|
14
changelog
|
@ -62,7 +62,7 @@ Version 1.13.1+dev:
|
|||
* Add helper.child_count
|
||||
* Add helper.child_array
|
||||
* Music and sound effects:
|
||||
* New dwarf hit and die sounds.
|
||||
* New sounds: dwarf hit and die, ink, mud fist and glob.
|
||||
* Terrains:
|
||||
* Removed unit elevation from N-S hanging bridges
|
||||
* Added unit elevation to NW-SE and SW-NE stone chasm bridges
|
||||
|
@ -70,6 +70,9 @@ Version 1.13.1+dev:
|
|||
* Hanging, stone chasm, and plank bridges are now displayed in-game simply
|
||||
as "Bridge", retaining their descriptive names in the editor as per
|
||||
convention.
|
||||
* Fixed spurious "could not open image 'terrain/.png'" error messages caused
|
||||
by terrains without a minimap image (symbol_image) such as those from the
|
||||
Special category in the editor (Impassable Overlay, etc.).
|
||||
* User interface:
|
||||
* It is now possible to switch from replay directly into normal play (bug #23833).
|
||||
* The game now shows a notification on remote clients if a sides takes very long to do a local choice (bug #23297).
|
||||
|
@ -112,6 +115,8 @@ Version 1.13.1+dev:
|
|||
messages involving macros.
|
||||
* Added WML menu item and event handler views to the Gamestate Inspector
|
||||
dialog.
|
||||
* The Gamestate Inspector now displays empty WML variables too (including
|
||||
containers/arrays).
|
||||
* Added new possibilities for [effect]:
|
||||
* apply_to=alignment - change a unit's alignment
|
||||
* apply_to=attacks_left - change a unit's attacks per turn
|
||||
|
@ -148,6 +153,12 @@ Version 1.13.1+dev:
|
|||
* Editor:
|
||||
* Added Category field and color sliders to the Edit Label panel.
|
||||
* Miscellaneous and bug fixes:
|
||||
* Made Documents\My Games\WesnothX.Y the default user config+data dir on
|
||||
Windows to replace the broken <current working dir>\userdata default that
|
||||
has never been acceptable practice. Portable installs are now required to
|
||||
explicitly use . or .. (e.g. `--config-dir .\userdata`) to force the
|
||||
user config+data dir path to be relative to the current working dir (see
|
||||
also bug #23753).
|
||||
* Removed legacy filesystem API implementation.
|
||||
* Fixed Generate Map dialog bug that caused last choice of map
|
||||
generator to not be actually selected (bug #23711).
|
||||
|
@ -174,6 +185,7 @@ Version 1.13.1+dev:
|
|||
eg if an add-on tries to set an invalid variable
|
||||
* Fixed bug 23060: unit stat tooltips do not show.
|
||||
* wmllint, wmlscope, wmlindent and wmllint-1.4 now run on Python 3
|
||||
* Text boxes tab completion now lists whisperer nicks for easier answer
|
||||
|
||||
Version 1.13.1:
|
||||
* Security fixes:
|
||||
|
|
|
@ -51,20 +51,20 @@
|
|||
[filter_attack]
|
||||
name=ink
|
||||
[/filter_attack]
|
||||
missile_start_time=-200
|
||||
missile_start_time=-300
|
||||
[missile_frame]
|
||||
duration=200
|
||||
duration=300
|
||||
image="projectiles/ink.png"
|
||||
image_diagonal="projectiles/ink.png"
|
||||
[/missile_frame]
|
||||
start_time=-250
|
||||
[frame]
|
||||
image="units/monsters/kraken-tentacle-1.png:150"
|
||||
[/frame]
|
||||
{SOUND:HIT_AND_MISS squishy-strike.wav squishy-miss.wav -100}
|
||||
start_time=-500
|
||||
[frame]
|
||||
image="units/monsters/kraken.png:100"
|
||||
[/frame]
|
||||
[frame]
|
||||
image="units/monsters/kraken-tentacle-1.png:500"
|
||||
[/frame]
|
||||
{SOUND:HIT_AND_MISS ink.ogg ink-miss.ogg -500}
|
||||
[/attack_anim]
|
||||
|
||||
# tentacles hit south----------------------------------------------
|
||||
|
|
|
@ -415,10 +415,6 @@ Chapter Four"
|
|||
description= _ "Death of Aldar"
|
||||
condition=lose
|
||||
[/objective]
|
||||
[objective]
|
||||
description= _ "Death of Galtrid"
|
||||
condition=lose
|
||||
[/objective]
|
||||
|
||||
[gold_carryover]
|
||||
bonus=no
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
[filter_attack]
|
||||
name=fist
|
||||
[/filter_attack]
|
||||
start_time=-250
|
||||
start_time=-400
|
||||
[frame]
|
||||
image="units/monsters/mudcrawler.png:125"
|
||||
image="units/monsters/mudcrawler.png:200"
|
||||
[/frame]
|
||||
[frame]
|
||||
image="units/monsters/mudcrawler-attack-[1,2,1].png:[75*2,50]"
|
||||
image="units/monsters/mudcrawler-attack-[1,2,1].png:[100*2,75]"
|
||||
[/frame]
|
||||
[frame]
|
||||
image="units/monsters/mudcrawler-defend-1.png:125"
|
||||
|
@ -38,6 +38,6 @@
|
|||
[frame]
|
||||
image="units/monsters/mudcrawler.png:25"
|
||||
[/frame]
|
||||
{SOUND:HIT_AND_MISS fist.ogg {SOUND_LIST:MISS} -100}
|
||||
{SOUND:HIT_AND_MISS mud-fist.ogg mud-fist-miss.ogg -400}
|
||||
[/attack_anim]
|
||||
[/unit_type]
|
||||
|
|
|
@ -1085,6 +1085,9 @@
|
|||
[entry]
|
||||
name = "FAAB"
|
||||
[/entry]
|
||||
[entry]
|
||||
name = "Federico Pasco (neverEnough)"
|
||||
[/entry]
|
||||
[entry]
|
||||
name = "Fedor Khod'kov (teddy/fkhodkov)"
|
||||
[/entry]
|
||||
|
|
BIN
data/core/sounds/ink-miss.ogg
Normal file
BIN
data/core/sounds/ink.ogg
Normal file
BIN
data/core/sounds/mud-fist-miss.ogg
Normal file
BIN
data/core/sounds/mud-fist.ogg
Normal file
BIN
data/core/sounds/mud-glob-miss.ogg
Normal file
BIN
data/core/sounds/mud-glob.ogg
Normal file
|
@ -315,6 +315,7 @@ Most units receive 20 to 40% defense in sand."
|
|||
symbol_image=sand/desert-oasis
|
||||
id=oasis
|
||||
name= _ "Oasis"
|
||||
editor_name= _ "Oasis"
|
||||
default_base=Dd
|
||||
string=^Do
|
||||
aliasof=_bas
|
||||
|
|
|
@ -50,16 +50,16 @@
|
|||
name=ink
|
||||
[/filter_attack]
|
||||
start_time=-500
|
||||
missile_start_time=-200
|
||||
missile_start_time=-300
|
||||
[missile_frame]
|
||||
duration=200
|
||||
duration=300
|
||||
image="projectiles/ink.png"
|
||||
image_diagonal="projectiles/ink.png"
|
||||
[/missile_frame]
|
||||
[frame]
|
||||
image="units/monsters/cuttlefish-ranged-[1~6].png:100"
|
||||
[/frame]
|
||||
{SOUND:HIT_AND_MISS squishy-strike.wav squishy-miss.wav -100}
|
||||
{SOUND:HIT_AND_MISS ink.ogg ink-miss.ogg -500}
|
||||
[/attack_anim]
|
||||
[attack_anim]
|
||||
[filter_attack]
|
||||
|
|
|
@ -49,16 +49,16 @@
|
|||
[filter_attack]
|
||||
name=mud glob
|
||||
[/filter_attack]
|
||||
missile_start_time=-150
|
||||
missile_start_time=-200
|
||||
[missile_frame]
|
||||
duration=150
|
||||
duration=200
|
||||
image="projectiles/mud-glob.png"
|
||||
image_diagonal="projectiles/mud-glob.png"
|
||||
[/missile_frame]
|
||||
start_time=-375
|
||||
{SOUND:HIT_AND_MISS squishy-strike.wav squishy-miss.wav -150}
|
||||
start_time=-400
|
||||
{SOUND:HIT_AND_MISS mud-glob.ogg mud-glob-miss.ogg -400}
|
||||
[frame]
|
||||
image="units/monsters/giant-mudcrawler-ranged[1~5].png:[100,200*2,100*2]"
|
||||
image="units/monsters/giant-mudcrawler-ranged[1~5].png:[125,200*2,100*2]"
|
||||
[/frame]
|
||||
[/attack_anim]
|
||||
[attack_anim]
|
||||
|
@ -67,7 +67,7 @@
|
|||
[/filter_attack]
|
||||
start_time=-500
|
||||
offset=0.0~-0.1:225,-0.1:125,-0.1~0.4:175,0.4:50,0.4~0.0:325
|
||||
{SOUND:HIT_AND_MISS squishy-strike.wav squishy-miss.wav -50}
|
||||
{SOUND:HIT_AND_MISS mud-fist.ogg mud-fist-miss.ogg -400}
|
||||
[frame]
|
||||
image="units/monsters/giant-mudcrawler-attack[1~11].png:[75*3,150,75*4,100*3]"
|
||||
[/frame]
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
[filter_attack]
|
||||
name=mud glob
|
||||
[/filter_attack]
|
||||
missile_start_time=-150
|
||||
missile_start_time=-200
|
||||
[missile_frame]
|
||||
duration=150
|
||||
duration=200
|
||||
image="projectiles/mud-glob.png"
|
||||
image_diagonal="projectiles/mud-glob.png"
|
||||
[/missile_frame]
|
||||
|
@ -60,6 +60,6 @@
|
|||
[frame]
|
||||
image="units/monsters/mudcrawler-attack-[1~5].png:100"
|
||||
[/frame]
|
||||
{SOUND:HIT_AND_MISS squishy-strike.wav squishy-miss.wav 0}
|
||||
{SOUND:HIT_AND_MISS mud-glob.ogg mud-glob-miss.ogg -400}
|
||||
[/attack_anim]
|
||||
[/unit_type]
|
||||
|
|
|
@ -58,6 +58,14 @@
|
|||
|
||||
[draw]
|
||||
|
||||
[rectangle]
|
||||
x = 0
|
||||
y = 0
|
||||
w = "(width)"
|
||||
h = "(height)"
|
||||
fill_color = "255, 255, 255, 76"
|
||||
[/rectangle]
|
||||
|
||||
{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
|
||||
|
||||
[/draw]
|
||||
|
@ -74,7 +82,13 @@
|
|||
|
||||
[draw]
|
||||
|
||||
|
||||
[rectangle]
|
||||
x = 0
|
||||
y = 0
|
||||
w = "(width)"
|
||||
h = "(height)"
|
||||
fill_color = "255, 255, 255, 25"
|
||||
[/rectangle]
|
||||
|
||||
{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
|
||||
|
||||
|
@ -106,6 +120,14 @@
|
|||
|
||||
[draw]
|
||||
|
||||
[rectangle]
|
||||
x = 0
|
||||
y = 0
|
||||
w = "(width)"
|
||||
h = "(height)"
|
||||
fill_color = "255, 255, 255, 76"
|
||||
[/rectangle]
|
||||
|
||||
{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
|
||||
|
||||
[image]
|
||||
|
@ -127,7 +149,13 @@
|
|||
|
||||
[draw]
|
||||
|
||||
|
||||
[rectangle]
|
||||
x = 0
|
||||
y = 0
|
||||
w = "(width)"
|
||||
h = "(height)"
|
||||
fill_color = "255, 255, 255, 25"
|
||||
[/rectangle]
|
||||
|
||||
{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
|
||||
|
||||
|
@ -159,6 +187,14 @@
|
|||
|
||||
[draw]
|
||||
|
||||
[rectangle]
|
||||
x = 0
|
||||
y = 0
|
||||
w = "(width)"
|
||||
h = "(height)"
|
||||
fill_color = "255, 255, 255, 76"
|
||||
[/rectangle]
|
||||
|
||||
{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
|
||||
|
||||
[image]
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_height = 800
|
||||
|
||||
[linked_group]
|
||||
id = "filename"
|
||||
fixed_width = "true"
|
||||
|
@ -73,6 +75,7 @@
|
|||
border = "all"
|
||||
border_size = 5
|
||||
vertical_alignment = "top"
|
||||
horizontal_grow = "true"
|
||||
|
||||
[grid]
|
||||
|
||||
|
@ -177,33 +180,18 @@
|
|||
[grid]
|
||||
|
||||
[row]
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[label]
|
||||
id = "lblChoose"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Choose the game to load"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
border = "right"
|
||||
border_size = 10
|
||||
border = "all"
|
||||
border_size = 5
|
||||
vertical_alignment = "center"
|
||||
|
||||
[label]
|
||||
|
@ -216,8 +204,8 @@
|
|||
[/column]
|
||||
|
||||
[column]
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[text_box]
|
||||
id = "txtFilter"
|
||||
|
@ -346,45 +334,55 @@
|
|||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
horizontal_grow = "true"
|
||||
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[button]
|
||||
id = "delete"
|
||||
definition = "default"
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
size_text = _ "Delete"
|
||||
label = _ "Delete"
|
||||
[/button]
|
||||
[toggle_button]
|
||||
id = "change_difficulty"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Change difficulty"
|
||||
tooltip = _ "Change campaign difficulty before loading"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "right"
|
||||
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[button]
|
||||
id = "delete"
|
||||
definition = "default"
|
||||
|
||||
size_text = _ "Delete"
|
||||
label = _ "Delete"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[toggle_button]
|
||||
id = "change_difficulty"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Change difficulty"
|
||||
tooltip = _ "Change campaign difficulty before loading"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_height = 800
|
||||
|
||||
[linked_group]
|
||||
id = "race"
|
||||
fixed_width = "true"
|
||||
|
@ -46,137 +48,349 @@
|
|||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
vertical_grow = "true"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor=0
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
vertical_alignment = "top"
|
||||
|
||||
[grid]
|
||||
|
||||
[label]
|
||||
definition = "default"
|
||||
label= _ "Gender:"
|
||||
[/label]
|
||||
[/column]
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
vertical_grow = "true"
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "right"
|
||||
[label]
|
||||
id = "type_name"
|
||||
wrap = "true"
|
||||
[/label]
|
||||
|
||||
[toggle_button]
|
||||
id = "male_toggle"
|
||||
definition = "default"
|
||||
label= _ "Male"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "right"
|
||||
[/row]
|
||||
|
||||
[toggle_button]
|
||||
id = "female_toggle"
|
||||
definition = "default"
|
||||
label= _ "Female"
|
||||
[/toggle_button]
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "center"
|
||||
vertical_alignment = "center"
|
||||
|
||||
[image]
|
||||
id = "type_image"
|
||||
definition = "default"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "center"
|
||||
|
||||
[button]
|
||||
id = "type_profile"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Profile"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
horizontal_grow = "true"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
id = "type_level"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "center"
|
||||
|
||||
[image]
|
||||
id = "type_race"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "center"
|
||||
|
||||
[image]
|
||||
id = "type_alignment"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
vertical_grow = "true"
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
id = "type_details"
|
||||
definition = "default_small"
|
||||
wrap = "true"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
vertical_alignment = "center"
|
||||
|
||||
[label]
|
||||
definition = "default"
|
||||
label = _ "Filter"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[text_box]
|
||||
id = "filter_box"
|
||||
definition = "default"
|
||||
label = ""
|
||||
[/text_box]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[listbox]
|
||||
id = "unit_type_list"
|
||||
definition = "default"
|
||||
[header]
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[toggle_button]
|
||||
id = "sort_0"
|
||||
definition = "listbox_header"
|
||||
linked_group = "race"
|
||||
|
||||
label = _ "Race"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[toggle_button]
|
||||
id = "sort_1"
|
||||
definition = "listbox_header"
|
||||
linked_group = "unit_type"
|
||||
|
||||
label = _ "Type"
|
||||
[/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"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "race"
|
||||
definition = "default"
|
||||
linked_group = "race"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_type"
|
||||
definition = "default"
|
||||
linked_group = "unit_type"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/toggle_panel]
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/listbox]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
[grid]
|
||||
[row]
|
||||
grow_factor=0
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
definition = "default"
|
||||
label= _ "Gender:"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[toggle_button]
|
||||
id = "male_toggle"
|
||||
definition = "radio"
|
||||
label= _ "Male"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[toggle_button]
|
||||
id = "female_toggle"
|
||||
definition = "radio"
|
||||
label= _ "Female"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[listbox]
|
||||
id = "unit_type_list"
|
||||
definition = "default"
|
||||
[header]
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "race"
|
||||
definition = "default"
|
||||
linked_group = "race"
|
||||
label = _ "Race"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_type"
|
||||
definition = "default"
|
||||
linked_group = "unit_type"
|
||||
label = _ "Type"
|
||||
[/label]
|
||||
[/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"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "race"
|
||||
definition = "default"
|
||||
linked_group = "race"
|
||||
[/label]
|
||||
[/column]
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_type"
|
||||
definition = "default"
|
||||
linked_group = "unit_type"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/toggle_panel]
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/listbox]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
@ -214,8 +428,11 @@
|
|||
[/row]
|
||||
[/grid]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window]
|
||||
|
|
|
@ -132,8 +132,8 @@ victory_when_enemies_defeated=yes
|
|||
share_view=no
|
||||
shroud=no
|
||||
side=1
|
||||
team_name=1
|
||||
user_team_name=""
|
||||
team_id=1
|
||||
team_name=""
|
||||
[unit]
|
||||
canrecruit=no
|
||||
extra_recruit=""
|
||||
|
@ -884,8 +884,8 @@ victory_when_enemies_defeated=yes
|
|||
share_view=no
|
||||
shroud=no
|
||||
side=2
|
||||
team_name=2
|
||||
user_team_name=""
|
||||
team_id=2
|
||||
team_name=""
|
||||
[unit]
|
||||
canrecruit=no
|
||||
extra_recruit=""
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
type = Elvish Archer
|
||||
id=alice
|
||||
fog=yes
|
||||
team_name=West
|
||||
team_id=West
|
||||
share_vision=shroud
|
||||
[/side]
|
||||
[side]
|
||||
|
@ -30,7 +30,7 @@
|
|||
type = Orcish Grunt
|
||||
id=bob
|
||||
fog=yes
|
||||
team_name=East
|
||||
team_id=East
|
||||
share_vision=shroud
|
||||
[/side]
|
||||
[side]
|
||||
|
@ -40,7 +40,7 @@
|
|||
type = Dwarvish Fighter
|
||||
id=dave
|
||||
fog=yes
|
||||
team_name=East
|
||||
team_id=East
|
||||
share_vision=shroud
|
||||
[/side]
|
||||
[side]
|
||||
|
@ -50,7 +50,7 @@
|
|||
type = Chocobone
|
||||
id=charlie
|
||||
fog=yes
|
||||
team_name=West
|
||||
team_id=West
|
||||
share_vision=shroud
|
||||
[/side]
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
type = Elvish Archer
|
||||
id=alice
|
||||
fog=no
|
||||
team_name=West
|
||||
team_id=West
|
||||
[/side]
|
||||
[side]
|
||||
side=2
|
||||
|
@ -26,7 +26,7 @@
|
|||
type = Orcish Grunt
|
||||
id=bob
|
||||
fog=no
|
||||
team_name=East
|
||||
team_id=East
|
||||
[/side]
|
||||
[side]
|
||||
side=3
|
||||
|
@ -35,7 +35,7 @@
|
|||
type = Dwarvish Fighter
|
||||
id=dave
|
||||
fog=no
|
||||
team_name=East
|
||||
team_id=East
|
||||
[/side]
|
||||
[side]
|
||||
side=4
|
||||
|
@ -44,7 +44,7 @@
|
|||
type = Chocobone
|
||||
id=charlie
|
||||
fog=no
|
||||
team_name=West
|
||||
team_id=West
|
||||
[/side]
|
||||
|
||||
{EVENTS}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
type = Orcish Grunt
|
||||
id=bob
|
||||
fog=yes
|
||||
team_name=East
|
||||
team_id=East
|
||||
share_view={SHARE_VIEW}
|
||||
[/side]
|
||||
[side]
|
||||
|
@ -37,7 +37,7 @@
|
|||
type = Dwarvish Fighter
|
||||
id=dave
|
||||
fog=yes
|
||||
team_name=East
|
||||
team_id=East
|
||||
share_view={SHARE_VIEW}
|
||||
[/side]
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
type = Elvish Archer
|
||||
id=alice
|
||||
fog=no
|
||||
team_name=West
|
||||
team_id=West
|
||||
defeat_condition={DC1}
|
||||
{UNIT 1 "Elvish Fighter" 1 1 (id=t1)}
|
||||
[/side]
|
||||
|
@ -29,7 +29,7 @@
|
|||
type = Orcish Grunt
|
||||
id=bob
|
||||
fog=no
|
||||
team_name=East
|
||||
team_id=East
|
||||
defeat_condition={DC2}
|
||||
{UNIT 2 "Orcish Archer" 1 2 (id=t2)}
|
||||
[/side]
|
||||
|
@ -40,7 +40,7 @@
|
|||
type = Dwarvish Fighter
|
||||
id=dave
|
||||
fog=no
|
||||
team_name=East
|
||||
team_id=East
|
||||
defeat_condition={DC3}
|
||||
{UNIT 3 "Dwarvish Thunderer" 1 3 (id=t3)}
|
||||
[/side]
|
||||
|
@ -51,7 +51,7 @@
|
|||
type = Chocobone
|
||||
id=charlie
|
||||
fog=no
|
||||
team_name=West
|
||||
team_id=West
|
||||
defeat_condition={DC4}
|
||||
{UNIT 4 "Dark Adept" 1 4 (id=t4)}
|
||||
[/side]
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
type = Orcish Grunt
|
||||
id=bob
|
||||
fog=yes
|
||||
team_name=East
|
||||
team_id=East
|
||||
share_view=no
|
||||
[/side]
|
||||
[side]
|
||||
|
@ -36,7 +36,7 @@
|
|||
type = Dwarvish Fighter
|
||||
id=dave
|
||||
fog=yes
|
||||
team_name=East
|
||||
team_id=East
|
||||
share_view=no
|
||||
[/side]
|
||||
|
||||
|
|
22
data/tools/GUI.pyw
Executable file → Normal file
|
@ -67,10 +67,10 @@ def run_tool(tool,queue,command):
|
|||
si.dwFlags=subprocess.STARTF_USESHOWWINDOW|subprocess.SW_HIDE # to avoid showing a DOS prompt
|
||||
try:
|
||||
output=subprocess.check_output(' '.join(wrapped_line),stderr=subprocess.STDOUT,startupinfo=si,env=env)
|
||||
queue.put_nowait(output)
|
||||
queue.put_nowait(str(output, "utf8"))
|
||||
except subprocess.CalledProcessError as error:
|
||||
# post the precise message and the remaining output as a tuple
|
||||
queue.put_nowait((tool,error.returncode,error.output))
|
||||
queue.put_nowait((tool,error.returncode,str(error.output, "utf8")))
|
||||
else: # STARTUPINFO is not available, nor needed, outside of Windows
|
||||
queue.put_nowait(' '.join(command)+"\n")
|
||||
try:
|
||||
|
@ -1091,21 +1091,26 @@ wmllint will be run only on the Wesnoth core directory""")
|
|||
if self.wmlscope_tab.progress_variable.get():
|
||||
wmlscope_command_string.append("--progress")
|
||||
if self.wmlscope_tab.exclude_variable.get():
|
||||
wmlscope_command_string.append('--exclude="{0}"'.format(self.wmlscope_tab.exclude_regexp.get()))
|
||||
wmlscope_command_string.append("--exclude")
|
||||
wmlscope_command_string.append(self.wmlscope_tab.exclude_regexp.get())
|
||||
if self.wmlscope_tab.from_variable.get():
|
||||
wmlscope_command_string.append('--from="{0}"'.format(self.wmlscope_tab.from_regexp.get()))
|
||||
wmlscope_command_string.append("--from")
|
||||
wmlscope_command_string.append(self.wmlscope_tab.from_regexp.get())
|
||||
if self.wmlscope_tab.refcount_variable.get():
|
||||
try:
|
||||
wmlscope_command_string.append("--refcount=" + str(self.wmlscope_tab.refcount_number.get()))
|
||||
wmlscope_command_string.append("--refcount")
|
||||
wmlscope_command_string.append(str(self.wmlscope_tab.refcount_number.get()))
|
||||
except ValueError as error:
|
||||
# normally it should be impossible to raise this exception
|
||||
# due to the fact that the Spinbox is read-only
|
||||
showerror("Error","""You typed an invalid value. Value must be an integer in the range 0-999""")
|
||||
return
|
||||
if self.wmlscope_tab.typelist_variable.get():
|
||||
wmlscope_command_string.append('--typelist="{0}"'.format(self.wmlscope_tab.typelist_string.get()))
|
||||
wmlscope_command_string.append("--typelist")
|
||||
wmlscope_command_string.append(self.wmlscope_tab.typelist_string.get())
|
||||
if self.wmlscope_tab.force_variable.get():
|
||||
wmlscope_command_string.append('--force-used="{0}"'.format(self.wmlscope_tab.force_regexp.get()))
|
||||
wmlscope_command_string.append("--force-used")
|
||||
wmlscope_command_string.append(self.wmlscope_tab.force_regexp.get())
|
||||
wmlscope_command_string.append(WESNOTH_CORE_DIR)
|
||||
umc_dir=self.dir_variable.get()
|
||||
if os.path.exists(umc_dir): # add-on exists
|
||||
|
@ -1144,7 +1149,8 @@ wmlscope will be run only on the Wesnoth core directory""")
|
|||
for n in range(verbosity):
|
||||
wmlindent_command_string.append("-v")
|
||||
if self.wmlindent_tab.exclude_variable.get():
|
||||
wmlindent_command_string.append('--exclude="{0}"'.format(self.wmlindent_tab.regexp_variable.get()))
|
||||
wmlindent_command_string.append("--exclude")
|
||||
wmlindent_command_string.append(self.wmlindent_tab.regexp_variable.get())
|
||||
if self.wmlindent_tab.quiet_variable.get():
|
||||
wmlindent_command_string.append("--quiet")
|
||||
umc_dir=self.dir_variable.get()
|
||||
|
|
48
data/tools/wmlindent
Executable file → Normal file
|
@ -61,7 +61,7 @@ if there's an indent open at end of file or if a closer occurs with
|
|||
indent already zero; these two conditions strongly suggest unbalanced WML.
|
||||
"""
|
||||
|
||||
import sys, os, getopt, filecmp, re, codecs
|
||||
import sys, os, argparse, filecmp, re, codecs
|
||||
from wesnoth import wmltools3 as wmltools
|
||||
|
||||
closer_prefixes = ["{NEXT "]
|
||||
|
@ -271,26 +271,36 @@ def convertor(linefilter, arglist, exclude):
|
|||
os.rename(filename + ".out", filename)
|
||||
|
||||
if __name__ == '__main__':
|
||||
(options, arguments) = getopt.getopt(sys.argv[1:], "h?de:qv",
|
||||
['help', 'dryrun', 'exclude=', 'quiet', 'verbose'])
|
||||
verbose = 0
|
||||
quiet = False
|
||||
dryrun = False
|
||||
exclude = []
|
||||
for (opt, val) in options:
|
||||
if opt in ('-?', '-h', '--help'):
|
||||
print(__doc__)
|
||||
sys.exit(0)
|
||||
elif opt in ('-d', '--dryrun'):
|
||||
dryrun = True
|
||||
elif opt in ('-e', '--exclude'):
|
||||
exclude.append(val)
|
||||
elif opt in ('-q', '--quiet'):
|
||||
quiet = True
|
||||
elif opt in ('-v', '--verbose'):
|
||||
verbose += 1
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawTextHelpFormatter
|
||||
)
|
||||
parser.add_argument("-?", action="help",
|
||||
help="show this help message and exit") # original --help, -h and -? printed __doc__
|
||||
parser.add_argument("-d", "--dryrun", action="store_true",
|
||||
help="""detects and reports files that would be changed without
|
||||
changing them.""")
|
||||
parser.add_argument("-v", "--verbose", action="count", default=0,
|
||||
help="""-v enables reporting files that are changed.
|
||||
-v -v unchanged files are also reported.""")
|
||||
parser.add_argument("-e", "--exclude", action="append", default=[],
|
||||
help="takes a regexp and excludes files matching it.")
|
||||
parser.add_argument("-q", "--quiet", action="store_true",
|
||||
help="Do not generate output") # TODO: improve description?
|
||||
parser.add_argument("files", action="store", nargs="*",
|
||||
help="""Any number of files or directories.
|
||||
Call with no arguments to filter WML on stdin to
|
||||
reindented WML on stdout.""")
|
||||
|
||||
namespace = parser.parse_args()
|
||||
verbose = namespace.verbose
|
||||
quiet = namespace.quiet
|
||||
dryrun = namespace.dryrun
|
||||
exclude = namespace.exclude
|
||||
arguments = namespace.files # a remnant of getopt...
|
||||
|
||||
if dryrun:
|
||||
verbose = max(1, verbose)
|
||||
|
||||
# in certain situations, Windows' command prompt appends a double quote
|
||||
# to the command line parameters. This block takes care of this issue.
|
||||
for i,arg in enumerate(arguments):
|
||||
|
|
148
data/tools/wmllint
Executable file → Normal file
|
@ -181,7 +181,7 @@
|
|||
# code.
|
||||
#
|
||||
|
||||
import sys, os, re, getopt, string, copy, difflib, time, gzip, codecs
|
||||
import sys, os, re, argparse, string, copy, difflib, time, gzip, codecs
|
||||
from wesnoth.wmltools3 import *
|
||||
from wesnoth.wmliterator3 import *
|
||||
|
||||
|
@ -2600,100 +2600,64 @@ def allcfgfiles(directory):
|
|||
datafiles.sort() # So diffs for same campaigns will cluster in reports
|
||||
return map(os.path.normpath, datafiles)
|
||||
|
||||
def help():
|
||||
print("""\
|
||||
Usage: wmllint [options] [dir]
|
||||
Convert Battle of Wesnoth WML from older versions to newer ones.
|
||||
Also validates WML to check for errors.
|
||||
|
||||
Takes any number of directories as arguments. Each directory is converted.
|
||||
If no directories are specified, acts on the current directory.
|
||||
|
||||
Mode options:
|
||||
Changes wmllint from default conversion mode. Only one mode can be chosen.
|
||||
-h, --help Emit this help message and quit.
|
||||
-d, --dryrun List changes (-v) but don't perform them.
|
||||
-c, --clean Clean up -bak files.
|
||||
-D, --diff Display diffs between converted and unconverted
|
||||
files.
|
||||
-r, --revert Revert the conversion from the -bak files.
|
||||
|
||||
Other options:
|
||||
-v, --verbose -v lists changes.
|
||||
-v -v names each file before it's processed.
|
||||
-v -v -v shows verbose parse details.
|
||||
-m, --missing Don't warn about tags without side= keys now
|
||||
applying to all sides.
|
||||
-s, --stripcr Convert DOS-style CR/LF to Unix-style LF.
|
||||
-K, --known Suppress check for unknown unit types, recruits,
|
||||
races, scenarios, etc.
|
||||
-S, --nospellcheck Suppress spellchecking
|
||||
-Z, --stringfreeze Suppress repair attempts of newlines in messages
|
||||
|
||||
For more about wmllint, including how to prevent unwanted conversions and false
|
||||
positive warnings with magic comments, read the introduction in the wmllint
|
||||
file itself. See also: http://wiki.wesnoth.org/Maintenance_tools.""", file=sys.stderr)
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
(options, arguments) = getopt.getopt(sys.argv[1:], "cdDhmnrsvKSZ", [
|
||||
"clean",
|
||||
"diffs",
|
||||
"dryrun",
|
||||
"help",
|
||||
"missing",
|
||||
"revert",
|
||||
"stripcr",
|
||||
"verbose",
|
||||
"known",
|
||||
"nospellcheck",
|
||||
"stringfreeze",
|
||||
])
|
||||
# -f --future has been removed; there have been no experimental conversions since 1.4
|
||||
# -p --progress has been removed; similar to existing -v -v
|
||||
except getopt.GetoptError:
|
||||
help()
|
||||
print('\nAn option you have entered is invalid. Review options and try again.', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
clean = False
|
||||
diffs = False
|
||||
dryrun = False
|
||||
missingside = True
|
||||
revert = False
|
||||
stringfreeze = False
|
||||
stripcr = False
|
||||
verbose = 0
|
||||
dospellcheck = True
|
||||
inconsistency = False
|
||||
for (switch, val) in options:
|
||||
if switch in ('-h', '--help'):
|
||||
help()
|
||||
sys.exit(0)
|
||||
elif switch in ('-c', '--clean'):
|
||||
clean = True
|
||||
elif switch in ('-d', '--dryrun'):
|
||||
dryrun = True
|
||||
elif switch in ('-D', '--diffs'):
|
||||
diffs = True
|
||||
elif switch in ('-m', '--missing'):
|
||||
missingside = False
|
||||
elif switch in ('-r', '--revert'):
|
||||
revert = True
|
||||
elif switch in ('-s', '--stripcr'):
|
||||
stripcr = True
|
||||
elif switch in ('-Z', '--stringfreeze'):
|
||||
stringfreeze = True
|
||||
elif switch in ('-v', '--verbose'):
|
||||
verbose += 1
|
||||
elif switch in ('-S', '--nospellcheck'):
|
||||
dospellcheck = False
|
||||
elif switch in ('-K', '--known'):
|
||||
inconsistency = True
|
||||
parser = argparse.ArgumentParser(
|
||||
description = '''Convert Battle of Wesnoth WML from older versions to newer ones.
|
||||
Also validates WML to check for errors.''',
|
||||
epilog = '''For more about wmllint, including how to prevent unwanted conversions and false
|
||||
positive warnings with magic comments, read the introduction in the wmllint
|
||||
file itself.
|
||||
See also: http://wiki.wesnoth.org/Maintenance_tools.''',
|
||||
formatter_class = argparse.RawTextHelpFormatter
|
||||
)
|
||||
|
||||
mode = parser.add_mutually_exclusive_group()
|
||||
mode.add_argument("-c", "--clean", action="store_true",
|
||||
help="Clean up -bak files.")
|
||||
mode.add_argument("-D", "--diffs", action="store_true",
|
||||
help="Display diffs between converted and unconverted files.")
|
||||
mode.add_argument("-d", "--dryrun", action="store_true",
|
||||
help="List changes (-v) but don't perform them.")
|
||||
mode.add_argument("-r", "--revert", action="store_true",
|
||||
help="Revert the conversion from the -bak files.")
|
||||
parser.add_argument("-m", "--missing", action="store_true",
|
||||
help="""Don't warn about tags without side= keys now applying
|
||||
to all sides.""")
|
||||
parser.add_argument("-s", "--stripcr", action="store_true",
|
||||
help="Convert DOS-style CR/LF to Unix-style LF.")
|
||||
parser.add_argument("-v", "--verbose", action="count", default=0,
|
||||
help="""-v lists changes.
|
||||
-v -v names each file before it's processed.
|
||||
-v -v -v shows verbose parse details.""")
|
||||
parser.add_argument("-K", "--known", action="store_true",
|
||||
help="""Suppress check for unknown unit types, recruits, races,
|
||||
scenarios, etc.""")
|
||||
parser.add_argument("-S", "--nospellcheck", action="store_false",
|
||||
help="Suppress spellchecking")
|
||||
parser.add_argument("-Z", "--stringfreeze", action="store_true",
|
||||
help="Suppress repair attempts of newlines in messages")
|
||||
# -f --future has been removed; there have been no experimental conversions since 1.4
|
||||
# -p --progress has been removed; similar to existing -v -v
|
||||
parser.add_argument("directories", action="store", nargs="*",
|
||||
help="""Any number of directories. Each directory is converted.
|
||||
If no directories are specified, acts on the current
|
||||
directory.""")
|
||||
|
||||
namespace = parser.parse_args()
|
||||
clean = namespace.clean
|
||||
diffs = namespace.diffs
|
||||
dryrun = namespace.dryrun
|
||||
missingside = namespace.missing
|
||||
revert = namespace.revert
|
||||
stringfreeze = namespace.stringfreeze
|
||||
stripcr = namespace.stripcr
|
||||
verbose = namespace.verbose
|
||||
dospellcheck = namespace.nospellcheck # WARNING! We store the opposite of the value needed!
|
||||
inconsistency = namespace.known
|
||||
arguments = namespace.directories # a remnant of getopt...
|
||||
|
||||
if dryrun:
|
||||
verbose = max(1, verbose)
|
||||
if clean and revert:
|
||||
print("wmllint: can't do clean and revert together.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
post15 = False
|
||||
|
||||
|
|
134
data/tools/wmlscope
Executable file → Normal file
|
@ -93,7 +93,7 @@
|
|||
#
|
||||
# sets the warning level.
|
||||
|
||||
import sys, os, time, re, getopt, hashlib, glob, codecs
|
||||
import sys, os, time, re, argparse, hashlib, glob, codecs
|
||||
from wesnoth.wmltools3 import *
|
||||
|
||||
def interpret(lines, css):
|
||||
|
@ -365,91 +365,59 @@ class CrossRefLister(CrossRef):
|
|||
fp.write(outstr)
|
||||
|
||||
if __name__ == "__main__":
|
||||
def help():
|
||||
print("""\
|
||||
Usage: wmlscope [options] dirpath
|
||||
Options may be any of these:
|
||||
-h, --help Emit this help message and quit
|
||||
-c, --crossreference Report resolved macro references (implies -w 1)
|
||||
-C, --collisions Report duplicate resource files
|
||||
-d, --definitions Make definition list
|
||||
-e regexp, --exclude regexp Ignore files matching the specified regular expression
|
||||
-f regexp, --from regexp Report only on things defined in files matching regexp
|
||||
-l, --listfiles List files that will be processed
|
||||
-r ddd, --refcount=ddd Report only on macros w/references in ddd files
|
||||
-t fname, --typelist fname List actual & formal argtypes for calls in fname
|
||||
-u, --unresolved Report unresolved macro references
|
||||
-w, --warnlevel Set to 1 to warn of duplicate macro definitions
|
||||
--force-used regexp Ignore refcount 0 on names matching regexp
|
||||
--extracthelp Extract help from macro definition comments.
|
||||
--unchecked Report all macros with untyped formals.
|
||||
Options may be followed by any number of directiories to check. If no
|
||||
directories are given, all files under the current directory are checked.
|
||||
""", file=sys.stderr)
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-c", "--crossreference", action="store_true",
|
||||
help="Report resolved macro references (implies -w 1)")
|
||||
parser.add_argument("-C", "--collisions", action="store_true",
|
||||
help="Report duplicate resource files")
|
||||
parser.add_argument("-d", "--definitions", action="store_true",
|
||||
help="Make definition list")
|
||||
parser.add_argument("-e", "--exclude", action="append", default = [],
|
||||
help="Ignore files matching the specified regular expression")
|
||||
parser.add_argument("-f", "--from", action="store", dest="from_", metavar="FROM", # from is a keyword
|
||||
help="Report only on things defined in files matching regexp")
|
||||
parser.add_argument("-l", "--listfiles", action="store_true",
|
||||
help="List files that will be processed")
|
||||
parser.add_argument("-r", "--refcount", action="store", type=int, # convert to int, defaults to None
|
||||
help="Report only on macros w/references in ddd files")
|
||||
parser.add_argument("-t", "--typelist", action="store",
|
||||
help="List actual & formal argtypes for calls in fname")
|
||||
parser.add_argument("-u", "--unresolved", action="store_true",
|
||||
help="Report unresolved macro references")
|
||||
parser.add_argument("-w", "--warnlevel", action="store", type=int, default=0,
|
||||
help="Set to 1 to warn of duplicate macro definitions")
|
||||
# this option was never listed before...
|
||||
parser.add_argument("-p", "--progress", action="store_true",
|
||||
help="Show progress") # TODO: improve description
|
||||
# no short options for these
|
||||
parser.add_argument("--force-used", action="append", dest="forceused", default = [],
|
||||
help="Ignore refcount 0 on names matching regexp")
|
||||
parser.add_argument("--extracthelp", action="store_true",
|
||||
help="Extract help from macro definition comments.")
|
||||
parser.add_argument("--unchecked", action="store_true",
|
||||
help="Report all macros with untyped formals.")
|
||||
parser.add_argument("directories", action="store", nargs="*",
|
||||
help="""Any number of directiories to check. If no
|
||||
directories are given, all files under the current directory are checked.""")
|
||||
namespace = parser.parse_args()
|
||||
|
||||
try:
|
||||
# Process options
|
||||
(options, arguments) = getopt.getopt(sys.argv[1:], "cCdhe:f:lpr:t:uw:",
|
||||
[
|
||||
'crossreference',
|
||||
'collisions',
|
||||
'definitions',
|
||||
'exclude=',
|
||||
'extracthelp',
|
||||
'force-used=',
|
||||
'from=',
|
||||
'help',
|
||||
'listfiles',
|
||||
'progress',
|
||||
'refcount=',
|
||||
'typelist=',
|
||||
'unchecked',
|
||||
'unresolved',
|
||||
'warnlevel=',
|
||||
])
|
||||
crossreference = definitions = listfiles = unresolved = extracthelp = False
|
||||
from_restrict = None
|
||||
refcount_restrict = None
|
||||
forceused = []
|
||||
exclude = []
|
||||
warnlevel = 0
|
||||
collisions = False
|
||||
typelist = None
|
||||
unchecked = False
|
||||
progress = False
|
||||
for (switch, val) in options:
|
||||
if switch in ('-h', '--help'):
|
||||
help()
|
||||
sys.exit(0)
|
||||
if switch in ('-f', '--from'):
|
||||
from_restrict = val
|
||||
elif switch in ('-c', '--crossreference'):
|
||||
crossreference = True
|
||||
warnlevel = 1
|
||||
elif switch in ('-C', '--collisions'):
|
||||
collisions = True
|
||||
elif switch in ('-d', '--definitions'):
|
||||
definitions = True
|
||||
elif switch in ('-e', '--exclude'):
|
||||
exclude.append(val)
|
||||
elif switch == '--extracthelp':
|
||||
extracthelp = True
|
||||
elif switch == '--force-used':
|
||||
forceused.append(val)
|
||||
elif switch in ('-l', '--listfiles'):
|
||||
listfiles = True
|
||||
elif switch in ('-p', '--progress'):
|
||||
progress = True
|
||||
elif switch in ('-r', '--refcount'):
|
||||
refcount_restrict = int(val)
|
||||
elif switch == '--unchecked':
|
||||
unchecked = True
|
||||
elif switch in ('-t', '--typelist'):
|
||||
typelist = val
|
||||
elif switch in ('-u', '--unresolved'):
|
||||
unresolved = True
|
||||
elif switch in ('-w', '--warnlevel'):
|
||||
warnlevel = int(val)
|
||||
crossreference = namespace.crossreference
|
||||
collisions = namespace.collisions
|
||||
definitions = namespace.definitions
|
||||
exclude = namespace.exclude
|
||||
from_restrict = namespace.from_
|
||||
extracthelp = namespace.extracthelp
|
||||
listfiles = namespace.listfiles
|
||||
refcount_restrict = namespace.refcount
|
||||
typelist = namespace.typelist
|
||||
unresolved = namespace.unresolved
|
||||
warnlevel = 1 if crossreference else namespace.warnlevel
|
||||
forceused = namespace.forceused
|
||||
unchecked = namespace.unchecked
|
||||
progress = namespace.progress
|
||||
arguments = namespace.directories # a remnant of getopt...
|
||||
|
||||
# in certain situations, Windows' command prompt appends a double quote
|
||||
# to the command line parameters. This block takes care of this issue.
|
||||
|
|
BIN
images/icons/alignments/alignment_chaotic_30.png
Normal file
After Width: | Height: | Size: 401 B |
BIN
images/icons/alignments/alignment_lawful_30.png
Normal file
After Width: | Height: | Size: 667 B |
BIN
images/icons/alignments/alignment_liminal_30.png
Normal file
After Width: | Height: | Size: 316 B |
BIN
images/icons/alignments/alignment_neutral_30.png
Normal file
After Width: | Height: | Size: 515 B |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 68 KiB |
28
l10n-track
|
@ -27,8 +27,6 @@ ok ¦data/core/images/maps/l10n/de/titlescreen--overlay.png¦ c6a61abdc0
|
|||
ok ¦data/core/images/maps/l10n/de/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
|
||||
# en@shaw
|
||||
ok ¦data/core/images/misc/l10n/en@shaw/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/en@shaw/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# es
|
||||
ok ¦data/campaigns/The_Rise_Of_Wesnoth/images/story/l10n/es/trow-logo.png¦ 591ed63c8eac31ea6549848dbed29143 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
@ -36,8 +34,6 @@ ok ¦data/core/images/help/l10n/es/hpxp.png¦ 62a5f259d2d924792e594bf344
|
|||
ok ¦data/core/images/help/l10n/es/recruit.png¦ 71f948f0d3c00d80291a98d7606f142d d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/help/l10n/es/tooltip.png¦ f712aa35b556f227e7bd2383bca814bf d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/maps/l10n/es/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/es/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/es/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# fr
|
||||
ok ¦data/campaigns/The_Rise_Of_Wesnoth/images/story/l10n/fr/trow-logo.png¦ 591ed63c8eac31ea6549848dbed29143 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
@ -45,8 +41,6 @@ ok ¦data/core/images/help/l10n/fr/hpxp.png¦ 62a5f259d2d924792e594bf344
|
|||
ok ¦data/core/images/help/l10n/fr/recruit.png¦ 71f948f0d3c00d80291a98d7606f142d d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/help/l10n/fr/tooltip.png¦ f712aa35b556f227e7bd2383bca814bf d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/maps/l10n/fr/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/fr/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/fr/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# gd
|
||||
ok ¦data/campaigns/An_Orcish_Incursion/images/maps/l10n/gd/aoi--overlay.png¦ 566caef8841ce7ea42b49e436230f6bb a3b14e767064ba27b97a9a316da9301d88e64b0
|
||||
|
@ -55,8 +49,6 @@ ok ¦data/campaigns/Northern_Rebirth/images/maps/l10n/gd/nr--overlay.png
|
|||
ok ¦data/campaigns/The_South_Guard/images/maps/l10n/gd/tsg--overlay.png¦ b6794ada1484eef485bbede267d8f1d0 bbace6d70c9021bea33fd06eb40ae5c793099d2
|
||||
ok ¦data/core/images/maps/l10n/gd/titlescreen--overlay.png¦ c6a61abdc02a22a1279d6e86d2d988d0 bbace6d70c9021bea33fd06eb40ae5c793099d2
|
||||
ok ¦data/core/images/maps/l10n/gd/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/gd/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/gd/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# gl
|
||||
ok ¦data/campaigns/An_Orcish_Incursion/images/maps/l10n/gl/aoi--overlay.png¦ 566caef8841ce7ea42b49e436230f6bb a3b14e767064ba27b97a9a316da9301d88e64b0
|
||||
|
@ -75,14 +67,10 @@ ok ¦data/core/images/help/l10n/gl/hpxp.png¦ 62a5f259d2d924792e594bf344
|
|||
ok ¦data/core/images/help/l10n/gl/recruit.png¦ 71f948f0d3c00d80291a98d7606f142d d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/help/l10n/gl/tooltip.png¦ f712aa35b556f227e7bd2383bca814bf d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/maps/l10n/gl/titlescreen--overlay.png¦ c6a61abdc02a22a1279d6e86d2d988d0 bbace6d70c9021bea33fd06eb40ae5c793099d2
|
||||
ok ¦data/core/images/misc/l10n/gl/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/gl/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# hu
|
||||
ok ¦data/campaigns/The_Rise_Of_Wesnoth/images/story/l10n/hu/trow-logo.png¦ 591ed63c8eac31ea6549848dbed29143 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
ok ¦data/core/images/maps/l10n/hu/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/hu/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/hu/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# it
|
||||
ok ¦data/core/images/help/l10n/it/hpxp.png¦ 62a5f259d2d924792e594bf3445020c7 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
|
@ -93,8 +81,6 @@ ok ¦data/core/images/maps/l10n/it/wesnoth--overlay.png¦ f03a2a4cc8cbb9
|
|||
# la
|
||||
ok ¦data/campaigns/The_Rise_Of_Wesnoth/images/story/l10n/la/trow-logo.png¦ 591ed63c8eac31ea6549848dbed29143 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
ok ¦data/core/images/maps/l10n/la/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/la/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/la/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# lt
|
||||
ok ¦data/campaigns/An_Orcish_Incursion/images/maps/l10n/lt/aoi--overlay.png¦ 566caef8841ce7ea42b49e436230f6bb a3b14e767064ba27b97a9a316da9301d88e64b0
|
||||
|
@ -104,13 +90,9 @@ ok ¦data/campaigns/Northern_Rebirth/images/maps/l10n/lt/nr--overlay.png
|
|||
ok ¦data/campaigns/The_Rise_Of_Wesnoth/images/story/l10n/lt/trow-logo.png¦ 591ed63c8eac31ea6549848dbed29143 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
ok ¦data/campaigns/The_South_Guard/images/maps/l10n/lt/tsg--overlay.png¦ b6794ada1484eef485bbede267d8f1d0 bbace6d70c9021bea33fd06eb40ae5c793099d2
|
||||
ok ¦data/core/images/maps/l10n/lt/titlescreen--overlay.png¦ c6a61abdc02a22a1279d6e86d2d988d0 bbace6d70c9021bea33fd06eb40ae5c793099d2
|
||||
ok ¦data/core/images/misc/l10n/lt/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/lt/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# nl
|
||||
ok ¦data/campaigns/The_Rise_Of_Wesnoth/images/story/l10n/nl/trow-logo.png¦ 591ed63c8eac31ea6549848dbed29143 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
ok ¦data/core/images/misc/l10n/nl/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/nl/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# pt
|
||||
ok ¦data/campaigns/An_Orcish_Incursion/images/maps/l10n/pt/aoi--overlay.png¦ 566caef8841ce7ea42b49e436230f6bb a3b14e767064ba27b97a9a316da9301d88e64b0
|
||||
|
@ -133,8 +115,6 @@ ok ¦data/core/images/help/l10n/pt/recruit.png¦ 71f948f0d3c00d80291a98d
|
|||
ok ¦data/core/images/help/l10n/pt/tooltip.png¦ f712aa35b556f227e7bd2383bca814bf d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/maps/l10n/pt/titlescreen--overlay.png¦ c6a61abdc02a22a1279d6e86d2d988d0 bbace6d70c9021bea33fd06eb40ae5c793099d2
|
||||
ok ¦data/core/images/maps/l10n/pt/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/pt/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/pt/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# ru
|
||||
ok ¦data/core/images/maps/l10n/ru/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
|
@ -148,8 +128,6 @@ ok ¦data/core/images/help/l10n/sk/tooltip.png¦ f712aa35b556f227e7bd238
|
|||
ok ¦data/core/images/lobby/l10n/sr/sort-az-off.png¦ 89ce53a0dbc82ada087de1f8b7bc3729 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/lobby/l10n/sr/sort-az.png¦ 959745325606642eb4e22b2356328641 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/maps/l10n/sr/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/sr/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/sr/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# sr@ijekavian
|
||||
ok ¦data/core/images/maps/l10n/sr@ijekavian/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
|
@ -159,18 +137,12 @@ ok ¦data/core/images/maps/l10n/sr@ijekavianlatin/wesnoth--overlay.png¦
|
|||
|
||||
# sr@latin
|
||||
ok ¦data/core/images/maps/l10n/sr@latin/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/sr@latin/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/sr@latin/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# vi
|
||||
ok ¦data/campaigns/The_Rise_Of_Wesnoth/images/story/l10n/vi/trow-logo.png¦ 591ed63c8eac31ea6549848dbed29143 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
ok ¦data/core/images/help/l10n/vi/hpxp.png¦ 62a5f259d2d924792e594bf3445020c7 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/help/l10n/vi/recruit.png¦ 71f948f0d3c00d80291a98d7606f142d d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/help/l10n/vi/tooltip.png¦ f712aa35b556f227e7bd2383bca814bf d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/vi/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/vi/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
||||
# zh_CN
|
||||
ok ¦data/core/images/maps/l10n/zh_CN/wesnoth--overlay.png¦ f03a2a4cc8cbb9fcaf48593289e3e5c4 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦data/core/images/misc/l10n/zh_CN/logo.png¦ f109b391406d55b33ab1f6bb96b33336 d5fa4bc7b25ae115d23070c04970dec7f66baf3
|
||||
ok ¦images/misc/l10n/zh_CN/logo.png¦ f109b391406d55b33ab1f6bb96b33336 0d5aa46e7435d9c5bf2944bb447c9ac6b2f1c0a
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
;Variables
|
||||
|
||||
Var StartMenuFolder
|
||||
!define UserdataFlags "'--config-dir Wesnoth%version_major'"
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
@ -146,14 +145,14 @@ Function StartMenuShortcuts
|
|||
|
||||
; Create shortcuts
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Battle for Wesnoth.lnk" "$INSTDIR\wesnoth.exe" ${UserdataFlags}
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Battle for Wesnoth (with console).lnk" "$INSTDIR\cwesnoth.cmd" ${UserdataFlags} "$INSTDIR\wesnoth.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Battle for Wesnoth.lnk" "$INSTDIR\wesnoth.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Battle for Wesnoth (with console).lnk" "$INSTDIR\cwesnoth.cmd" "" "$INSTDIR\wesnoth.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Manual.lnk" "$INSTDIR\manual\manual.$(LCode).html"
|
||||
|
||||
${If} ${IsNT}
|
||||
${AndIf} ${AtMostWin7}
|
||||
; Win7 or lower has collapsed start menu folders, activate additional shortcuts.
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Map editor.lnk" "$INSTDIR\wesnoth.exe" "-e ${UserdataFlags}" "$INSTDIR\wesnoth_editor-icon.ico"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Map editor.lnk" "$INSTDIR\wesnoth.exe" "-e" "$INSTDIR\wesnoth_editor-icon.ico"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Changelog.lnk" "$INSTDIR\changelog.txt"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Player's changelog.lnk" "$INSTDIR\players_changelog.txt"
|
||||
|
|
|
@ -21,7 +21,7 @@ Version 1.13.1+dev:
|
|||
erroneous textdomain declarations (bug #23839).
|
||||
|
||||
* Music and sound effects:
|
||||
* New dwarf hit and die sounds.
|
||||
* New sounds: dwarf hit and die, ink, mud fist and glob.
|
||||
|
||||
* User interface:
|
||||
* Added a version dialog button to the title screen, replacing the Paths
|
||||
|
@ -32,9 +32,16 @@ Version 1.13.1+dev:
|
|||
this using the above interface.
|
||||
|
||||
* Miscellaneous and bug fixes:
|
||||
* Made Documents\My Games\WesnothX.Y the default user config+data dir on
|
||||
Windows to replace the broken <current working dir>\userdata default that
|
||||
has never been acceptable practice. Portable installs are now required to
|
||||
explicitly use . or .. (e.g. `--config-dir .\userdata`) to force the
|
||||
user config+data dir path to be relative to the current working dir (see
|
||||
also bug #23753).
|
||||
* Fixed OOS on random maps, where clients placed sides in different castles.
|
||||
* Fixed possibility of corrupting saved games in certain instances,
|
||||
eg if an add-on tries to set an invalid variable
|
||||
* Enhanced tab completion in text boxes for easier whispers answer.
|
||||
|
||||
|
||||
Version 1.13.1:
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<Add option="-DHAVE_LIBPNG" />
|
||||
<Add option="-D_WIN32_WINDOWS" />
|
||||
<Add option="-D_WIN32_WINNT=0x0501" />
|
||||
<Add option="-DDWINVER=0x0501" />
|
||||
<Add option="-D_WIN32_IE=0x0501" />
|
||||
<Add directory="../../src" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -101,9 +98,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
|
|
@ -32,12 +32,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -97,12 +91,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
@ -161,12 +149,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -226,12 +208,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
|
|
@ -31,12 +31,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -104,12 +98,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
@ -177,12 +165,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -250,12 +232,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
|
|
@ -33,12 +33,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -116,12 +110,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
@ -207,12 +195,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -288,12 +270,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -371,12 +347,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
@ -464,12 +434,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
|
|
@ -33,12 +33,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -111,12 +105,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
@ -190,12 +178,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -268,12 +250,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
|
|
@ -32,12 +32,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -98,12 +92,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
@ -162,12 +150,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
|
@ -228,12 +210,6 @@
|
|||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
|
|
|
@ -1351,7 +1351,7 @@ set(schema_generator_SRC
|
|||
tools/schema/sourceparser.cpp
|
||||
tools/schema/error_container.cpp
|
||||
tools/schema/tag.cpp
|
||||
filesystem.cpp
|
||||
filesystem_boost.cpp
|
||||
filesystem_common.cpp
|
||||
loadscreen_empty.cpp
|
||||
)
|
||||
|
@ -1373,7 +1373,7 @@ set(schema_validator_SRC
|
|||
serialization/validator.cpp
|
||||
tools/dummy_video.cpp
|
||||
tools/schema/tag.cpp
|
||||
filesystem.cpp
|
||||
filesystem_boost.cpp
|
||||
filesystem_common.cpp
|
||||
config_cache.cpp
|
||||
utils/sha1.cpp
|
||||
|
|
|
@ -1362,12 +1362,12 @@ private:
|
|||
|
||||
void display_label(const map_location& location, const std::string& text) const {
|
||||
display* gui = display::get_singleton();
|
||||
std::string team_name;
|
||||
std::string team_id;
|
||||
|
||||
SDL_Color color = int_to_color(team::get_side_rgb(ai_.get_side()));
|
||||
|
||||
const terrain_label *res;
|
||||
res = gui->labels().set_label(location, text, ai_.get_side() - 1, team_name, color);
|
||||
res = gui->labels().set_label(location, text, ai_.get_side() - 1, team_id, color);
|
||||
if (res && resources::recorder)
|
||||
resources::recorder->add_label(res);
|
||||
}
|
||||
|
|
|
@ -52,12 +52,12 @@ static lg::log_domain log_ai_testing_ca_global_fallback("ai/ca/global_fallback")
|
|||
static void display_label(int /*side*/, const map_location& location, const std::string& text, bool surrounded)
|
||||
{
|
||||
display* gui = display::get_singleton();
|
||||
std::string team_name;
|
||||
std::string team_id;
|
||||
|
||||
SDL_Color color = int_to_color(team::get_side_rgb(surrounded ? 2 : 1 ) );//@fixme: for tests
|
||||
|
||||
const terrain_label *res;
|
||||
res = gui->labels().set_label(location, text, surrounded, team_name, color);
|
||||
res = gui->labels().set_label(location, text, surrounded, team_id, color);
|
||||
if (res && resources::recorder)
|
||||
resources::recorder->add_label(res);
|
||||
}
|
||||
|
|
108
src/dialogs.cpp
|
@ -897,114 +897,6 @@ void save_preview_pane::draw_contents()
|
|||
|
||||
} // end anon namespace
|
||||
|
||||
std::string load_game_dialog(display& disp, const config& game_config, bool* select_difficulty, bool* show_replay, bool* cancel_orders)
|
||||
{
|
||||
std::vector<savegame::save_info> games;
|
||||
{
|
||||
cursor::setter cur(cursor::WAIT);
|
||||
games = savegame::get_saves_list();
|
||||
}
|
||||
|
||||
if(games.empty()) {
|
||||
gui2::show_transient_message(disp.video(),
|
||||
_("No Saved Games"),
|
||||
_("There are no saved games to load.\n\n(Games are saved automatically when you complete a scenario)"));
|
||||
return "";
|
||||
}
|
||||
|
||||
const events::event_context context;
|
||||
|
||||
std::vector<std::string> items;
|
||||
std::ostringstream heading;
|
||||
heading << HEADING_PREFIX << _("Name") << COLUMN_SEPARATOR << _("Date");
|
||||
items.push_back(heading.str());
|
||||
std::vector<savegame::save_info>::const_iterator i;
|
||||
for(i = games.begin(); i != games.end(); ++i) {
|
||||
std::string name = i->name();
|
||||
utf8::truncate(name, 40); // truncate only acts if the name is longer
|
||||
|
||||
std::ostringstream str;
|
||||
str << name << COLUMN_SEPARATOR << util::format_time_summary(i->modified());
|
||||
|
||||
items.push_back(str.str());
|
||||
}
|
||||
|
||||
gamemap map_obj(boost::make_shared<terrain_type_data>(game_config), "");
|
||||
|
||||
|
||||
gui::dialog lmenu(disp,
|
||||
_("Load Game"),
|
||||
"", gui::NULL_DIALOG);
|
||||
lmenu.set_basic_behavior(gui::OK_CANCEL);
|
||||
|
||||
gui::menu::basic_sorter sorter;
|
||||
sorter.set_alpha_sort(0).set_id_sort(1);
|
||||
lmenu.set_menu(items, &sorter);
|
||||
|
||||
gui::filter_textbox* filter = new gui::filter_textbox(disp.video(), _("Filter: "), items, items, 1, lmenu);
|
||||
lmenu.set_textbox(filter);
|
||||
|
||||
gui::dialog_button* change_difficulty_option = NULL;
|
||||
|
||||
if(select_difficulty != NULL) {
|
||||
// implementation of gui::dialog::add_option, needed for storing a pointer to the option-box
|
||||
change_difficulty_option = new gui::dialog_button(disp.video(), _("Change difficulty"), gui::button::TYPE_CHECK);
|
||||
change_difficulty_option->set_check(false);
|
||||
|
||||
change_difficulty_option->set_help_string(_("Change campaign difficulty before loading"));
|
||||
lmenu.add_button(change_difficulty_option, gui::dialog::BUTTON_CHECKBOX);
|
||||
}
|
||||
|
||||
save_preview_pane save_preview(disp.video(),game_config,&map_obj,games,*filter,change_difficulty_option);
|
||||
lmenu.add_pane(&save_preview);
|
||||
// create an option for whether the replay should be shown or not
|
||||
if(show_replay != NULL) {
|
||||
lmenu.add_option(_("Show replay"), false,
|
||||
gui::dialog::BUTTON_CHECKBOX_LEFT,
|
||||
_("Play the embedded replay from the saved game if applicable")
|
||||
);
|
||||
}
|
||||
if(cancel_orders != NULL) {
|
||||
lmenu.add_option(_("Cancel orders"), false,
|
||||
gui::dialog::BUTTON_CHECKBOX_LEFT,
|
||||
_("Cancel any pending unit movements in the saved game")
|
||||
);
|
||||
}
|
||||
lmenu.add_button(new gui::standard_dialog_button(disp.video(),_("OK"),0,false), gui::dialog::BUTTON_STANDARD);
|
||||
lmenu.add_button(new gui::standard_dialog_button(disp.video(),_("Cancel"),1,true), gui::dialog::BUTTON_STANDARD);
|
||||
|
||||
delete_save save_deleter(disp,*filter,games);
|
||||
gui::dialog_button_info delete_button(&save_deleter,_("Delete Save"));
|
||||
|
||||
lmenu.add_button(delete_button,
|
||||
// Beware load screen glitches at low res!
|
||||
gui::dialog::BUTTON_HELP);
|
||||
|
||||
int res = lmenu.show();
|
||||
|
||||
if(res == -1)
|
||||
return "";
|
||||
|
||||
res = filter->get_index(res);
|
||||
int option_index = 0;
|
||||
if (select_difficulty != NULL) {
|
||||
*select_difficulty = lmenu.option_checked(option_index++) && change_difficulty_option->enabled();
|
||||
}
|
||||
if(show_replay != NULL) {
|
||||
*show_replay = lmenu.option_checked(option_index++);
|
||||
|
||||
const config& summary = games[res].summary();
|
||||
if (summary["replay"].to_bool() && !summary["snapshot"].to_bool(true)) {
|
||||
*show_replay = true;
|
||||
}
|
||||
}
|
||||
if (cancel_orders != NULL) {
|
||||
*cancel_orders = lmenu.option_checked(option_index++);
|
||||
}
|
||||
|
||||
return games[res].name();
|
||||
}
|
||||
|
||||
namespace {
|
||||
static const int unit_preview_border = 10;
|
||||
}
|
||||
|
|
|
@ -50,14 +50,6 @@ void show_objectives(const std::string& scenarioname, const std::string &objecti
|
|||
|
||||
void show_unit_list(display& gui);
|
||||
|
||||
/**
|
||||
* Allow user to select the game they want to load. Returns the name of the
|
||||
* save they want to load. Stores whether the user wants to show a replay of
|
||||
* the game in show_replay. If show_replay is NULL, then the user will not be
|
||||
* asked if they want to show a replay.
|
||||
*/
|
||||
std::string load_game_dialog(display& disp, const config& game_config, bool* select_difficulty, bool* show_replay, bool* cancel_orders);
|
||||
|
||||
int recruit_dialog(display& disp, std::vector<const unit_type*>& units, const std::vector<std::string>& items, int side, const std::string& title_suffix);
|
||||
|
||||
int recall_dialog(display& disp, const boost::shared_ptr<std::vector<unit_const_ptr > > & units, int side, const std::string& title_suffix, const int team_recall_cost);
|
||||
|
|
|
@ -88,9 +88,9 @@ void display::parse_team_overlays()
|
|||
const team& prev_team = dc_->teams()[playing_team()-1 < dc_->teams().size() ? playing_team()-1 : dc_->teams().size()-1];
|
||||
BOOST_FOREACH(const game_display::overlay_map::value_type i, *overlays_) {
|
||||
const overlay& ov = i.second;
|
||||
if (!ov.team_name.empty() &&
|
||||
((ov.team_name.find(curr_team.team_name()) + 1) != 0) !=
|
||||
((ov.team_name.find(prev_team.team_name()) + 1) != 0))
|
||||
if (!ov.team_id.empty() &&
|
||||
((ov.team_id.find(curr_team.team_id()) + 1) != 0) !=
|
||||
((ov.team_id.find(prev_team.team_id()) + 1) != 0))
|
||||
{
|
||||
invalidate(i.first);
|
||||
}
|
||||
|
@ -98,13 +98,13 @@ void display::parse_team_overlays()
|
|||
}
|
||||
|
||||
|
||||
void display::add_overlay(const map_location& loc, const std::string& img, const std::string& halo,const std::string& team_name, bool visible_under_fog)
|
||||
void display::add_overlay(const map_location& loc, const std::string& img, const std::string& halo,const std::string& team_id, bool visible_under_fog)
|
||||
{
|
||||
if (halo_man_) {
|
||||
const halo::handle halo_handle = halo_man_->add(get_location_x(loc) + hex_size() / 2,
|
||||
get_location_y(loc) + hex_size() / 2, halo, loc);
|
||||
|
||||
const overlay item(img, halo, halo_handle, team_name, visible_under_fog);
|
||||
const overlay item(img, halo, halo_handle, team_id, visible_under_fog);
|
||||
overlays_->insert(overlay_map::value_type(loc,item));
|
||||
}
|
||||
}
|
||||
|
@ -2892,8 +2892,8 @@ void display::draw_hex(const map_location& loc) {
|
|||
}
|
||||
|
||||
for( ; overlays.first != overlays.second; ++overlays.first) {
|
||||
if ((overlays.first->second.team_name == "" ||
|
||||
overlays.first->second.team_name.find(dc_->teams()[viewing_team()].team_name()) != std::string::npos)
|
||||
if ((overlays.first->second.team_id == "" ||
|
||||
overlays.first->second.team_id.find(dc_->teams()[viewing_team()].team_id()) != std::string::npos)
|
||||
&& !(fogged(loc) && !overlays.first->second.visible_in_fog))
|
||||
{
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ public:
|
|||
* One tile may have multiple overlays.
|
||||
*/
|
||||
void add_overlay(const map_location& loc, const std::string& image,
|
||||
const std::string& halo="", const std::string& team_name="",
|
||||
const std::string& halo="", const std::string& team_id="",
|
||||
bool visible_under_fog = true);
|
||||
|
||||
/** remove_overlay will remove all overlays on a tile. */
|
||||
|
|
|
@ -55,6 +55,7 @@ void display_chat_manager::add_chat_message(const time_t& time, const std::strin
|
|||
std::string sender = speaker;
|
||||
if (whisper) {
|
||||
sender.assign(speaker, 9, speaker.size());
|
||||
add_whisperer( sender );
|
||||
}
|
||||
if (!preferences::parse_should_show_lobby_join(sender, message)) return;
|
||||
if (preferences::is_ignored(sender)) return;
|
||||
|
|
|
@ -32,6 +32,9 @@ public:
|
|||
void add_observer(const std::string& name) { observers_.insert(name); }
|
||||
void remove_observer(const std::string& name) { observers_.erase(name); }
|
||||
const std::set<std::string>& observers() const { return observers_; }
|
||||
|
||||
void add_whisperer(const std::string& nick) { whisperers_.insert(nick); }
|
||||
const std::set<std::string>& whisperers() const { return whisperers_; }
|
||||
|
||||
void add_chat_message(const time_t& time, const std::string& speaker,
|
||||
int side, const std::string& msg, events::chat_handler::MESSAGE_TYPE type, bool bell);
|
||||
|
@ -40,6 +43,7 @@ public:
|
|||
friend class game_display; //needed because it calls prune_chat_message
|
||||
private:
|
||||
std::set<std::string> observers_;
|
||||
std::set<std::string> whisperers_; //nicks who whisper you for tab-completition purpose
|
||||
|
||||
struct chat_message
|
||||
{
|
||||
|
|
|
@ -165,7 +165,7 @@ team_data display_context::calculate_team_data(const team& tm, int side) const
|
|||
res.expenses = std::max<int>(0,res.upkeep - tm.support());
|
||||
res.net_income = tm.total_income() - res.expenses;
|
||||
res.gold = tm.gold();
|
||||
res.teamname = tm.user_team_name();
|
||||
res.teamname = tm.team_name();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ editor_action* editor_action_label::perform(map_context& mc) const
|
|||
|
||||
const terrain_label *old_label = mc.get_labels().get_label(loc_);
|
||||
if (old_label) {
|
||||
undo.reset(new editor_action_label(loc_, old_label->text(), old_label->team_name(), old_label->color()
|
||||
undo.reset(new editor_action_label(loc_, old_label->text(), old_label->team_id(), old_label->color()
|
||||
, old_label->visible_in_fog(), old_label->visible_in_shroud(), old_label->immutable(), old_label->category()) );
|
||||
} else {
|
||||
undo.reset(new editor_action_label_delete(loc_));
|
||||
|
@ -49,7 +49,7 @@ editor_action* editor_action_label::perform(map_context& mc) const
|
|||
void editor_action_label::perform_without_undo(map_context& mc) const
|
||||
{
|
||||
mc.get_labels()
|
||||
.set_label(loc_, text_, -1, team_name_, color_, visible_fog_, visible_shroud_, immutable_, category_);
|
||||
.set_label(loc_, text_, -1, team_id_, color_, visible_fog_, visible_shroud_, immutable_, category_);
|
||||
}
|
||||
|
||||
editor_action_label_delete* editor_action_label_delete::clone() const
|
||||
|
@ -65,7 +65,7 @@ editor_action* editor_action_label_delete::perform(map_context& mc) const
|
|||
|
||||
if (!deleted) return NULL;
|
||||
|
||||
undo.reset(new editor_action_label(loc_, deleted->text(), deleted->team_name()
|
||||
undo.reset(new editor_action_label(loc_, deleted->text(), deleted->team_id()
|
||||
, deleted->color(), deleted->visible_in_fog(), deleted->visible_in_shroud(), deleted->immutable(), deleted->category()));
|
||||
|
||||
perform_without_undo(mc);
|
||||
|
|
|
@ -40,9 +40,9 @@ namespace editor {
|
|||
class editor_action_label : public editor_action_location
|
||||
{
|
||||
public:
|
||||
editor_action_label(map_location loc, const std::string& text, const std::string& team_name,
|
||||
editor_action_label(map_location loc, const std::string& text, const std::string& team_id,
|
||||
SDL_Color color, bool visible_fog, bool visible_shroud, bool immutable, std::string category)
|
||||
: editor_action_location(loc), text_(text) , team_name_(team_name), category_(category), color_(color)
|
||||
: editor_action_location(loc), text_(text) , team_id_(team_id), category_(category), color_(color)
|
||||
, visible_fog_(visible_fog), visible_shroud_(visible_shroud), immutable_(immutable)
|
||||
{
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class editor_action_label : public editor_action_location
|
|||
const char* get_name() const { return "label"; }
|
||||
protected:
|
||||
const std::string text_;
|
||||
const std::string team_name_;
|
||||
const std::string team_id_;
|
||||
const std::string category_;
|
||||
SDL_Color color_;
|
||||
bool visible_fog_;
|
||||
|
|
|
@ -51,7 +51,7 @@ editor_action* mouse_action_map_label::drag_left(editor_display& disp, int x, in
|
|||
if (label) {
|
||||
partial = true;
|
||||
chain = new editor_action_chain(new editor_action_label_delete(last_draged_));
|
||||
chain->append_action(new editor_action_label(hex, label->text(), label->team_name(), label->color(),
|
||||
chain->append_action(new editor_action_label(hex, label->text(), label->team_id(), label->color(),
|
||||
label->visible_in_shroud(), label->visible_in_fog(), label->immutable(), label->category()));
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ editor_action* mouse_action_map_label::up_left(editor_display& disp, int x, int
|
|||
|
||||
const terrain_label* old_label = editor::get_current_labels()->get_label(hex);
|
||||
std::string label = old_label ? old_label->text() : "";
|
||||
std::string team_name = old_label ? old_label->team_name() : "";
|
||||
std::string team_id = old_label ? old_label->team_id() : "";
|
||||
std::string category = old_label ? old_label->category() : "";
|
||||
bool visible_shroud = old_label ? old_label->visible_in_shroud() : false;
|
||||
bool visible_fog = old_label ? old_label->visible_in_fog() : true;
|
||||
|
@ -82,7 +82,7 @@ editor_action* mouse_action_map_label::up_left(editor_display& disp, int x, int
|
|||
|
||||
editor_action* a = NULL;
|
||||
if(d.show(disp.video())) {
|
||||
a = new editor_action_label(hex, label, team_name, color
|
||||
a = new editor_action_label(hex, label, team_id, color
|
||||
, visible_fog, visible_shroud, immutable, category);
|
||||
update_brush_highlights(disp, hex);
|
||||
}
|
||||
|
|
|
@ -144,7 +144,8 @@ context_manager::context_manager(editor_display& gui, const config& game_config)
|
|||
, current_context_index_(0)
|
||||
, auto_update_transitions_(preferences::editor::auto_update_transitions())
|
||||
, map_contexts_()
|
||||
, clipboard_()
|
||||
, clipboard_()
|
||||
, default_window_title_(_("The Battle for Wesnoth") + " - " + game_config::revision)
|
||||
{
|
||||
if (default_dir_.empty()) {
|
||||
default_dir_ = filesystem::get_dir(filesystem::get_user_data_dir() + "/editor");
|
||||
|
@ -163,10 +164,8 @@ context_manager::~context_manager()
|
|||
}
|
||||
|
||||
// Restore default window title
|
||||
std::string wm_title_string = _("The Battle for Wesnoth");
|
||||
wm_title_string += " - " + game_config::revision;
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
|
||||
SDL_WM_SetCaption(default_window_title_.c_str(), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -216,8 +215,8 @@ void context_manager::edit_side_dialog(int side)
|
|||
|
||||
team::CONTROLLER controller = t.controller();
|
||||
|
||||
std::string user_team_name = t.user_team_name();
|
||||
std::string team_name = t.team_name();
|
||||
std::string team_id = t.team_id();
|
||||
|
||||
int gold = t.gold();
|
||||
int income = t.base_income();
|
||||
|
@ -231,14 +230,14 @@ void context_manager::edit_side_dialog(int side)
|
|||
|
||||
team::SHARE_VISION share_vision = t.share_vision();
|
||||
|
||||
bool ok = gui2::teditor_edit_side::execute(side +1, team_name, user_team_name,
|
||||
bool ok = gui2::teditor_edit_side::execute(side +1, team_id, team_name,
|
||||
gold, income, village_gold, village_support,
|
||||
fog, shroud, share_vision,
|
||||
controller, no_leader, hidden,
|
||||
gui_.video());
|
||||
|
||||
if (ok) {
|
||||
get_map_context().set_side_setup(side, team_name, user_team_name,
|
||||
get_map_context().set_side_setup(side, team_id, team_name,
|
||||
gold, income, village_gold, village_support,
|
||||
fog, shroud, share_vision, controller, hidden, no_leader);
|
||||
}
|
||||
|
@ -395,7 +394,7 @@ void context_manager::expand_sides_menu(std::vector<std::string>& items)
|
|||
for (size_t mci = 0; mci < get_map_context().get_teams().size(); ++mci) {
|
||||
|
||||
const team& t = get_map_context().get_teams()[mci];
|
||||
const std::string& teamname = t.user_team_name();
|
||||
const std::string& teamname = t.team_name();
|
||||
std::stringstream label;
|
||||
label << "[" << mci+1 << "] ";
|
||||
label << (teamname.empty() ? _("(New Side)") : teamname);
|
||||
|
@ -1020,14 +1019,13 @@ void context_manager::replace_map_context(map_context* new_mc)
|
|||
|
||||
void context_manager::set_window_title()
|
||||
{
|
||||
std::string wm_title_string = _("The Battle for Wesnoth");
|
||||
std::string map_name = filesystem::base_name(get_map_context().get_filename());
|
||||
|
||||
if(map_name.empty()){
|
||||
map_name = get_map_context().is_pure_map() ? "New Map" : "New Scenario";
|
||||
map_name = get_map_context().is_pure_map() ? _("New Map") : _("New Scenario");
|
||||
}
|
||||
|
||||
wm_title_string += " - " + map_name;
|
||||
const std::string& wm_title_string = map_name + " - " + default_window_title_;
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
|
||||
#endif
|
||||
|
|
|
@ -308,6 +308,8 @@ private:
|
|||
/** Clipboard map_fragment -- used for copy-paste. */
|
||||
map_fragment clipboard_;
|
||||
|
||||
/** The default window title outside the editor */
|
||||
std::string default_window_title_;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ map_context::map_context(const config& game_config, const std::string& filename,
|
|||
add_to_recent_files();
|
||||
}
|
||||
|
||||
void map_context::set_side_setup(int side, const std::string& team_name, const std::string& user_team_name,
|
||||
void map_context::set_side_setup(int side, const std::string& team_id, const std::string& team_name,
|
||||
int gold, int income, int village_gold, int village_support,
|
||||
bool fog, bool shroud, team::SHARE_VISION share_vision,
|
||||
team::CONTROLLER controller, bool hidden, bool no_leader)
|
||||
|
@ -209,7 +209,7 @@ void map_context::set_side_setup(int side, const std::string& team_name, const s
|
|||
team& t = teams_[side];
|
||||
// t.set_save_id(id);
|
||||
// t.set_name(name);
|
||||
t.change_team(team_name, user_team_name);
|
||||
t.change_team(team_id, team_name);
|
||||
t.have_leader(!no_leader);
|
||||
t.change_controller(controller);
|
||||
t.set_gold(gold);
|
||||
|
@ -451,7 +451,7 @@ config map_context::to_config()
|
|||
item["halo"] = it->second.halo;
|
||||
item["visible_in_fog"] = it->second.visible_in_fog;
|
||||
item["name"] = it->second.name;
|
||||
item["team_name"] = it->second.team_name;
|
||||
item["team_id"] = it->second.team_id;
|
||||
}
|
||||
|
||||
BOOST_FOREACH(const music_map::value_type& track, music_tracks_) {
|
||||
|
@ -469,8 +469,8 @@ config map_context::to_config()
|
|||
side["controller"] = t->controller();
|
||||
side["no_leader"] = t->no_leader();
|
||||
|
||||
side["team_id"] = t->team_id();
|
||||
side["team_name"] = t->team_name();
|
||||
side["user_team_name"] = t->user_team_name();
|
||||
|
||||
// TODO
|
||||
// side["allow_player"] = "yes";
|
||||
|
|
|
@ -36,6 +36,7 @@ using boost::uintmax_t;
|
|||
#ifdef _WIN32
|
||||
#include <boost/locale.hpp>
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
#include "config.hpp"
|
||||
|
@ -444,7 +445,6 @@ std::string get_next_filename(const std::string& name, const std::string& extens
|
|||
|
||||
static path user_data_dir, user_config_dir, cache_dir;
|
||||
|
||||
#ifndef _WIN32
|
||||
static const std::string& get_version_path_suffix()
|
||||
{
|
||||
static std::string suffix;
|
||||
|
@ -461,7 +461,6 @@ static const std::string& get_version_path_suffix()
|
|||
|
||||
return suffix;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void setup_user_data_dir()
|
||||
{
|
||||
|
@ -480,33 +479,57 @@ static void setup_user_data_dir()
|
|||
create_directory_if_missing(user_data_dir / "saves");
|
||||
create_directory_if_missing(user_data_dir / "persist");
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// As a convenience for portable installs on Windows, relative paths with . or
|
||||
// .. as the first component are considered relative to the current workdir
|
||||
// instead of Documents/My Games.
|
||||
static bool is_path_relative_to_cwd(const std::string& str)
|
||||
{
|
||||
const path p(str);
|
||||
|
||||
if(p.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return *p.begin() == "." || *p.begin() == "..";
|
||||
}
|
||||
#endif
|
||||
|
||||
void set_user_data_dir(std::string newprefdir)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if(newprefdir.empty()) {
|
||||
user_data_dir = path(get_cwd()) / "userdata";
|
||||
} else if (newprefdir.size() > 2 && newprefdir[1] == ':') {
|
||||
if(newprefdir.size() > 2 && newprefdir[1] == ':') {
|
||||
//allow absolute path override
|
||||
user_data_dir = newprefdir;
|
||||
} else if(is_path_relative_to_cwd(newprefdir)) {
|
||||
// Custom directory relative to workdir (for portable installs, etc.)
|
||||
user_data_dir = get_cwd() + "/" + newprefdir;
|
||||
} else {
|
||||
typedef BOOL (WINAPI *SHGSFPAddress)(HWND, LPWSTR, int, BOOL);
|
||||
SHGSFPAddress SHGetSpecialFolderPathW;
|
||||
HMODULE module = LoadLibraryA("shell32");
|
||||
SHGetSpecialFolderPathW = reinterpret_cast<SHGSFPAddress>(GetProcAddress(module, "SHGetSpecialFolderPathW"));
|
||||
if(SHGetSpecialFolderPathW) {
|
||||
LOG_FS << "Using SHGetSpecialFolderPath to find My Documents\n";
|
||||
wchar_t my_documents_path[MAX_PATH];
|
||||
if(SHGetSpecialFolderPathW(NULL, my_documents_path, 5, 1)) {
|
||||
path mygames_path = path(my_documents_path) / "My Games";
|
||||
create_directory_if_missing(mygames_path);
|
||||
user_data_dir = mygames_path / newprefdir;
|
||||
} else {
|
||||
WRN_FS << "SHGetSpecialFolderPath failed\n";
|
||||
user_data_dir = path(get_cwd()) / newprefdir;
|
||||
}
|
||||
} else {
|
||||
LOG_FS << "Failed to load SHGetSpecialFolderPath function\n";
|
||||
if(newprefdir.empty()) {
|
||||
newprefdir = "Wesnoth" + get_version_path_suffix();
|
||||
}
|
||||
|
||||
wchar_t docs_path[MAX_PATH];
|
||||
|
||||
HRESULT res = SHGetFolderPathW(NULL,
|
||||
CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL,
|
||||
SHGFP_TYPE_CURRENT,
|
||||
docs_path);
|
||||
if(res != S_OK) {
|
||||
//
|
||||
// Crummy fallback path full of pain and suffering.
|
||||
//
|
||||
ERR_FS << "Could not determine path to user's Documents folder! ("
|
||||
<< std::hex << "0x" << res << std::dec << ") "
|
||||
<< "User config/data directories may be unavailable for "
|
||||
<< "this session. Please report this as a bug.\n";
|
||||
user_data_dir = path(get_cwd()) / newprefdir;
|
||||
} else {
|
||||
path games_path = path(docs_path) / "My Games";
|
||||
create_directory_if_missing(games_path);
|
||||
|
||||
user_data_dir = games_path / newprefdir;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace game_config
|
|||
const version_info min_savegame_version(MIN_SAVEGAME_VERSION);
|
||||
const version_info test_version("test");
|
||||
|
||||
const std::string observer_team_name = "observer";
|
||||
const std::string observer_team_id = "observer";
|
||||
|
||||
const size_t max_loop = 65536;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace game_config
|
|||
extern std::map<std::string, std::vector<Uint32> > team_rgb_colors;
|
||||
|
||||
/** observer team name used for observer team chat */
|
||||
extern const std::string observer_team_name;
|
||||
extern const std::string observer_team_id;
|
||||
|
||||
/**
|
||||
* The maximum number of hexes on a map and items in an array and also used
|
||||
|
|
|
@ -772,11 +772,11 @@ void game_display::clear_attack_indicator()
|
|||
set_attack_indicator(map_location::null_location(), map_location::null_location());
|
||||
}
|
||||
|
||||
std::string game_display::current_team_name() const
|
||||
std::string game_display::current_team_id() const
|
||||
{
|
||||
if (team_valid())
|
||||
{
|
||||
return dc_->teams()[currentTeam_].team_name();
|
||||
return dc_->teams()[currentTeam_].team_id();
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
int playing_side() const { return activeTeam_ + 1; }
|
||||
|
||||
|
||||
std::string current_team_name() const;
|
||||
std::string current_team_id() const;
|
||||
|
||||
display_chat_manager & get_chat_manager() { return *chat_man_; }
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ const std::string attributes_to_trim[] = {
|
|||
"previous_recruits",
|
||||
"controller",
|
||||
"current_player",
|
||||
"team_id",
|
||||
"team_name",
|
||||
"user_team_name",
|
||||
"color",
|
||||
"gold",
|
||||
"income",
|
||||
|
@ -87,8 +87,8 @@ connect_engine::connect_engine(saved_game& state,
|
|||
force_lock_settings_(),
|
||||
side_engines_(),
|
||||
era_factions_(),
|
||||
team_ids_(),
|
||||
team_names_(),
|
||||
user_team_names_(),
|
||||
player_teams_()
|
||||
{
|
||||
// Initial level config from the mp_game_settings.
|
||||
|
@ -109,28 +109,28 @@ connect_engine::connect_engine(saved_game& state,
|
|||
|
||||
// Set the team name lists and modify the original level sides,
|
||||
// if necessary.
|
||||
std::vector<std::string> original_team_names;
|
||||
std::vector<std::string> original_team_ids;
|
||||
std::string team_prefix(std::string(_("Team")) + " ");
|
||||
int side_count = 1;
|
||||
BOOST_FOREACH(config& side, sides) {
|
||||
const std::string side_str = lexical_cast<std::string>(side_count);
|
||||
config::attribute_value& team_name = side["team_name"];
|
||||
config::attribute_value& user_team_name =
|
||||
side["user_team_name"];
|
||||
config::attribute_value& team_id = side["team_id"];
|
||||
config::attribute_value& team_name =
|
||||
side["team_name"];
|
||||
|
||||
// Revert to default values if appropriate.
|
||||
if (team_name.empty()) {
|
||||
team_name = side_str;
|
||||
if (team_id.empty()) {
|
||||
team_id = side_str;
|
||||
}
|
||||
if (params_.use_map_settings && user_team_name.empty()) {
|
||||
user_team_name = team_name;
|
||||
if (params_.use_map_settings && team_name.empty()) {
|
||||
team_name = team_id;
|
||||
}
|
||||
|
||||
bool add_team = true;
|
||||
if (params_.use_map_settings) {
|
||||
// Only add a team if it is not found.
|
||||
bool found = std::find(team_names_.begin(), team_names_.end(),
|
||||
team_name.str()) != team_names_.end();
|
||||
bool found = std::find(team_ids_.begin(), team_ids_.end(),
|
||||
team_id.str()) != team_ids_.end();
|
||||
|
||||
if (found) {
|
||||
add_team = false;
|
||||
|
@ -139,29 +139,29 @@ connect_engine::connect_engine(saved_game& state,
|
|||
// Always add a new team for every side, but leave
|
||||
// the specified team assigned to a side if there is one.
|
||||
std::vector<std::string>::const_iterator name_itor =
|
||||
std::find(original_team_names.begin(),
|
||||
original_team_names.end(), team_name.str());
|
||||
if (name_itor == original_team_names.end()) {
|
||||
original_team_names.push_back(team_name);
|
||||
std::find(original_team_ids.begin(),
|
||||
original_team_ids.end(), team_id.str());
|
||||
if (name_itor == original_team_ids.end()) {
|
||||
original_team_ids.push_back(team_id);
|
||||
|
||||
team_name = "Team " +
|
||||
lexical_cast<std::string>(original_team_names.size());
|
||||
team_id = "Team " +
|
||||
lexical_cast<std::string>(original_team_ids.size());
|
||||
} else {
|
||||
team_name = "Team " + lexical_cast<std::string>(
|
||||
name_itor - original_team_names.begin() + 1);
|
||||
} // Note that the prefix "Team " is untranslatable, as team_name is not meant to be translated. This is needed so that the attribute
|
||||
team_id = "Team " + lexical_cast<std::string>(
|
||||
name_itor - original_team_ids.begin() + 1);
|
||||
} // Note that the prefix "Team " is untranslatable, as team_id is not meant to be translated. This is needed so that the attribute
|
||||
// is not interpretted as an int when reading from config, which causes bugs later.
|
||||
|
||||
user_team_name = team_prefix + side_str;
|
||||
team_name = team_prefix + side_str;
|
||||
}
|
||||
|
||||
if (add_team) {
|
||||
team_names_.push_back(params_.use_map_settings ? team_name :
|
||||
team_ids_.push_back(params_.use_map_settings ? team_id :
|
||||
"Team " + side_str);
|
||||
user_team_names_.push_back(user_team_name.t_str().to_serialized());
|
||||
team_names_.push_back(team_name.t_str().to_serialized());
|
||||
|
||||
if (side["allow_player"].to_bool(true) || game_config::debug) {
|
||||
player_teams_.push_back(user_team_name.str());
|
||||
player_teams_.push_back(team_name.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -928,20 +928,20 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
|
|||
}
|
||||
|
||||
// Initialize team and color.
|
||||
unsigned team_name_index = 0;
|
||||
BOOST_FOREACH(const std::string& name, parent_.team_names_) {
|
||||
if (name == cfg["team_name"]) {
|
||||
unsigned team_id_index = 0;
|
||||
BOOST_FOREACH(const std::string& name, parent_.team_ids_) {
|
||||
if (name == cfg["team_id"]) {
|
||||
break;
|
||||
}
|
||||
|
||||
team_name_index++;
|
||||
team_id_index++;
|
||||
}
|
||||
if (team_name_index >= parent_.team_names_.size()) {
|
||||
assert(!parent_.team_names_.empty());
|
||||
if (team_id_index >= parent_.team_ids_.size()) {
|
||||
assert(!parent_.team_ids_.empty());
|
||||
team_ = 0;
|
||||
WRN_MP << "In side_engine constructor: Could not find my team_name " << cfg["team_name"] << " among the mp connect engine's list of team names. I am being assigned to the first team. This may indicate a bug!" << std::endl;
|
||||
WRN_MP << "In side_engine constructor: Could not find my team_id " << cfg["team_id"] << " among the mp connect engine's list of team names. I am being assigned to the first team. This may indicate a bug!" << std::endl;
|
||||
} else {
|
||||
team_ = team_name_index;
|
||||
team_ = team_id_index;
|
||||
}
|
||||
if (!cfg["color"].empty()) {
|
||||
if(cfg["color"].to_int()) {
|
||||
|
@ -1093,8 +1093,8 @@ config side_engine::new_config() const
|
|||
(*leader)["type"] = flg_.current_leader();
|
||||
(*leader)["gender"] = flg_.current_gender();
|
||||
|
||||
res["team_id"] = parent_.team_ids_[team_];
|
||||
res["team_name"] = parent_.team_names_[team_];
|
||||
res["user_team_name"] = parent_.user_team_names_[team_];
|
||||
res["allow_player"] = allow_player_;
|
||||
res["color"] = get_color(color_);
|
||||
res["gold"] = gold_;
|
||||
|
|
|
@ -96,8 +96,8 @@ public:
|
|||
throw "No scenariodata found";
|
||||
}
|
||||
const std::set<std::string>& connected_users() const;
|
||||
const std::vector<std::string>& user_team_names()
|
||||
{ return user_team_names_; }
|
||||
const std::vector<std::string>& team_names()
|
||||
{ return team_names_; }
|
||||
std::vector<side_engine_ptr>& side_engines() { return side_engines_; }
|
||||
const mp_game_settings& params() const { return params_; }
|
||||
bool first_scenario() const { return first_scenario_; }
|
||||
|
@ -129,8 +129,8 @@ private:
|
|||
|
||||
std::vector<side_engine_ptr> side_engines_;
|
||||
std::vector<const config*> era_factions_;
|
||||
std::vector<std::string> team_ids_;
|
||||
std::vector<std::string> team_names_;
|
||||
std::vector<std::string> user_team_names_;
|
||||
std::vector<std::string> player_teams_;
|
||||
|
||||
std::set<std::string>& connected_users_rw();
|
||||
|
|
|
@ -210,7 +210,7 @@ void scenario::set_sides()
|
|||
pos < map_positions; ++pos) {
|
||||
config& side = data_.add_child("side");
|
||||
side["side"] = pos + 1;
|
||||
side["team_name"] = "Team " + lexical_cast<std::string>(pos + 1);
|
||||
side["team_id"] = "Team " + lexical_cast<std::string>(pos + 1);
|
||||
side["canrecruit"] = true;
|
||||
side["controller"] = "human";
|
||||
}
|
||||
|
|
|
@ -869,7 +869,7 @@ void start_local_game_commandline(game_display& disp, const config& game_config,
|
|||
for (int pos = state.get_starting_pos().child_count("side"); pos < map_positions; ++pos) {
|
||||
config& side = state.get_starting_pos().add_child("side");
|
||||
side["side"] = pos + 1;
|
||||
side["team_name"] = pos + 1;
|
||||
side["team_id"] = pos + 1;
|
||||
side["canrecruit"] = true;
|
||||
side["controller"] = "human";
|
||||
}
|
||||
|
|
|
@ -333,6 +333,9 @@ void create::process_event_impl(const process_event_data & data)
|
|||
}
|
||||
}
|
||||
|
||||
if (load.cancel_orders())
|
||||
engine_.get_state().cancel_orders();
|
||||
|
||||
engine_.prepare_for_saved_game();
|
||||
set_result(LOAD_GAME);
|
||||
|
||||
|
|
|
@ -598,7 +598,7 @@ void wait::generate_menu()
|
|||
str << sd["income"] << _(")");
|
||||
}
|
||||
|
||||
str << COLUMN_SEPARATOR << t_string::from_serialized(sd["user_team_name"].str());
|
||||
str << COLUMN_SEPARATOR << t_string::from_serialized(sd["team_name"].str());
|
||||
|
||||
str << COLUMN_SEPARATOR << get_color_string(sd["color"].str());
|
||||
details.push_back(str.str());
|
||||
|
|
|
@ -20,7 +20,11 @@
|
|||
#include "gui/dialogs/campaign_settings.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
#include "gui/widgets/label.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/toggle_button.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
|
|
|
@ -19,7 +19,11 @@
|
|||
#include "gui/auxiliary/find_widget.tpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
#include "gui/widgets/list.hpp"
|
||||
#else
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#endif
|
||||
#include "gettext.hpp"
|
||||
|
||||
namespace gui2
|
||||
|
|
|
@ -62,7 +62,7 @@ teditor_edit_label::teditor_edit_label(std::string& text,
|
|||
|
||||
|
||||
// std::string label = old_label ? old_label->text() : "";
|
||||
// std::string team_name = old_label ? old_label->team_name() : "";
|
||||
// std::string team_id = old_label ? old_label->team_id() : "";
|
||||
// bool visible_shroud = old_label ? old_label->visible_in_shroud() :
|
||||
// false;
|
||||
// bool visible_fog = old_label ? old_label->visible_in_fog() :
|
||||
|
|
|
@ -70,8 +70,8 @@ teditor_edit_side::teditor_edit_side(int side,
|
|||
side_stream << side;
|
||||
register_label("side_number", true, side_stream.str(), true);
|
||||
|
||||
register_text("team_name", true, id, true);
|
||||
register_text("user_team_name", true, name, true);
|
||||
register_text("team_id", true, id, true);
|
||||
register_text("team_name", true, name, true);
|
||||
|
||||
register_integer("gold", true, gold);
|
||||
register_integer("income", true, income);
|
||||
|
|
|
@ -28,8 +28,8 @@ class teditor_edit_side : public tdialog
|
|||
{
|
||||
public:
|
||||
teditor_edit_side(int side,
|
||||
std::string& team_id,
|
||||
std::string& team_name,
|
||||
std::string& user_team_name,
|
||||
int& gold,
|
||||
int& income,
|
||||
int& village_income,
|
||||
|
@ -43,8 +43,8 @@ public:
|
|||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
static bool execute(int side,
|
||||
std::string& team_id,
|
||||
std::string& team_name,
|
||||
std::string& user_team_name,
|
||||
int& gold,
|
||||
int& income,
|
||||
int& village_income,
|
||||
|
@ -58,8 +58,8 @@ public:
|
|||
CVideo& video)
|
||||
{
|
||||
return teditor_edit_side(side,
|
||||
team_id,
|
||||
team_name,
|
||||
user_team_name,
|
||||
gold,
|
||||
income,
|
||||
village_income,
|
||||
|
|
|
@ -288,8 +288,8 @@ void tgame_load::display_savegame(twindow& window)
|
|||
|
||||
find_widget<tlabel>(&window, "lblSummary", false).set_label(str.str());
|
||||
|
||||
// FIXME: Find a better way to change the label width
|
||||
window.invalidate_layout();
|
||||
// TODO: Find a better way to change the label width
|
||||
// window.invalidate_layout();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,11 @@
|
|||
namespace gui2
|
||||
{
|
||||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
class tlist;
|
||||
#else
|
||||
class tlistbox;
|
||||
#endif
|
||||
class tstacked_widget;
|
||||
|
||||
class tgame_version : public tdialog
|
||||
|
|
|
@ -191,6 +191,11 @@ public:
|
|||
|
||||
unsigned int get_num_page(const std::string& s)
|
||||
{
|
||||
// We always want to reserve a page for empty contents.
|
||||
if(s.empty()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (s.length() / max_inspect_win_len) + (s.length() % max_inspect_win_len > 0 ? 1 : 0);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
Part of 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.
|
||||
*/
|
||||
|
||||
|
@ -23,7 +23,11 @@
|
|||
#include "resources.hpp"
|
||||
#include "gui/auxiliary/find_widget.tpp"
|
||||
#include "gui/widgets/control.hpp"
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
#include "gui/widgets/list.hpp"
|
||||
#else
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#endif
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/toggle_button.hpp"
|
||||
|
@ -36,7 +40,7 @@ REGISTER_DIALOG(label_settings);
|
|||
tlabel_settings::tlabel_settings(display_context& dc) : viewer(dc) {
|
||||
const std::vector<std::string>& all_categories = resources::screen->labels().all_categories();
|
||||
const std::vector<std::string>& hidden_categories = viewer.hidden_label_categories();
|
||||
|
||||
|
||||
for(size_t i = 0; i < all_categories.size(); i++) {
|
||||
all_labels[all_categories[i]] = true;
|
||||
if(all_categories[i].substr(0,4) == "cat:")
|
||||
|
@ -55,19 +59,19 @@ tlabel_settings::tlabel_settings(display_context& dc) : viewer(dc) {
|
|||
labels_display[label_cat_key] = "";
|
||||
continue;
|
||||
}
|
||||
std::string team_name = team.name();
|
||||
if(team_name.empty()) {
|
||||
team_name = team.current_player();
|
||||
std::string team_id = team.name();
|
||||
if(team_id.empty()) {
|
||||
team_id = team.current_player();
|
||||
}
|
||||
if(team_name.empty()) {
|
||||
team_name = team.user_team_name();
|
||||
if(team_id.empty()) {
|
||||
team_id = team.team_name();
|
||||
}
|
||||
if(team_name.empty()) {
|
||||
team_name = _("Unknown");
|
||||
if(team_id.empty()) {
|
||||
team_id = _("Unknown");
|
||||
}
|
||||
string_map subst;
|
||||
subst["side_number"] = str_cast(i + 1);
|
||||
subst["name"] = team_name;
|
||||
subst["name"] = team_id;
|
||||
labels_display[label_cat_key] = vgettext("Side $side_number ($name)", subst);
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +82,7 @@ void tlabel_settings::pre_show(CVideo& /*video*/, twindow& window) {
|
|||
FOREACH(const AUTO & label_entry, all_labels) {
|
||||
const std::string& category = label_entry.first;
|
||||
const bool& visible = label_entry.second;
|
||||
|
||||
|
||||
std::string name = labels_display[category];
|
||||
if(category.substr(0,5) == "side:") {
|
||||
if(name.empty()) {
|
||||
|
@ -91,15 +95,15 @@ void tlabel_settings::pre_show(CVideo& /*video*/, twindow& window) {
|
|||
sout << "<span color='#" << std::hex << which_color << "'>" << name << "</span>";
|
||||
name = sout.str();
|
||||
}
|
||||
|
||||
|
||||
list_data["cat_name"]["label"] = name;
|
||||
cats_listbox.add_row(list_data);
|
||||
|
||||
|
||||
tgrid* grid = cats_listbox.get_row_grid(cats_listbox.get_item_count() - 1);
|
||||
ttoggle_button& status = find_widget<ttoggle_button>(grid, "cat_status", false);
|
||||
status.set_value(visible);
|
||||
status.set_callback_state_change(boost::bind(&tlabel_settings::toggle_category, this, _1, category));
|
||||
|
||||
|
||||
if(category.substr(0,5) == "side:") {
|
||||
tlabel& label = find_widget<tlabel>(grid, "cat_name", false);
|
||||
label.set_use_markup(true);
|
||||
|
@ -124,4 +128,4 @@ bool tlabel_settings::execute(display_context& dc, CVideo& video) {
|
|||
void tlabel_settings::toggle_category(twidget& box, std::string category) {
|
||||
all_labels[category] = (static_cast<ttoggle_button&>(box).get_value() != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,27 @@
|
|||
#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/grid.hpp"
|
||||
#include "gui/widgets/text_box.hpp"
|
||||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "display.hpp"
|
||||
#include "marked-up_text.hpp"
|
||||
#include "help/help.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "play_controller.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "team.hpp"
|
||||
#include "unit_types.hpp"
|
||||
|
||||
#include "utils/foreach.tpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
static std::string last_chosen_type_id = "";
|
||||
|
@ -83,8 +99,11 @@ namespace gui2
|
|||
|
||||
REGISTER_DIALOG(unit_create)
|
||||
|
||||
tunit_create::tunit_create()
|
||||
: gender_(last_gender), choice_(last_chosen_type_id), type_ids_()
|
||||
tunit_create::tunit_create(display* disp)
|
||||
: gender_(last_gender)
|
||||
, choice_(last_chosen_type_id)
|
||||
, last_words_()
|
||||
, disp_(disp)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -96,18 +115,39 @@ void tunit_create::pre_show(CVideo& /*video*/, twindow& window)
|
|||
= find_widget<ttoggle_button>(&window, "female_toggle", false);
|
||||
tlistbox& list = find_widget<tlistbox>(&window, "unit_type_list", false);
|
||||
|
||||
male_toggle.set_callback_state_change(
|
||||
dialog_callback<tunit_create,
|
||||
&tunit_create::gender_toggle_callback>);
|
||||
female_toggle.set_callback_state_change(
|
||||
dialog_callback<tunit_create,
|
||||
&tunit_create::gender_toggle_callback>);
|
||||
update_male_female_toggles(male_toggle, female_toggle, gender_);
|
||||
list.clear();
|
||||
ttext_box* filter
|
||||
= find_widget<ttext_box>(&window, "filter_box", false, true);
|
||||
|
||||
// We use this container to "map" unit_type ids to list subscripts
|
||||
// later, so it ought to be empty before proceeding.
|
||||
type_ids_.clear();
|
||||
filter->set_text_changed_callback(
|
||||
boost::bind(&tunit_create::filter_text_changed, this, _1, _2));
|
||||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(*list,
|
||||
boost::bind(&tunit_create::list_item_clicked,
|
||||
*this,
|
||||
boost::ref(window)));
|
||||
#else
|
||||
list.set_callback_value_change(
|
||||
dialog_callback<tunit_create, &tunit_create::list_item_clicked>);
|
||||
#endif
|
||||
|
||||
window.keyboard_capture(&list);
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<tbutton>(&window, "type_profile", false),
|
||||
boost::bind(&tunit_create::profile_button_callback,
|
||||
this,
|
||||
boost::ref(window)));
|
||||
|
||||
male_toggle.set_callback_state_change(
|
||||
dialog_callback<tunit_create, &tunit_create::gender_toggle_callback>);
|
||||
|
||||
female_toggle.set_callback_state_change(
|
||||
dialog_callback<tunit_create, &tunit_create::gender_toggle_callback>);
|
||||
|
||||
update_male_female_toggles(male_toggle, female_toggle, gender_);
|
||||
|
||||
list.clear();
|
||||
|
||||
FOREACH(const AUTO & i, unit_types.types())
|
||||
{
|
||||
|
@ -115,18 +155,17 @@ void tunit_create::pre_show(CVideo& /*video*/, twindow& window)
|
|||
continue;
|
||||
|
||||
// Make sure this unit type is built with the data we need.
|
||||
unit_types.build_unit_type(i.second, unit_type::HELP_INDEXED);
|
||||
unit_types.build_unit_type(i.second, unit_type::WITHOUT_ANIMATIONS);
|
||||
|
||||
// And so we map an unit_type id to a list subscript. Ugh.
|
||||
type_ids_.push_back(i.first);
|
||||
units_.push_back(&i.second);
|
||||
|
||||
std::map<std::string, string_map> row_data;
|
||||
string_map column;
|
||||
|
||||
column["label"] = i.second.type_name();
|
||||
row_data.insert(std::make_pair("unit_type", column));
|
||||
column["label"] = i.second.race()->plural_name();
|
||||
column["label"] = units_.back()->race()->plural_name();
|
||||
row_data.insert(std::make_pair("race", column));
|
||||
column["label"] = units_.back()->type_name();
|
||||
row_data.insert(std::make_pair("unit_type", column));
|
||||
|
||||
list.add_row(row_data);
|
||||
|
||||
|
@ -136,10 +175,40 @@ void tunit_create::pre_show(CVideo& /*video*/, twindow& window)
|
|||
}
|
||||
}
|
||||
|
||||
if(type_ids_.empty()) {
|
||||
if(units_.empty()) {
|
||||
ERR_GUI_G << "no unit types found for unit create dialog; not good"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
std::vector<tgenerator_::torder_func> order_funcs(2);
|
||||
order_funcs[0] = boost::bind(&tunit_create::compare_race, this, _1, _2);
|
||||
order_funcs[1] = boost::bind(&tunit_create::compare_race_rev, this, _1, _2);
|
||||
list.set_column_order(0, order_funcs);
|
||||
order_funcs[0] = boost::bind(&tunit_create::compare_type, this, _1, _2);
|
||||
order_funcs[1] = boost::bind(&tunit_create::compare_type_rev, this, _1, _2);
|
||||
list.set_column_order(1, order_funcs);
|
||||
|
||||
list_item_clicked(window);
|
||||
}
|
||||
|
||||
bool tunit_create::compare_type(unsigned i1, unsigned i2) const
|
||||
{
|
||||
return units_[i1]->type_name().str() < units_[i2]->type_name().str();
|
||||
}
|
||||
|
||||
bool tunit_create::compare_race(unsigned i1, unsigned i2) const
|
||||
{
|
||||
return units_[i1]->race()->plural_name().str() < units_[i2]->race()->plural_name().str();
|
||||
}
|
||||
|
||||
bool tunit_create::compare_type_rev(unsigned i1, unsigned i2) const
|
||||
{
|
||||
return units_[i1]->type_name().str() > units_[i2]->type_name().str();
|
||||
}
|
||||
|
||||
bool tunit_create::compare_race_rev(unsigned i1, unsigned i2) const
|
||||
{
|
||||
return units_[i1]->race()->plural_name().str() > units_[i2]->race()->plural_name().str();
|
||||
}
|
||||
|
||||
void tunit_create::post_show(twindow& window)
|
||||
|
@ -157,7 +226,7 @@ void tunit_create::post_show(twindow& window)
|
|||
const int selected_row = list.get_selected_row();
|
||||
if(selected_row < 0) {
|
||||
return;
|
||||
} else if(static_cast<size_t>(selected_row) >= type_ids_.size()) {
|
||||
} else if(static_cast<size_t>(selected_row) >= units_.size()) {
|
||||
// FIXME: maybe assert?
|
||||
ERR_GUI_G << "unit create dialog has more list items than known unit "
|
||||
"types; not good\n";
|
||||
|
@ -165,11 +234,209 @@ void tunit_create::post_show(twindow& window)
|
|||
}
|
||||
|
||||
last_chosen_type_id = choice_
|
||||
= type_ids_[static_cast<size_t>(selected_row)];
|
||||
= units_[selected_row]->id();
|
||||
last_gender = gender_ = female_toggle.get_value() ? unit_race::FEMALE
|
||||
: unit_race::MALE;
|
||||
}
|
||||
|
||||
void tunit_create::print_stats(std::stringstream& str, const int row)
|
||||
{
|
||||
const unit_type* u = units_[row];
|
||||
|
||||
str << "<b>" << _("HP: ") << "</b>"
|
||||
<< "<span color='#21e100'>" << u->hitpoints() << "</span> ";
|
||||
|
||||
str << "<b>" << _("XP: ") << "</b>"
|
||||
<< "<span color='#00a0e1'>" << u->experience_needed() << "</span> ";
|
||||
|
||||
str << "<b>" << _("MP: ") << "</b>"
|
||||
<< u->movement() << "\n";
|
||||
|
||||
str << " \n";
|
||||
|
||||
// Print trait details
|
||||
bool has_traits = false;
|
||||
std::stringstream t_str;
|
||||
|
||||
BOOST_FOREACH(const config& tr, u->possible_traits())
|
||||
{
|
||||
if(tr["availability"] != "musthave") continue;
|
||||
|
||||
const std::string gender_string =
|
||||
u->genders().front() == unit_race::FEMALE ? "female_name" : "male_name";
|
||||
|
||||
t_string name = tr[gender_string];
|
||||
if(name.empty()) {
|
||||
name = tr["name"];
|
||||
}
|
||||
|
||||
if(!name.empty()) {
|
||||
t_str << " " << name << "\n";
|
||||
}
|
||||
|
||||
has_traits = true;
|
||||
}
|
||||
|
||||
if(has_traits) {
|
||||
str << "<b>" << "Traits" << "</b>" << "\n";
|
||||
str << t_str.str();
|
||||
str << " \n";
|
||||
}
|
||||
|
||||
// Print ability details
|
||||
if(!u->abilities().empty()) {
|
||||
str << "<b>" << "Abilities" << "</b>" << "\n";
|
||||
|
||||
BOOST_FOREACH(const std::string& ab, u->abilities())
|
||||
{
|
||||
str << " " << ab << "\n";
|
||||
}
|
||||
|
||||
str << " \n";
|
||||
}
|
||||
|
||||
// Print attack details
|
||||
if(!u->attacks().empty()) {
|
||||
str << "<b>" << "Attacks" << "</b>" << "\n";
|
||||
|
||||
BOOST_FOREACH(const attack_type& a, u->attacks())
|
||||
{
|
||||
str << "<span color='#f5e6c1'>" << a.num_attacks()
|
||||
<< font::weapon_numbers_sep << a.damage() << " " << a.name() << "</span>" << "\n";
|
||||
|
||||
str << "<span color='#a69275'>" << " " << a.range()
|
||||
<< font::weapon_details_sep << a.type() << "</span>" << "\n";
|
||||
|
||||
const std::string special = a.weapon_specials();
|
||||
if (!special.empty()) {
|
||||
str << "<span color='#a69275'>" << " " << special << "</span>" << "\n";
|
||||
}
|
||||
|
||||
const std::string accuracy_parry = a.accuracy_parry_description();
|
||||
if(!accuracy_parry.empty()) {
|
||||
str << "<span color='#a69275'>" << " " << accuracy_parry << "</span>" << "\n";
|
||||
}
|
||||
|
||||
str << " \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tunit_create::list_item_clicked(twindow& window)
|
||||
{
|
||||
const int selected_row
|
||||
= find_widget<tlistbox>(&window, "unit_type_list", false).get_selected_row();
|
||||
|
||||
const unit_type* u = units_[selected_row];
|
||||
|
||||
std::stringstream str;
|
||||
print_stats(str, selected_row);
|
||||
|
||||
std::string tc;
|
||||
|
||||
if(resources::controller) {
|
||||
tc = "~RC(" + u->flag_rgb() + ">" +
|
||||
team::get_side_color_index(resources::controller->current_side())
|
||||
+ ")";
|
||||
}
|
||||
|
||||
const std::string& alignment_name = unit_type::alignment_description(
|
||||
u->alignment(),
|
||||
u->genders().front());
|
||||
|
||||
find_widget<timage>(&window, "type_image", false)
|
||||
.set_label((u->icon().empty() ? u->image() : u->icon()) + tc);
|
||||
|
||||
tlabel& u_name = find_widget<tlabel>(&window, "type_name", false);
|
||||
|
||||
u_name.set_label("<big>" + u->type_name() + "</big>");
|
||||
u_name.set_use_markup(true);
|
||||
|
||||
std::stringstream l_str;
|
||||
l_str << "<span size='x-large'>" << "L " << u->level() << "</span>";
|
||||
|
||||
tlabel& l_label = find_widget<tlabel>(&window, "type_level", false);
|
||||
|
||||
l_label.set_label(l_str.str());
|
||||
l_label.set_use_markup(true);
|
||||
|
||||
timage& r_icon = find_widget<timage>(&window, "type_race", false);
|
||||
|
||||
r_icon.set_label("icons/unit-groups/race_" + u->race_id() + "_30.png");
|
||||
r_icon.set_tooltip(u->race()->name(u->genders().front()));
|
||||
|
||||
timage& a_icon = find_widget<timage>(&window, "type_alignment", false);
|
||||
|
||||
a_icon.set_label("icons/alignments/alignment_" + alignment_name + "_30.png");
|
||||
a_icon.set_tooltip(alignment_name);
|
||||
|
||||
tlabel& details = find_widget<tlabel>(&window, "type_details", false);
|
||||
|
||||
details.set_label(str.str());
|
||||
details.set_use_markup(true);
|
||||
}
|
||||
|
||||
bool tunit_create::filter_text_changed(ttext_* textbox, const std::string& text)
|
||||
{
|
||||
twindow& window = *textbox->get_window();
|
||||
|
||||
tlistbox& list = find_widget<tlistbox>(&window, "unit_type_list", false);
|
||||
|
||||
const std::vector<std::string> words = utils::split(text, ' ');
|
||||
|
||||
if(words == last_words_)
|
||||
return false;
|
||||
last_words_ = words;
|
||||
|
||||
std::vector<bool> show_items(list.get_item_count(), true);
|
||||
|
||||
if(!text.empty()) {
|
||||
for(unsigned int i = 0; i < list.get_item_count(); i++) {
|
||||
tgrid* row = list.get_row_grid(i);
|
||||
|
||||
tgrid::iterator it = row->begin();
|
||||
tlabel& type_label
|
||||
= find_widget<tlabel>(*it, "unit_type", false);
|
||||
|
||||
bool found = false;
|
||||
FOREACH(const AUTO & word, words)
|
||||
{
|
||||
found = std::search(type_label.label().str().begin(),
|
||||
type_label.label().str().end(),
|
||||
word.begin(),
|
||||
word.end(),
|
||||
chars_equal_insensitive)
|
||||
!= type_label.label().str().end();
|
||||
|
||||
if(!found) {
|
||||
// one word doesn't match, we don't reach words.end()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
show_items[i] = found;
|
||||
}
|
||||
}
|
||||
|
||||
list.set_row_shown(show_items);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void tunit_create::profile_button_callback(twindow& window)
|
||||
{
|
||||
if(!disp_) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int selected_row
|
||||
= find_widget<tlistbox>(&window, "unit_type_list", false).get_selected_row();
|
||||
|
||||
help::show_unit_help(*disp_,
|
||||
units_[selected_row]->id(),
|
||||
units_[selected_row]->show_variations_in_help(), false);
|
||||
}
|
||||
|
||||
void tunit_create::gender_toggle_callback(twindow& window)
|
||||
{
|
||||
ttoggle_button& male_toggle
|
||||
|
|
|
@ -16,18 +16,22 @@
|
|||
#define GUI_DIALOGS_UNIT_CREATE_HPP_INCLUDED
|
||||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
#include "gui/widgets/text.hpp"
|
||||
#include "race.hpp"
|
||||
#include "unit_types.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class display;
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
class tunit_create : public tdialog
|
||||
{
|
||||
public:
|
||||
tunit_create();
|
||||
tunit_create(display* disp = NULL);
|
||||
|
||||
/** Unit type choice from the user. */
|
||||
const std::string& choice() const
|
||||
|
@ -48,10 +52,15 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
std::vector<const unit_type*> units_;
|
||||
|
||||
unit_race::GENDER gender_;
|
||||
|
||||
std::string choice_;
|
||||
std::vector<std::string> type_ids_;
|
||||
|
||||
std::vector<std::string> last_words_;
|
||||
|
||||
display* disp_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
@ -59,9 +68,20 @@ private:
|
|||
/** Inherited from tdialog. */
|
||||
void pre_show(CVideo& video, twindow& window);
|
||||
|
||||
bool compare_type(unsigned i1, unsigned i2) const;
|
||||
bool compare_race(unsigned i1, unsigned i2) const;
|
||||
bool compare_type_rev(unsigned i1, unsigned i2) const;
|
||||
bool compare_race_rev(unsigned i1, unsigned i2) const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void post_show(twindow& window);
|
||||
|
||||
void print_stats(std::stringstream& str, const int row);
|
||||
|
||||
/** Callbacks */
|
||||
void list_item_clicked(twindow& window);
|
||||
bool filter_text_changed(ttext_* textbox, const std::string& text);
|
||||
void profile_button_callback(twindow& window);
|
||||
void gender_toggle_callback(twindow& window);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -74,14 +74,15 @@ void tone::delete_item(const unsigned index)
|
|||
|
||||
// Are there items left?
|
||||
const unsigned item_count = get_item_count();
|
||||
const unsigned visible_index = get_ordered_index(index);
|
||||
if(item_count > 1) {
|
||||
// Is the last item deselected?
|
||||
if(index == item_count - 1) {
|
||||
if(visible_index == item_count - 1) {
|
||||
// Select the second last.
|
||||
do_select_item(index - 1);
|
||||
do_select_item(get_item_at_ordered(visible_index - 1));
|
||||
} else {
|
||||
// Select the next item.
|
||||
do_select_item(index + 1);
|
||||
do_select_item(get_item_at_ordered(visible_index + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,15 +18,17 @@
|
|||
|
||||
#include "gui/widgets/list.hpp"
|
||||
|
||||
#include "foreach.hpp"
|
||||
#include "gui/auxiliary/find_widget.tpp"
|
||||
#include "gui/auxiliary/log.hpp"
|
||||
#include "gui/auxiliary/widget_definition/listbox.hpp"
|
||||
#include "gui/auxiliary/window_builder/listbox.hpp"
|
||||
#include "gui/widgets/detail/register.tpp"
|
||||
#include "gui/widgets/selectable.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
|
||||
#define LOG_HEADER LOG_SCOPE_HEADER + ':'
|
||||
|
@ -120,7 +122,7 @@ tlist::add_row(const std::map<std::string /* widget id */, string_map>& data,
|
|||
|
||||
void tlist::append_rows(const std::vector<string_map>& items)
|
||||
{
|
||||
foreach(const string_map & item, items)
|
||||
BOOST_FOREACH(const string_map & item, items)
|
||||
{
|
||||
add_row(item);
|
||||
}
|
||||
|
@ -193,7 +195,7 @@ void tlist::set_row_shown(const unsigned row, const bool shown)
|
|||
window->invalidate_layout();
|
||||
} else {
|
||||
// grid().set_visible_rectangle(content_visible_rectangle());
|
||||
set_dirty(true);
|
||||
set_is_dirty(true);
|
||||
}
|
||||
|
||||
if(selected_row != get_selected_row()) {
|
||||
|
@ -227,7 +229,7 @@ void tlist::set_row_shown(const std::vector<bool>& shown)
|
|||
window->invalidate_layout();
|
||||
} else {
|
||||
// content_grid_->set_visible_rectangle(content_visible_rectangle());
|
||||
set_dirty(true);
|
||||
set_is_dirty(true);
|
||||
}
|
||||
|
||||
if(selected_row != get_selected_row()) {
|
||||
|
@ -314,7 +316,7 @@ void tlist::resize_content(
|
|||
need_layout_ = true;
|
||||
// If the content grows assume it "overwrites" the old content.
|
||||
if(width_modification < 0 || height_modification < 0) {
|
||||
set_dirty(true);
|
||||
set_is_dirty(true);
|
||||
}
|
||||
DBG_GUI_L << LOG_HEADER << " succeeded.\n";
|
||||
} else {
|
||||
|
@ -370,7 +372,7 @@ void tlist::layout_children(const bool force)
|
|||
grid().set_visible_rectangle(content_visible_area_);
|
||||
*/
|
||||
need_layout_ = false;
|
||||
set_dirty(true);
|
||||
set_is_dirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ hotkey::hotkey_command_temp hotkey_list_[] = {
|
|||
{ hotkey::HOTKEY_SAVE_GAME, "save", N_("Save Game"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_SAVE_REPLAY, "savereplay", N_("Save Replay"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_SAVE_MAP, "savemap", N_("Save Map"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_LOAD_GAME, "load", N_("Load Game"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_LOAD_GAME, "load", N_("Load Game"), false, scope_game | scope_main, "" },
|
||||
{ hotkey::HOTKEY_RECRUIT, "recruit", N_("Recruit"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_REPEAT_RECRUIT, "repeatrecruit", N_("Repeat Recruit"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_RECALL, "recall", N_("Recall"), false, scope_game, "" },
|
||||
|
|
|
@ -118,7 +118,7 @@ void status_table(display& gui, int selected)
|
|||
}
|
||||
str << COLUMN_SEPARATOR << team::get_side_highlight(n)
|
||||
<< leader_name << COLUMN_SEPARATOR
|
||||
<< (data.teamname.empty() ? teams[n].team_name() : data.teamname)
|
||||
<< (data.teamname.empty() ? teams[n].team_id() : data.teamname)
|
||||
<< COLUMN_SEPARATOR;
|
||||
|
||||
if(!known && !game_config::debug) {
|
||||
|
|