Merge branch 'master' of github.com:wesnoth/wesnoth-old
This commit is contained in:
commit
abe67d8136
9 changed files with 50 additions and 50 deletions
|
@ -127,7 +127,7 @@ for filename in args:
|
|||
result.append("#generated from: " + line.strip())
|
||||
result.append("#Please do not modify")
|
||||
|
||||
for i in range(2**len(optional_params) - 2, -1, -1):
|
||||
for i in xrange(2**len(optional_params) - 2, -1, -1):
|
||||
enabled_map = dict([(param, i & (1<<index) != 0) for index, param in enumerate(optional_params)])
|
||||
|
||||
suffix = ""
|
||||
|
|
|
@ -27,7 +27,7 @@ for filename in sys.argv[1:]:
|
|||
basecolors = map(lambda (n, rgb): rgb, colortables[0][1])
|
||||
basecolors.sort()
|
||||
subtracted = []
|
||||
for i in range(1, len(colortables)):
|
||||
for i in xrange(1, len(colortables)):
|
||||
exiguous = []
|
||||
for (n, rgb) in colortables[i][1]:
|
||||
if rgb not in basecolors:
|
||||
|
|
|
@ -170,7 +170,7 @@ class JourneyTracks:
|
|||
definitions = []
|
||||
for name in self.track_order:
|
||||
track = self.tracks[name]
|
||||
index_tuples = zip(range(len(track)), track)
|
||||
index_tuples = zip(xrange(len(track)), track)
|
||||
index_tuples = filter(lambda (i, (a, x, y)): a in segmenters,
|
||||
index_tuples)
|
||||
endpoints = map(lambda (i, t): i, index_tuples)
|
||||
|
@ -181,7 +181,7 @@ class JourneyTracks:
|
|||
stagename = "%s_STAGE%d" % (outname, i+1,)
|
||||
definitions.append(stagename)
|
||||
fp.write("#define %s\n" % stagename)
|
||||
for j in range(0, e+1):
|
||||
for j in xrange(0, e+1):
|
||||
age="OLD"
|
||||
if i == 0 or j > endpoints[i-1]:
|
||||
age = "NEW"
|
||||
|
@ -192,7 +192,7 @@ class JourneyTracks:
|
|||
endname = "%s_END" % stagename
|
||||
fp.write("#define %s\n" % endname)
|
||||
definitions.append(endname)
|
||||
for j in range(0, e+1):
|
||||
for j in xrange(0, e+1):
|
||||
age="OLD"
|
||||
if j == endpoints[i]:
|
||||
age = "NEW"
|
||||
|
@ -203,7 +203,7 @@ class JourneyTracks:
|
|||
completename = "%s_COMPLETE" % name
|
||||
fp.write("#define %s\n" % completename)
|
||||
definitions.append(completename)
|
||||
for j in range(len(track)):
|
||||
for j in xrange(len(track)):
|
||||
waypoint = track[j]
|
||||
fp.write(" {OLD_%s %d %d}\n" % tuple(waypoint))
|
||||
fp.write("#enddef\n\n")
|
||||
|
@ -317,7 +317,7 @@ class JourneyTracks:
|
|||
def neighbors(self, x, y):
|
||||
"Return list of neighbors on selected track, enumerated and sorted by distance."
|
||||
neighbors = []
|
||||
candidates = zip(range(len(self.selected_track())), self.selected_track())
|
||||
candidates = zip(xrange(len(self.selected_track())), self.selected_track())
|
||||
candidates.sort(lambda (i1, (a1, x1, y1)), (i2, (a2, x2, y2)): cmp(distance(x, y, x1, y1), distance(x, y, x2, y2)))
|
||||
return candidates
|
||||
def find(self, x, y):
|
||||
|
@ -384,7 +384,7 @@ class ContextPopup:
|
|||
for (possible, item) in self.editor.journey.neighbors(x, y):
|
||||
if within(x, y, self.editor.box(item)):
|
||||
stagecount = 0
|
||||
for i in range(possible):
|
||||
for i in xrange(possible):
|
||||
(action, xn, yn) = self.editor.journey[i]
|
||||
if action in segmenters:
|
||||
stagecount += 1
|
||||
|
|
|
@ -145,7 +145,7 @@ def convert_color(color, hex=False):
|
|||
sys.exit(1)
|
||||
else:
|
||||
new[c] = color['mid'][c]
|
||||
if new[c] not in range(0,256):
|
||||
if new[c] not in xrange(256):
|
||||
sys.stderr.write("Value %s='%s' is out-of-range! Color values "\
|
||||
"should be in the range [0, 255].\n" % (c, new[c]))
|
||||
sys.exit(1)
|
||||
|
|
|
@ -243,9 +243,9 @@ class HTMLOutput:
|
|||
rows_count = breadth + len(thelist)
|
||||
# Create empty grid.
|
||||
rows = []
|
||||
for j in range(rows_count):
|
||||
for j in xrange(rows_count):
|
||||
column = []
|
||||
for i in range(6):
|
||||
for i in xrange(6):
|
||||
column.append((1, 1, None))
|
||||
rows.append(column)
|
||||
|
||||
|
@ -265,7 +265,7 @@ class HTMLOutput:
|
|||
if level < 0: level = 0
|
||||
if level > 5: level = 5
|
||||
rows[x][level] = (1, node.breadth, node)
|
||||
for i in range(1, node.breadth):
|
||||
for i in xrange(1, node.breadth):
|
||||
rows[x + i][level] = (0, 0, node)
|
||||
grid_place(node.children, x)
|
||||
x += node.breadth
|
||||
|
@ -277,7 +277,7 @@ class HTMLOutput:
|
|||
node.name = grouper.group_name(group)
|
||||
|
||||
rows[x][0] = (6, 1, node)
|
||||
for i in range(1, 6):
|
||||
for i in xrange(1, 6):
|
||||
rows[x][i] = (0, 0, None)
|
||||
nodes = groups[group]
|
||||
x += 1
|
||||
|
@ -309,7 +309,7 @@ class HTMLOutput:
|
|||
def abbrev(name):
|
||||
abbrev = name[0]
|
||||
word_seperators = [" ", "_", "+", "(", ")"]
|
||||
for i in range(1, len(name)):
|
||||
for i in xrange(1, len(name)):
|
||||
if name[i] in ["+", "(", ")"] or name[i - 1] in word_seperators and name[i] not in word_seperators:
|
||||
abbrev += name[i]
|
||||
return abbrev
|
||||
|
@ -375,7 +375,7 @@ class HTMLOutput:
|
|||
add_menu("races_menu", x)
|
||||
|
||||
for row in self.unitgrid:
|
||||
for column in range(6):
|
||||
for column in xrange(6):
|
||||
hspan, vspan, un = row[column]
|
||||
if not un: continue
|
||||
if isinstance(un, helpers.GroupNode):
|
||||
|
@ -550,7 +550,7 @@ class HTMLOutput:
|
|||
rows = self.unitgrid
|
||||
write("<table class=\"units\">\n")
|
||||
write("<colgroup>")
|
||||
for i in range(6):
|
||||
for i in xrange(6):
|
||||
write("<col class=\"col%d\" />" % i)
|
||||
write("</colgroup>")
|
||||
|
||||
|
@ -558,9 +558,9 @@ class HTMLOutput:
|
|||
"../../../images/misc/leader-crown.png", no_tc=True)
|
||||
crownimage = os.path.join(pics_location, pic)
|
||||
ms = None
|
||||
for row in range(len(rows)):
|
||||
for row in xrange(len(rows)):
|
||||
write("<tr>\n")
|
||||
for column in range(6):
|
||||
for column in xrange(6):
|
||||
hspan, vspan, un = rows[row][column]
|
||||
if vspan:
|
||||
attributes = ""
|
||||
|
@ -938,7 +938,7 @@ class HTMLOutput:
|
|||
write('</div>')
|
||||
write('<div class="unit-column-right">')
|
||||
|
||||
for si in range(2):
|
||||
for si in xrange(2):
|
||||
if si and not female: break
|
||||
if si:
|
||||
sportrait = fportrait
|
||||
|
@ -1122,7 +1122,7 @@ def html_postprocess_file(filename, isocode, batchlist):
|
|||
else:
|
||||
cids[1].append(c)
|
||||
|
||||
for i in range(2):
|
||||
for i in xrange(2):
|
||||
|
||||
campaigns = cids[i]
|
||||
campaigns.sort(key = lambda x: "A" if x[1] == "mainline" else "B" + x[2])
|
||||
|
@ -1150,7 +1150,7 @@ def html_postprocess_file(filename, isocode, batchlist):
|
|||
eids[1].append(e)
|
||||
|
||||
|
||||
for i in range(2):
|
||||
for i in xrange(2):
|
||||
eras = eids[i]
|
||||
eras.sort(key = lambda x: x[2])
|
||||
|
||||
|
|
|
@ -153,14 +153,14 @@ def main():
|
|||
|
||||
# Create grid.
|
||||
grid = []
|
||||
for j in range(n + 1):
|
||||
for j in xrange(n + 1):
|
||||
grid.append([None] * 6)
|
||||
for unit in units:
|
||||
grid[unit.y][unit.level] = unit
|
||||
|
||||
# Output it.
|
||||
for y in range(n + 1):
|
||||
for x in range(6):
|
||||
for y in xrange(n + 1):
|
||||
for x in xrange(6):
|
||||
unit = grid[y][x]
|
||||
if unit:
|
||||
w("|'''" + unit.name + "'''<br />" + unit.orig_name)
|
||||
|
|
|
@ -491,7 +491,7 @@ class Parser:
|
|||
if name in self.macros:
|
||||
macro = self.macros[name]
|
||||
text = macro.text
|
||||
for i in range(len(macro.params)):
|
||||
for i, j in enumerate(macro.params):
|
||||
if 1 + i >= len(params):
|
||||
raise Error(self, "Not enough parameters for macro %s. " % name +
|
||||
"%d given but %d needed %s." % (len(params) - 1,
|
||||
|
@ -505,10 +505,10 @@ class Parser:
|
|||
rep = self.gettext(self.textdomain, rep[q + 1:qe])
|
||||
rep = '"' + rep + '"'
|
||||
if self.verbose:
|
||||
#s = "Replacing {%s} with %s\n" % (macro.params[i], rep)
|
||||
#s = "Replacing {%s} with %s\n" % (j, rep)
|
||||
##sys.stderr.write(s.encode("utf8"))
|
||||
pass
|
||||
text = text.replace("{%s}" % macro.params[i], rep)
|
||||
text = text.replace("{%s}" % j, rep)
|
||||
|
||||
if text:
|
||||
self.push_text(name, text, initial_textdomain = macro.textdomain)
|
||||
|
@ -644,7 +644,7 @@ class Parser:
|
|||
values += [value]
|
||||
|
||||
data = []
|
||||
for i in range(len(variables)):
|
||||
for i in xrange(len(variables)):
|
||||
try:
|
||||
key = wmldata.DataText(variables[i], values[i], translatable)
|
||||
key.set_meta(filename, line)
|
||||
|
|
|
@ -1086,7 +1086,7 @@ def global_sanity_check(filename, lines):
|
|||
sidecount = 0
|
||||
recruitment_pattern = {}
|
||||
ifdef_stack = [None]
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
line = lines[i].strip()
|
||||
if line.startswith("#ifdef") or line.startswith("#ifhave") or line.startswith("#ifver"):
|
||||
ifdef_stack.append(line.split()[1])
|
||||
|
@ -1156,7 +1156,7 @@ def global_sanity_check(filename, lines):
|
|||
except TypeError:
|
||||
pass
|
||||
# Interpret various magic comments
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
# Interpret magic comments for setting the usage pattern of units.
|
||||
# This copes with some wacky UtBS units that are defined with
|
||||
# variant-spawning macros. The prototype comment looks like this:
|
||||
|
@ -1208,7 +1208,7 @@ def global_sanity_check(filename, lines):
|
|||
capitalization_error = re.compile("(?<=[.!?]) +[a-z]")
|
||||
markcheck = True
|
||||
translation_mark = re.compile(r'_ *"')
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if '[' in lines[i]:
|
||||
preamble_seen = True
|
||||
# This logic looks odd because a scenario can be conditionally
|
||||
|
@ -1368,7 +1368,7 @@ def global_sanity_check(filename, lines):
|
|||
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 directly_in_event[-1] and not in_time_area:
|
||||
ids = value.split(",")
|
||||
for j in range(len(ids)):
|
||||
for j in xrange(len(ids)):
|
||||
# removal of leading whitespace of items in comma-separated lists
|
||||
# is usually supported in the mainline wesnoth lua scripts
|
||||
# not sure about trailing one
|
||||
|
@ -1384,7 +1384,7 @@ def global_sanity_check(filename, lines):
|
|||
# Check for textdomain strings; should be exactly one, on line 1
|
||||
textdomains = []
|
||||
no_text = False
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "#textdomain" in lines[i]:
|
||||
textdomains.append(i+1)
|
||||
elif "wmllint: no translatables":
|
||||
|
@ -1518,7 +1518,7 @@ def hack_syntax(filename, lines):
|
|||
#
|
||||
# Deal with a few Windows-specific problems for the sake of cross-
|
||||
# platform harmony. First, the use of backslashes in file paths.
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
if lines[i].lstrip().startswith("#"):
|
||||
|
@ -1542,7 +1542,7 @@ def hack_syntax(filename, lines):
|
|||
% (filename, i+1, userdata.group(), userdata.group(1))
|
||||
lines[i] = precomment + comment
|
||||
# Ensure that every attack has a translatable description.
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
|
||||
break
|
||||
|
@ -1577,7 +1577,7 @@ def hack_syntax(filename, lines):
|
|||
# Ensure that every speaker=narrator block without an image uses
|
||||
# wesnoth-icon.png as an image.
|
||||
need_image = in_message = False
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
precomment = lines[i].split("#")[0]
|
||||
|
@ -1596,7 +1596,7 @@ def hack_syntax(filename, lines):
|
|||
need_image = in_message = False
|
||||
# Hack tracking-map macros from 1.4 and earlier. The idea is to lose
|
||||
# all assumptions about colors in the names
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
if lines[i].lstrip().startswith("#"):
|
||||
|
@ -1625,7 +1625,7 @@ def hack_syntax(filename, lines):
|
|||
y = int(m.group(3)) + 5
|
||||
lines[i] = lines[i][:m.start(0)] +("{%s %d %d}" % (n, x, y)) + lines[i][m.end(0):]
|
||||
# Fix bare strings containing single quotes; these confuse wesnoth-mode.el
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
elif lines[i].count("'") % 2 == 1:
|
||||
|
@ -1640,7 +1640,7 @@ def hack_syntax(filename, lines):
|
|||
except TypeError:
|
||||
pass
|
||||
# Palette transformation for 1.7:
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
if lines[i].lstrip().startswith("#"):
|
||||
|
@ -1650,7 +1650,7 @@ def hack_syntax(filename, lines):
|
|||
lines[i] = re.sub(r"~RC\(([^=\)]*)=([^)]*)\)",r"~PAL(\1>\2)",lines[i])
|
||||
# Rename the terrain definition tag
|
||||
in_standing_anim = False
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
if lines[i].lstrip().startswith("#"):
|
||||
|
@ -1666,7 +1666,7 @@ def hack_syntax(filename, lines):
|
|||
lines[i] = re.sub(r"terrain([^_])", r"terrain_type\1", lines[i])
|
||||
# Rename two attributes in [set_variable]
|
||||
in_set_variable = False
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
if lines[i].lstrip().startswith("#"):
|
||||
|
@ -1680,7 +1680,7 @@ def hack_syntax(filename, lines):
|
|||
lines[i] = re.sub(r"random(?=\s*=)", r"rand", lines[i])
|
||||
# campaigns directory becomes add-ons
|
||||
in_binary_path = in_textdomain = False
|
||||
for i in range(len(lines)):
|
||||
for i in xrange(len(lines)):
|
||||
if "no-syntax-rewrite" in lines[i]:
|
||||
break
|
||||
if lines[i].lstrip().startswith("#"):
|
||||
|
@ -1728,7 +1728,7 @@ def hack_syntax(filename, lines):
|
|||
|
||||
def maptransform(filename, baseline, inmap, y):
|
||||
# Transform lines in maps
|
||||
for i in range(len(inmap[y])):
|
||||
for i in xrange(len(inmap[y])):
|
||||
for (old, new) in mapchanges:
|
||||
inmap[y][i] = inmap[y][i].replace(old, new)
|
||||
|
||||
|
@ -1763,11 +1763,11 @@ tagstack = [] # For tracking tag nesting
|
|||
def outermap(func, inmap):
|
||||
"Apply a transformation based on neighborhood to the outermost ring."
|
||||
# Top and bottom rows
|
||||
for i in range(len(inmap[0])):
|
||||
for i in xrange(len(inmap[0])):
|
||||
inmap[0][i] = func(inmap[0][i])
|
||||
inmap[len(inmap)-1][i] = func(inmap[len(inmap)-1][i])
|
||||
# Leftmost and rightmost columns excluding top and bottom rows
|
||||
for i in range(1, len(inmap)-1):
|
||||
for i in xrange(1, len(inmap)-1):
|
||||
inmap[i][0] = func(inmap[i][0])
|
||||
inmap[i][len(inmap[0])-1] = func(inmap[i][len(inmap[0])-1])
|
||||
|
||||
|
@ -1911,7 +1911,7 @@ def translator(filename, mapxforms, textxform):
|
|||
newdata.append(leadws + "mask=\"")
|
||||
original = copy.deepcopy(outmap)
|
||||
for transform in mapxforms:
|
||||
for y in range(len(outmap)):
|
||||
for y in xrange(len(outmap)):
|
||||
transform(filename, baseline, outmap, y)
|
||||
if maptype == "mask":
|
||||
add_border = False
|
||||
|
@ -1922,7 +1922,7 @@ def translator(filename, mapxforms, textxform):
|
|||
have_header = True
|
||||
# Start by duplicating the current outermost ring
|
||||
outmap = [outmap[0]] + outmap + [outmap[-1]]
|
||||
for i in range(len(outmap)):
|
||||
for i in xrange(len(outmap)):
|
||||
outmap[i] = [outmap[i][0]] + outmap[i] + [outmap[i][-1]]
|
||||
# Strip villages out of the edges
|
||||
outermap(lambda n: re.sub(r"\^V[a-z]+", "", n), outmap)
|
||||
|
@ -1940,7 +1940,7 @@ def translator(filename, mapxforms, textxform):
|
|||
newdata += savedheaders
|
||||
if have_header and not have_delimiter:
|
||||
newdata.append(terminator)
|
||||
for y in range(len(outmap)):
|
||||
for y in xrange(len(outmap)):
|
||||
newdata.append(",".join(outmap[y]) + terminator)
|
||||
# All lines of the map are processed, add the appropriate trailer
|
||||
if not map_only:
|
||||
|
@ -2039,7 +2039,7 @@ def translator(filename, mapxforms, textxform):
|
|||
quotecount = 0
|
||||
display_state = False
|
||||
singleline = False
|
||||
for i in range(len(transformed)):
|
||||
for i in xrange(len(transformed)):
|
||||
if transformed[i] == '\n':
|
||||
if singleline:
|
||||
singleline = False
|
||||
|
|
|
@ -123,7 +123,7 @@ class MainFrame(wx.Frame):
|
|||
cmd+=" -r"
|
||||
if stripcr:
|
||||
cmd+=" -s"
|
||||
for i in range(verbose):
|
||||
for i in xrange(verbose):
|
||||
cmd+=" -v"
|
||||
for path in arguments:
|
||||
cmd+=" "+path
|
||||
|
|
Loading…
Add table
Reference in a new issue