Merge branch 'master' into campaignd_asio
This commit is contained in:
commit
31bbedd94e
38 changed files with 286 additions and 123 deletions
|
@ -49,7 +49,7 @@ opts.AddVariables(
|
|||
"wesnoth,wesnothd", Split("wesnoth wesnothd campaignd cutter exploder test")),
|
||||
EnumVariable('build', 'Build variant: debug, release profile or base (no subdirectory)', "release", ["release", "debug", "glibcxx_debug", "profile","base"]),
|
||||
PathVariable('build_dir', 'Build all intermediate files(objects, test programs, etc) under this dir', "build", PathVariable.PathAccept),
|
||||
('extra_flags_config', 'Extra compiler and linker flags to use for configuration and all builds', ""),
|
||||
('extra_flags_config', "Extra compiler and linker flags to use for configuration and all builds. Whether they're compiler or linker is determined by env.ParseFlags. Unknown flags are compile flags by default. This applies to all extra_flags_* variables", ""),
|
||||
('extra_flags_base', 'Extra compiler and linker flags to use for release builds', ""),
|
||||
('extra_flags_release', 'Extra compiler and linker flags to use for release builds', ""),
|
||||
('extra_flags_debug', 'Extra compiler and linker flags to use for debug builds', ""),
|
||||
|
@ -105,6 +105,7 @@ opts.AddVariables(
|
|||
('cxxtool', 'Set c++ compiler command if not using standard compiler.'),
|
||||
EnumVariable('cxx_std', 'Target c++ std version', '11', ['11', '14', '1y']),
|
||||
BoolVariable('openmp', 'Enable openmp use.', False),
|
||||
('sanitize', 'Enable clang and GCC sanitizer functionality. A comma separated list of sanitize suboptions must be passed as value.', ''),
|
||||
BoolVariable("fast", "Make scons faster at cost of less precise dependency tracking.", False),
|
||||
BoolVariable("lockfile", "Create a lockfile to prevent multiple instances of scons from being run at the same time on this working copy.", False),
|
||||
BoolVariable("OS_ENV", "Forward the entire OS environment to scons", False),
|
||||
|
@ -507,6 +508,8 @@ for env in [test_env, client_env, env]:
|
|||
|
||||
if env['strict']:
|
||||
env.AppendUnique(CCFLAGS = Split("-Werror -Wold-style-cast $(-Wno-unused-local-typedefs$)"))
|
||||
if env['sanitize']:
|
||||
env.AppendUnique(CCFLAGS = ["-fsanitize=" + env["sanitize"]], LINKFLAGS = ["-fsanitize=" + env["sanitize"]])
|
||||
|
||||
env["OPT_FLAGS"] = "-O2"
|
||||
env["DEBUG_FLAGS"] = Split("-O0 -DDEBUG -ggdb3")
|
||||
|
|
|
@ -189,13 +189,15 @@
|
|||
|
||||
[store_locations]
|
||||
[not]
|
||||
terrain=S*
|
||||
terrain=S*,D*
|
||||
[/not]
|
||||
|
||||
[filter_adjacent_location]
|
||||
x,y=$prison_locations[$i].x,$prison_locations[$i].y
|
||||
[/filter_adjacent_location]
|
||||
|
||||
include_borders=no
|
||||
|
||||
variable=guard_location
|
||||
[/store_locations]
|
||||
|
||||
|
|
|
@ -420,17 +420,32 @@
|
|||
message= _ "Good! Now, we must move onward, north. Tell the villagers to pack their belongings and head west."
|
||||
[/message]
|
||||
|
||||
[modify_unit]
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=Owaec
|
||||
[/filter]
|
||||
|
||||
side=1
|
||||
canrecruit=no
|
||||
{IS_HERO}
|
||||
[/modify_unit]
|
||||
kill=yes
|
||||
variable=stored_Owaec
|
||||
[/store_unit]
|
||||
|
||||
{CLEAR_VARIABLE bandit_villages,bandit_types,villages_visited,boss_found,shodrano_killed}
|
||||
[unit]
|
||||
side=1
|
||||
id=Owaec
|
||||
name= _ "Owaec"
|
||||
unrenamable=yes
|
||||
x,y=$stored_Owaec.x,$stored_Owaec.y
|
||||
type=$stored_Owaec.type
|
||||
experience=$stored_Owaec.experience
|
||||
profile=portraits/owaec.png
|
||||
{IS_HERO}
|
||||
random_traits=no
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
|
||||
{CLEAR_VARIABLE stored_Owaec,bandit_villages,bandit_types,villages_visited,boss_found,shodrano_killed}
|
||||
[/event]
|
||||
|
||||
{HOLY_AMULET 2 25}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
[/ai]
|
||||
|
||||
{LOYAL_UNIT () (Dwarvish Guardsman) 33 6} {GUARDIAN}
|
||||
{LOYAL_UNIT () (Dwarvish Guardsman) 41 7} {GUARDIAN}
|
||||
{LOYAL_UNIT () (Dwarvish Guardsman) 40 7} {GUARDIAN}
|
||||
[/side]
|
||||
|
||||
{LIMIT_CONTEMPORANEOUS_RECRUITS 2 "Dwarvish Steelclad" 2}
|
||||
|
@ -385,6 +385,8 @@
|
|||
[/message]
|
||||
[/event]
|
||||
|
||||
{HOLY_AMULET 10 2}
|
||||
|
||||
[event]
|
||||
name=enemies defeated
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
random_traits=no
|
||||
unrenamable=yes
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
{TEAM_COLOR_OVERRIDE () blue}
|
||||
[/modifications]
|
||||
#enddef
|
||||
|
|
|
@ -83,9 +83,9 @@ This is the story of Kalenz, Landar, and of the Elves in the first days of the h
|
|||
#enddef
|
||||
|
||||
[side]
|
||||
side=1
|
||||
side=1
|
||||
{PLAYABLE}
|
||||
# wmllint: who KALENZ is Kalenz
|
||||
# wmllint: who KALENZ_YOUNG is Kalenz
|
||||
{KALENZ_YOUNG}
|
||||
save_id=Kalenz
|
||||
x=16
|
||||
|
@ -93,7 +93,7 @@ This is the story of Kalenz, Landar, and of the Elves in the first days of the h
|
|||
|
||||
#ifndef MULTIPLAYER
|
||||
[unit]
|
||||
# wmllint: who LANDAR is Landar
|
||||
# wmllint: who LANDAR_YOUNG is Landar
|
||||
{LANDAR_YOUNG}
|
||||
x=18
|
||||
y=15
|
||||
|
@ -139,6 +139,7 @@ This is the story of Kalenz, Landar, and of the Elves in the first days of the h
|
|||
#### /Kalenz side ####
|
||||
|
||||
#### Landar's side ####
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
{PLAYABLE}
|
||||
{LANDAR_YOUNG}
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
[/event]
|
||||
### /Kalenz's code ###
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
x=20
|
||||
y=4
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
{PLAYER_GOLD}
|
||||
[/side]
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
no_leader=yes
|
||||
{PLAYABLE}
|
||||
|
@ -136,6 +137,7 @@
|
|||
# wmllint: recognize Galtrid
|
||||
[/side]
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 4 (
|
||||
no_leader=yes
|
||||
previous_save_id=Landar
|
||||
|
@ -1119,9 +1121,9 @@
|
|||
{CLEAR_VARIABLE orc_battlefield_strategy}
|
||||
|
||||
#ifdef MULTIPLAYER
|
||||
[persistent_carryover_store]
|
||||
scenario_id = LoW_Chapter_One
|
||||
[/persistent_carryover_store]
|
||||
[persistent_carryover_store]
|
||||
scenario_id = LoW_Chapter_One
|
||||
[/persistent_carryover_store]
|
||||
#endif
|
||||
[/event]
|
||||
{DEFAULT_VICTORY 0.5}
|
||||
|
@ -1132,3 +1134,5 @@
|
|||
#undef ORC_BATTLEFIELD_EVALUATION
|
||||
#undef ORC_BATTLEFIELD_EVALUATION_SUCCESS
|
||||
#undef ORC_BATTLEFIELD_EVALUATION_FAILURE
|
||||
# wmllint: unwho KALENZ_YOUNG
|
||||
# wmllint: unwho LANDAR_YOUNG
|
||||
|
|
|
@ -60,12 +60,14 @@ Chapter Two"
|
|||
|
||||
[side]
|
||||
side=1
|
||||
# wmllint: who KALENZ is Kalenz
|
||||
{KALENZ}
|
||||
{PLAYABLE}
|
||||
save_id=Kalenz
|
||||
{PLAYER_GOLD}
|
||||
#ifndef MULTIPLAYER
|
||||
[unit]
|
||||
# wmllint: who LANDAR is Landar
|
||||
{LANDAR}
|
||||
x=16
|
||||
y=29
|
||||
|
@ -76,6 +78,7 @@ Chapter Two"
|
|||
|
||||
#Landar's side
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
{LANDAR}
|
||||
save_id=Landar
|
||||
|
@ -83,6 +86,7 @@ Chapter Two"
|
|||
{PLAYER_GOLD}
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 3 (
|
||||
no_leader=yes
|
||||
save_id=Cleodil
|
||||
|
@ -186,9 +190,9 @@ Chapter Two"
|
|||
[/objectives]
|
||||
|
||||
#ifdef MULTIPLAYER
|
||||
[persistent_carryover_unstore]
|
||||
scenario_id = LoW_Chapter_One
|
||||
[/persistent_carryover_unstore]
|
||||
[persistent_carryover_unstore]
|
||||
scenario_id = LoW_Chapter_One
|
||||
[/persistent_carryover_unstore]
|
||||
#endif
|
||||
# wmllint: who RECALL_LOYALS is Huraldur
|
||||
#{RECALL_LOYALS}
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#endif
|
||||
[/side]
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
no_leader=yes
|
||||
{PLAYABLE}
|
||||
|
@ -98,6 +99,7 @@
|
|||
[/unit]
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 3 (
|
||||
no_leader=yes
|
||||
{PLAYABLE}
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
{RECALL_LOYALS}
|
||||
[/event]
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
{PLAYABLE}
|
||||
save_id=Landar
|
||||
|
@ -81,6 +82,7 @@
|
|||
[/unit]
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 3 (
|
||||
{PLAYABLE}
|
||||
save_id=Cleodil
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
{RECALL_LOYALS}
|
||||
[/event]
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
no_leader=yes
|
||||
{PLAYABLE}
|
||||
|
@ -114,6 +115,7 @@
|
|||
[/unit]
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 3 (
|
||||
no_leader=yes
|
||||
{PLAYABLE}
|
||||
|
@ -163,6 +165,7 @@
|
|||
#endif
|
||||
[/side]
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 5 (
|
||||
{PLAYABLE}
|
||||
{EL_ISOMITHIR}
|
||||
|
@ -173,6 +176,7 @@
|
|||
{GOLD 133 100 65}
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 6 (
|
||||
{PLAYABLE}
|
||||
{ERADION}
|
||||
|
|
|
@ -139,9 +139,8 @@
|
|||
[event]
|
||||
name=victory
|
||||
|
||||
[persistent_carryover_store]
|
||||
scenario_id = LoW_Chapter_Two
|
||||
[/persistent_carryover_store]
|
||||
|
||||
[persistent_carryover_store]
|
||||
scenario_id = LoW_Chapter_Two
|
||||
[/persistent_carryover_store]
|
||||
[/event]
|
||||
[/scenario]
|
||||
|
|
|
@ -80,6 +80,7 @@ Chapter Three"
|
|||
[/side]
|
||||
|
||||
#Landar's side
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
{PLAYABLE}
|
||||
save_id=Landar
|
||||
|
@ -93,6 +94,7 @@ Chapter Three"
|
|||
)}
|
||||
|
||||
#Olurf's side
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 3 (
|
||||
{PLAYABLE}
|
||||
save_id=Olurf
|
||||
|
@ -108,6 +110,7 @@ Chapter Three"
|
|||
)}
|
||||
|
||||
#Cleodil's side
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 4 (
|
||||
{PLAYABLE}
|
||||
save_id=Cleodil
|
||||
|
@ -226,9 +229,9 @@ Chapter Three"
|
|||
# wmllint: recognize Anduilas
|
||||
|
||||
#ifdef MULTIPLAYER
|
||||
[persistent_carryover_unstore]
|
||||
scenario_id = LoW_Chapter_Two
|
||||
[/persistent_carryover_unstore]
|
||||
[persistent_carryover_unstore]
|
||||
scenario_id = LoW_Chapter_Two
|
||||
[/persistent_carryover_unstore]
|
||||
#endif
|
||||
|
||||
#define LEAVE_BEHIND_L3 NAME SIDE
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#endif
|
||||
[/side]
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
no_leader=yes
|
||||
{MULTIPLAYER_GOLD}
|
||||
|
@ -80,6 +81,7 @@
|
|||
[/unit]
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 3 (
|
||||
no_leader=yes
|
||||
{MULTIPLAYER_GOLD}
|
||||
|
@ -91,6 +93,7 @@
|
|||
[/unit]
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 4 (
|
||||
no_leader=yes
|
||||
{MULTIPLAYER_GOLD}
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#endif
|
||||
[/side]
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 2 (
|
||||
{PLAYABLE}
|
||||
save_id=Landar
|
||||
|
@ -82,6 +83,7 @@
|
|||
[/unit]
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 3 (
|
||||
{PLAYABLE}
|
||||
save_id=Olurf
|
||||
|
@ -92,6 +94,7 @@
|
|||
[/unit]
|
||||
)}
|
||||
|
||||
# wmllint: skip-side
|
||||
{MP_SIDE 4 (
|
||||
{PLAYABLE}
|
||||
save_id=Cleodil
|
||||
|
|
|
@ -291,9 +291,9 @@
|
|||
|
||||
[event]
|
||||
name=victory
|
||||
[persistent_carryover_store]
|
||||
scenario_id = LoW_Chapter_Three
|
||||
[/persistent_carryover_store]
|
||||
[persistent_carryover_store]
|
||||
scenario_id = LoW_Chapter_Three
|
||||
[/persistent_carryover_store]
|
||||
[/event]
|
||||
#endif
|
||||
[/scenario]
|
||||
|
|
|
@ -107,9 +107,9 @@
|
|||
name=start
|
||||
|
||||
#ifdef MULTIPLAYER
|
||||
[persistent_carryover_unstore]
|
||||
scenario_id = LoW_Chapter_Three
|
||||
[/persistent_carryover_unstore]
|
||||
[persistent_carryover_unstore]
|
||||
scenario_id = LoW_Chapter_Three
|
||||
[/persistent_carryover_unstore]
|
||||
#endif
|
||||
|
||||
#TODO recall or create if not recallable
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
name=prestart
|
||||
|
||||
# modify 2/3 of the non-loyal, non-shaman-line units to join Landar
|
||||
# TODO: This this still needed in mp?
|
||||
# TODO: This this still needed in mp?
|
||||
{MODIFY_UNIT (id=Landar) side 3}
|
||||
[store_unit]
|
||||
#TODO spellcheck
|
||||
|
@ -213,7 +213,7 @@
|
|||
|
||||
[event]
|
||||
name=prestart
|
||||
# TODO: shouldn't Landar already be able to recuit?
|
||||
# TODO: shouldn't Landar already be able to recuit?
|
||||
{MODIFY_UNIT id=Landar canrecruit yes}
|
||||
[/event]
|
||||
|
||||
|
@ -321,7 +321,7 @@
|
|||
bonus=yes
|
||||
carryover_percentage=80
|
||||
[/gold_carryover]
|
||||
|
||||
|
||||
[note]
|
||||
description= _ "If you loose you still have a chance to defeat Kalenz in the next scenario."
|
||||
[/note]
|
||||
|
@ -356,11 +356,11 @@
|
|||
[/message]
|
||||
[endlevel]
|
||||
result=victory
|
||||
next_scenario=null
|
||||
[result]
|
||||
side = 3
|
||||
result = "defeat"
|
||||
[/result]
|
||||
next_scenario=null
|
||||
[result]
|
||||
side = 3
|
||||
result = "defeat"
|
||||
[/result]
|
||||
[/endlevel]
|
||||
[/event]
|
||||
|
||||
|
@ -378,11 +378,11 @@
|
|||
|
||||
[endlevel]
|
||||
result=victory
|
||||
next_scenario=null
|
||||
[result]
|
||||
side = 3
|
||||
result = "defeat"
|
||||
[/result]
|
||||
next_scenario=null
|
||||
[result]
|
||||
side = 3
|
||||
result = "defeat"
|
||||
[/result]
|
||||
[/endlevel]
|
||||
[/event]
|
||||
|
||||
|
|
|
@ -151,14 +151,14 @@ Elvish Shaman, Elvish Shyde, Elvish Enchantress, Elvish Sorceress, Elvish Sylph,
|
|||
num_items=1
|
||||
variable=random_placement_location
|
||||
[filter_location]
|
||||
x,y={_X},{_Y}
|
||||
radius={_RADIUS}
|
||||
[/filter_location]
|
||||
x,y={_X},{_Y}
|
||||
radius={_RADIUS}
|
||||
[/filter_location]
|
||||
[command]
|
||||
{_WML}
|
||||
[+unit]
|
||||
x,y=$random_placement_location.x,$random_placement_location.y
|
||||
[/unit]
|
||||
{_WML}
|
||||
[+unit]
|
||||
x,y=$random_placement_location.x,$random_placement_location.y
|
||||
[/unit]
|
||||
[/command]
|
||||
[/random_placement]
|
||||
#enddef
|
||||
|
|
|
@ -1231,8 +1231,10 @@ Icons are taken from the Tango Desktop Project (http://tango.freedesktop.org), a
|
|||
"Do you really want to quit?",
|
||||
icon = WARNING)
|
||||
if answer:
|
||||
ICONS.clear()
|
||||
self.parent.destroy()
|
||||
else:
|
||||
ICONS.clear()
|
||||
self.parent.destroy()
|
||||
|
||||
root=Tk()
|
||||
|
|
|
@ -23,7 +23,7 @@ html_header = '''
|
|||
|
||||
top_bar = '''
|
||||
<div class="header">
|
||||
<a href="http://www.wesnoth.org">
|
||||
<a href="//www.wesnoth.org">
|
||||
<img src="%(path)swesnoth-logo.jpg" alt="Wesnoth logo"/>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -34,8 +34,8 @@ top_bar = '''
|
|||
html_footer = '''
|
||||
<div id="footer">
|
||||
<p>%(generation_note)s</p>
|
||||
<p><a href="http://wiki.wesnoth.org/Site_Map">Site map</a></p>
|
||||
<p><a href="http://www.wesnoth.org/wiki/Wesnoth:Copyrights">Copyright</a> © 2003–2016 The Battle for Wesnoth</p>
|
||||
<p><a href="//wiki.wesnoth.org/Site_Map">Site map</a></p>
|
||||
<p><a href="//wiki.wesnoth.org/Wesnoth:Copyrights">Copyright</a> © 2003–2016 The Battle for Wesnoth</p>
|
||||
<p>Supported by <a href="http://www.jexiste.fr/">Jexiste</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1169,9 +1169,9 @@ def local_sanity_check(filename, nav, key, prefix, value, comment):
|
|||
if ancestors:
|
||||
parent = ancestors[-1]
|
||||
ancestors = ancestors[:-1]
|
||||
# Check for things marked translated that aren't strings
|
||||
# Check for things marked translated that aren't strings or name generators
|
||||
if "_" in nav.text and not ignored:
|
||||
m = re.search(r'[=(]\s*_\s+("?)', nav.text)
|
||||
m = re.search(r'[=(]\s*_\s+("|<<)?', nav.text)
|
||||
if m and not m.group(1):
|
||||
print(errlead + 'translatability mark before non-string')
|
||||
# Most tags are not allowed with [part]
|
||||
|
@ -1573,6 +1573,12 @@ def global_sanity_check(filename, lines):
|
|||
in_unstore = False
|
||||
in_not = False
|
||||
in_clear = False
|
||||
in_checkbox = False
|
||||
in_combo = False
|
||||
in_entry = False
|
||||
in_slider = False
|
||||
in_map_generator = False
|
||||
in_name_generator = False
|
||||
storeid = None
|
||||
storevar = None
|
||||
ignoreable = False
|
||||
|
@ -1581,6 +1587,7 @@ def global_sanity_check(filename, lines):
|
|||
capitalization_error = re.compile("(?<=[.!?]) +[a-z]")
|
||||
markcheck = True
|
||||
translation_mark = re.compile(r'_ *"')
|
||||
name_generator_re = re.compile(r"name_generator\s*=\s*_\s*<<")
|
||||
for i in range(len(lines)):
|
||||
if '[' in lines[i]:
|
||||
preamble_seen = True
|
||||
|
@ -1695,6 +1702,31 @@ def global_sanity_check(filename, lines):
|
|||
in_clear = True
|
||||
elif "[/clear_variable]" in lines[i]:
|
||||
in_clear = False
|
||||
# sub-tags of [options] tag
|
||||
elif "[checkbox]" in lines[i]:
|
||||
in_checkbox = True
|
||||
elif "[/checkbox]" in lines[i]:
|
||||
in_checkbox = False
|
||||
elif "[combo]" in lines[i]:
|
||||
in_combo = True
|
||||
elif "[/combo]" in lines[i]:
|
||||
in_combo = False
|
||||
elif "[entry]" in lines[i]:
|
||||
in_entry = True
|
||||
elif "[/entry]" in lines[i]:
|
||||
in_entry = False
|
||||
elif "[slider]" in lines[i]:
|
||||
in_slider = True
|
||||
elif "[/slider]" in lines[i]:
|
||||
in_slider = False
|
||||
elif "[generator]" in lines[i]:
|
||||
in_map_generator = True
|
||||
elif "[/generator]" in lines[i]:
|
||||
in_map_generator = False
|
||||
elif name_generator_re.search(lines[i]):
|
||||
in_name_generator = True
|
||||
elif in_name_generator and ">>" in lines[i]:
|
||||
in_name_generator = False
|
||||
if "wmllint: markcheck off" in lines[i]:
|
||||
markcheck = False
|
||||
elif "wmllint: markcheck on" in lines[i]:
|
||||
|
@ -1839,6 +1871,8 @@ def global_sanity_check(filename, lines):
|
|||
pass
|
||||
elif key.startswith("{"):
|
||||
pass
|
||||
elif in_name_generator:
|
||||
pass
|
||||
elif key == 'letter': # May be led with _s for void
|
||||
pass
|
||||
elif key in ('name', 'male_name', 'female_name', 'value'): # FIXME: check this someday
|
||||
|
@ -1873,7 +1907,14 @@ def global_sanity_check(filename, lines):
|
|||
present.append(value)
|
||||
elif value and value[0] in ("$", "{"):
|
||||
continue
|
||||
elif preamble_seen and subtag_depth > 0 and not ignore_id and not in_object and not in_cfg and not in_facet and not in_sound_source and not in_remove_sound_source and not in_stage and not in_goal and not in_set_menu_item and not in_clear_menu_item and not directly_in_event[-1] and not in_time_area and not in_trait:
|
||||
elif preamble_seen and subtag_depth > 0 and not ignore_id \
|
||||
and not in_object and not in_cfg and not in_facet \
|
||||
and not in_sound_source and not in_remove_sound_source \
|
||||
and not in_stage and not in_goal and not in_set_menu_item \
|
||||
and not in_clear_menu_item and not directly_in_event[-1] \
|
||||
and not in_time_area and not in_trait and not in_checkbox \
|
||||
and not in_combo and not in_entry and not in_slider \
|
||||
and not in_map_generator:
|
||||
ids = value.split(",")
|
||||
for id_ in ids:
|
||||
# removal of leading whitespace of items in comma-separated lists
|
||||
|
@ -2626,9 +2667,10 @@ def inner_spellcheck(nav, value, spelldict):
|
|||
value = value.replace(old, new)
|
||||
|
||||
if '<' in value:
|
||||
value = re.sub("<ref>.*< ref>", "", value)
|
||||
value = re.sub("<[^>]+>text='([^']*)'<[^>]+>", r"\1", value)
|
||||
value = re.sub("<[0-9,]+>", "", value)
|
||||
# remove HelpWML markup and extract its text content where needed
|
||||
value = re.sub(r"<(ref|format)>.*?text='(.*?)'.*?< \1>", r"\2", value)
|
||||
value = re.sub(r"<(jump|img)>.*?< \1>", "", value)
|
||||
value = re.sub(r"<(italic|bold|header)>text='(.*?)'< \1>", r"\2", value)
|
||||
# Fold continued lines
|
||||
value = re.sub(r'" *\+\s*_? *"', "", value)
|
||||
# It would be nice to use pyenchant's tokenizer here, but we can't
|
||||
|
|
|
@ -1015,8 +1015,6 @@
|
|||
<Unit filename="../../src/text.hpp" />
|
||||
<Unit filename="../../src/theme.cpp" />
|
||||
<Unit filename="../../src/theme.hpp" />
|
||||
<Unit filename="../../src/thread.cpp" />
|
||||
<Unit filename="../../src/thread.hpp" />
|
||||
<Unit filename="../../src/time_of_day.cpp" />
|
||||
<Unit filename="../../src/time_of_day.hpp" />
|
||||
<Unit filename="../../src/tod_manager.cpp" />
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# vi: syntax=python:et:ts=4
|
||||
from config_check_utils import find_include
|
||||
from os.path import join, dirname, basename
|
||||
import sys, os.path
|
||||
from glob import glob
|
||||
import re
|
||||
|
||||
|
@ -69,10 +70,11 @@ def CheckBoost(context, boost_lib, require_version = None, header_only = False):
|
|||
header_name = boost_headers.get(boost_lib, boost_lib + ".hpp")
|
||||
libname = "boost_" + boost_lib + env.get("boost_suffix", "")
|
||||
|
||||
if env["fast"]:
|
||||
env.AppendUnique(CXXFLAGS = ["-isystem", boostdir], LIBPATH = [boostlibdir])
|
||||
else:
|
||||
env.AppendUnique(CPPPATH = [boostdir], LIBPATH = [boostlibdir])
|
||||
if sys.platform != "win32" and not os.path.samefile(boostdir, "/usr/include"):
|
||||
if env["fast"]:
|
||||
env.AppendUnique(CXXFLAGS = ["-isystem", boostdir], LIBPATH = [boostlibdir])
|
||||
else:
|
||||
env.AppendUnique(CPPPATH = [boostdir], LIBPATH = [boostlibdir])
|
||||
if not header_only:
|
||||
env.AppendUnique(LIBS = [libname])
|
||||
if boost_lib == "thread" and env["PLATFORM"] == "posix":
|
||||
|
|
|
@ -321,6 +321,11 @@ void undo_list::read(const config & cfg)
|
|||
undo_action_base * action = create_action(child);
|
||||
if ( undo_action* undoable_action = dynamic_cast<undo_action*>(action)) {
|
||||
redos_.push_back(undoable_action);
|
||||
} else {
|
||||
delete action;
|
||||
ERR_NG << "Error: redo contained action that is not undoable" << std::endl;
|
||||
ERR_NG << "config was: " << child.debug() << std::endl;
|
||||
ERR_NG << "Skipping this redo action..." << std::endl;
|
||||
}
|
||||
} catch (bad_lexical_cast &) {
|
||||
ERR_NG << "Error when parsing redo list from config: bad lexical cast." << std::endl;
|
||||
|
|
|
@ -316,7 +316,11 @@ struct write_addon_connection_data : public gui2::tnetwork_transmission::connect
|
|||
void addons_client::wait_for_transfer_done(const std::string& status_message, bool track_upload)
|
||||
{
|
||||
check_connected();
|
||||
std::unique_ptr<gui2::tnetwork_transmission::connection_data> cd(track_upload ? new write_addon_connection_data{ *conn_ } : new write_addon_connection_data{ *conn_ });
|
||||
std::unique_ptr<gui2::tnetwork_transmission::connection_data> cd;
|
||||
if(track_upload)
|
||||
cd.reset(new write_addon_connection_data{ *conn_ });
|
||||
else
|
||||
cd.reset(new read_addon_connection_data{ *conn_ });
|
||||
if(!stat_) {
|
||||
stat_ = new gui2::tnetwork_transmission(*cd, _("Add-ons Manager"), status_message);
|
||||
} else {
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "strftime.hpp"
|
||||
#include "synced_context.hpp"
|
||||
#include "terrain/type_data.hpp"
|
||||
#include "thread.hpp"
|
||||
#include "units/unit.hpp"
|
||||
#include "units/animation.hpp"
|
||||
#include "units/helper.hpp"
|
||||
|
|
|
@ -106,7 +106,6 @@ static lg::log_domain log_enginerefac("enginerefac");
|
|||
game_launcher::game_launcher(const commandline_options& cmdline_opts, const char *appname) :
|
||||
cmdline_opts_(cmdline_opts),
|
||||
video_(new CVideo()),
|
||||
thread_manager(),
|
||||
font_manager_(),
|
||||
prefs_manager_(),
|
||||
image_manager_(),
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include "saved_game.hpp" // for saved_game
|
||||
#include "scoped_resource.hpp" // for scoped_ptr
|
||||
#include "sound.hpp" // for music_thinker
|
||||
#include "thread.hpp" // for manager
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <string> // for string
|
||||
#include <vector> // for vector
|
||||
|
||||
|
@ -108,10 +108,6 @@ private:
|
|||
//Never null.
|
||||
boost::scoped_ptr<CVideo> video_;
|
||||
|
||||
//this should get destroyed *after* the video, since we want
|
||||
//to clean up threads after the display disappears.
|
||||
const threading::manager thread_manager;
|
||||
|
||||
const font::manager font_manager_;
|
||||
const preferences::manager prefs_manager_;
|
||||
const image::manager image_manager_;
|
||||
|
|
|
@ -71,6 +71,8 @@ tloadscreen::tloadscreen(std::function<void()> f)
|
|||
, work_(f)
|
||||
, worker_()
|
||||
, cursor_setter_()
|
||||
, progress_stage_label_(nullptr)
|
||||
, animation_label_(nullptr)
|
||||
, current_stage_(nullptr)
|
||||
, visible_stages_()
|
||||
, animation_stages_()
|
||||
|
|
|
@ -58,6 +58,7 @@ REGISTER_DIALOG(synced_choice_wait)
|
|||
tsynced_choice_wait::tsynced_choice_wait(user_choice_manager& mgr)
|
||||
: mgr_(mgr)
|
||||
, message_()
|
||||
, window_(nullptr)
|
||||
{
|
||||
mgr_.changed_event_.attach_handler(this);
|
||||
}
|
||||
|
|
|
@ -831,7 +831,8 @@ bool luaW_pushvariable(lua_State *L, variable_access_const& v)
|
|||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
lua_pushnil(L);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (const invalid_variablename_exception&)
|
||||
|
|
|
@ -135,10 +135,10 @@ void server_base::handle_termination(const boost::system::error_code& error, int
|
|||
{
|
||||
assert(!error);
|
||||
|
||||
const char* signame;
|
||||
std::string signame;
|
||||
if(signal_number == SIGINT) signame = "SIGINT";
|
||||
else if(signal_number == SIGTERM) signame = "SIGTERM";
|
||||
else signame = lexical_cast<std::string>(signal_number).c_str();
|
||||
else signame = lexical_cast<std::string>(signal_number);
|
||||
LOG_SERVER << signame << " caught, exiting without cleanup immediately.\n";
|
||||
exit(128 + signal_number);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Script to compare images pixel-by-pixel to detect corruption due to
|
||||
# problems in tools such as optipng.
|
||||
|
@ -36,7 +36,7 @@ for path1, path2 in zip(list1, list2):
|
|||
image1 = PIL.open(path1)
|
||||
image2 = PIL.open(path2)
|
||||
|
||||
if image1.tostring() != image2.tostring():
|
||||
if image1.tobytes() != image2.tobytes():
|
||||
print (path1 + " and " + path2 + " differ!")
|
||||
|
||||
# vim: ts=4:sw=4:expandtab
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from pywmlx.wmlerr import ansi_setEnabled
|
||||
from pywmlx.wmlerr import wincol_setEnabled
|
||||
from pywmlx.wmlerr import wmlerr
|
||||
from pywmlx.wmlerr import wmlwarn
|
||||
from pywmlx.wmlerr import set_warnall
|
||||
|
|
|
@ -1,12 +1,38 @@
|
|||
import os
|
||||
import sys
|
||||
import warnings
|
||||
import ctypes
|
||||
import struct
|
||||
|
||||
enabled_ansi_col = True
|
||||
enabled_text_col = True
|
||||
is_utest = False
|
||||
_warnall = False
|
||||
|
||||
|
||||
# these constants are used by the Win32 API
|
||||
FG_RED = 4
|
||||
FG_GREEN = 2
|
||||
FG_BLUE = 1
|
||||
FG_INTENSITY = 8
|
||||
BG_RED = 64
|
||||
BG_GREEN = 32
|
||||
BG_BLUE = 16
|
||||
BG_INTENSITY = 128
|
||||
STD_INPUT_HANDLE = -10
|
||||
STD_OUTPUT_HANDLE = -11
|
||||
STD_ERROR_HANDLE = -12
|
||||
|
||||
# there are three ways to store the console's default status
|
||||
# the first requires to redefine the C structures used by the Win32 API
|
||||
# by using the ctypes.Structure class, and pass them by reference
|
||||
# by using ctypes.byref
|
||||
# the second requires to use ctypes.create_string_buffer
|
||||
# the third one just requires to create an empty bytes object
|
||||
# both of them must be able to contain exactly 22 bytes/characters
|
||||
# and you need to use the struct module to decode the values
|
||||
console_defaults = bytes(22)
|
||||
|
||||
|
||||
def wmlerr_debug():
|
||||
global is_utest
|
||||
is_utest = True
|
||||
|
@ -14,9 +40,30 @@ def wmlerr_debug():
|
|||
|
||||
|
||||
def ansi_setEnabled(value):
|
||||
global enabled_ansi_col
|
||||
enabled_ansi_col = value
|
||||
|
||||
global enabled_text_col
|
||||
enabled_text_col = value
|
||||
|
||||
|
||||
|
||||
def wincol_setEnabled(value):
|
||||
global enabled_text_col
|
||||
global handle
|
||||
global default_console_status
|
||||
global default_color
|
||||
enabled_text_col = value
|
||||
if sys.platform.startswith('win') and enabled_text_col:
|
||||
# and now, let's start playing with the Win32 API
|
||||
# first of all, we need to get a handle to the console output
|
||||
handle = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
|
||||
# and then we store the current console status
|
||||
# to be able to reset the original color
|
||||
ctypes.windll.kernel32.GetConsoleScreenBufferInfo(handle,
|
||||
console_defaults)
|
||||
# by using struct.unpack_from, platform endianness is automatically
|
||||
# handled
|
||||
# this is why I'm using it, instead of a bitwise operation
|
||||
default_color = struct.unpack_from("H", console_defaults, 8)[0]
|
||||
|
||||
|
||||
|
||||
def warnall():
|
||||
|
@ -37,36 +84,57 @@ class WmlWarning(UserWarning):
|
|||
|
||||
|
||||
|
||||
def print_wmlerr(message, iserr):
|
||||
ansi_color = '\033[91;1m' #red
|
||||
errtype = "error:"
|
||||
if iserr is False:
|
||||
ansi_color = '\033[94m' #blue
|
||||
errtype = "warning:"
|
||||
def print_wmlerr(finfo, message, iserr):
|
||||
# red if error, blue if warning
|
||||
ansi_color = '\033[91;1m' if iserr else '\033[94m'
|
||||
errtype = "error:" if iserr else "warning:"
|
||||
# now we have ascii_color and errtype values
|
||||
# here we print the error/warning.
|
||||
# 1) On posix we write "error" in red and "warning" in blue
|
||||
if os.name == "posix" and enabled_ansi_col is True:
|
||||
msg = ansi_color + errtype + ' ' + message
|
||||
# 2) On non-posix systems (ex. windows) we don't use colors
|
||||
# here we print the error/warning.
|
||||
# 1) On Windows, write "error" in red and "warning" in blue
|
||||
# by using the Win32 API (except if --no-text-colors is used)
|
||||
if sys.platform.startswith('win') and enabled_text_col:
|
||||
# a syntactic sugar to make lines shorter
|
||||
kernel32 = ctypes.windll.kernel32
|
||||
# first flush the stderr, otherwise colors might be changed in
|
||||
# unpredictable ways
|
||||
sys.stderr.flush()
|
||||
if iserr:
|
||||
kernel32.SetConsoleTextAttribute(handle, FG_RED | FG_INTENSITY)
|
||||
else:
|
||||
kernel32.SetConsoleTextAttribute(handle, FG_BLUE | FG_INTENSITY)
|
||||
# then write the error type and continue on the same line
|
||||
print(errtype + " ", end="", file=sys.stderr)
|
||||
# flush again and write file name in yellow on the same line
|
||||
sys.stderr.flush()
|
||||
kernel32.SetConsoleTextAttribute(handle,
|
||||
FG_RED | FG_GREEN | FG_INTENSITY)
|
||||
print(finfo + ": ", end="", file=sys.stderr)
|
||||
# then flush again, reset the color and finish writing
|
||||
sys.stderr.flush()
|
||||
ctypes.windll.kernel32.SetConsoleTextAttribute(handle, default_color)
|
||||
print(message, file=sys.stderr)
|
||||
# finally flush again for good measure
|
||||
sys.stderr.flush()
|
||||
# 2) On posix we write "error" in red and "warning" in blue
|
||||
# by using ansi escape codes (except if --no-text-colors is used)
|
||||
elif os.name == "posix" and enabled_text_col:
|
||||
msg = (ansi_color + errtype + ' \033[0m\033[93m' + finfo +
|
||||
':\033[0m ' + message)
|
||||
print(msg, file=sys.stderr)
|
||||
# 3) On non-posix and non-windows system we don't use colors
|
||||
# (is it ever possible?).
|
||||
# If --no-text-colors option is used, than we don't use colors
|
||||
# regardless of OS.
|
||||
else:
|
||||
msg = errtype + ' ' + message
|
||||
print(msg, file=sys.stderr)
|
||||
|
||||
|
||||
|
||||
def dualcol_message(finfo, message):
|
||||
if os.name == "posix" and enabled_ansi_col is True:
|
||||
msg = '\033[0m\033[93m' + finfo + ':\033[0m ' + message
|
||||
else:
|
||||
msg = finfo + ': ' + message
|
||||
return msg
|
||||
|
||||
msg = errtype + ' ' + finfo + ': ' + message
|
||||
print(msg, file=sys.stderr)
|
||||
|
||||
|
||||
|
||||
def my_showwarning(message, category, filename, lineno, file=None, line=None):
|
||||
try:
|
||||
print_wmlerr(message.args[0], False)
|
||||
finfo, msg = message.args[0].split(": ", 1)
|
||||
print_wmlerr(finfo, msg, False)
|
||||
except OSError:
|
||||
pass # the file (probably stderr) is invalid - this warning gets lost.
|
||||
|
||||
|
@ -79,18 +147,15 @@ warnings.showwarning = my_showwarning
|
|||
def wmlerr(finfo, message, errtype=WmlError):
|
||||
if not is_utest:
|
||||
try:
|
||||
msg = dualcol_message(finfo, message)
|
||||
raise errtype(msg)
|
||||
raise errtype(finfo + ": " + message)
|
||||
except errtype as err:
|
||||
print_wmlerr(err.args[0], True)
|
||||
print_wmlerr(finfo, message, True)
|
||||
sys.exit(1)
|
||||
else:
|
||||
msg = dualcol_message(finfo, message)
|
||||
raise errtype(msg)
|
||||
raise errtype(finfo + ": " + message)
|
||||
|
||||
|
||||
|
||||
def wmlwarn(finfo, message):
|
||||
msg = dualcol_message(finfo, message)
|
||||
warnings.warn(msg, WmlWarning)
|
||||
warnings.warn(finfo + ": " + message, WmlWarning)
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#
|
||||
#
|
||||
# By Nobun, october 2015
|
||||
# Thanks to Elvish Hunter for writing code for coloring text under windows
|
||||
#
|
||||
# PURPOSE
|
||||
#
|
||||
|
@ -44,7 +45,7 @@ def commandline(args):
|
|||
usage='''wmlxgettext --domain=DOMAIN [--directory=START_PATH]
|
||||
[--recursive] [--initialdomain=INITIALDOMAIN]
|
||||
[--package-version=PACKAGE_VERSION]
|
||||
[--no-ansi-colors] [--fuzzy] [--warnall] [-o OUTPUT_FILE]
|
||||
[--no-text-colors] [--fuzzy] [--warnall] [-o OUTPUT_FILE]
|
||||
FILE1 FILE2 ... FILEN'''
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -89,15 +90,12 @@ def commandline(args):
|
|||
'help you to save a bit of time')
|
||||
)
|
||||
parser.add_argument(
|
||||
'--no-ansi-colors',
|
||||
'--no-text-colors',
|
||||
action='store_false',
|
||||
default=True,
|
||||
dest='ansi_col',
|
||||
dest='text_col',
|
||||
help=("By default warnings are displayed with colored text. You can "
|
||||
"disable this feature using this flag.\n"
|
||||
"This option doesn't have any effect on windows, since it "
|
||||
"doesn't support ansi colors (on windows colors are ALWAYS"
|
||||
' disabled).')
|
||||
"disable this feature using this flag.")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--warnall',
|
||||
|
@ -135,7 +133,8 @@ def commandline(args):
|
|||
|
||||
def main():
|
||||
args = commandline(sys.argv[1:])
|
||||
pywmlx.ansi_setEnabled(args.ansi_col)
|
||||
pywmlx.ansi_setEnabled(args.text_col)
|
||||
pywmlx.wincol_setEnabled(args.text_col)
|
||||
pywmlx.set_warnall(args.warnall)
|
||||
startPath = os.path.realpath(os.path.normpath(args.start_path))
|
||||
sentlist = dict()
|
||||
|
|
Loading…
Add table
Reference in a new issue