Author: esr
Date: Thu Oct 16 00:47:30 2008
New Revision: 30190
URL: http://svn.gna.org/viewcvs/wesnoth?rev=30190&view=rev
Log:
trackplacer: now edits track sections within files and can store multiiple
tracks per file.
Removed:
trunk/data/campaigns/Eastern_Invasion/utils/journey1.cfg
trunk/data/campaigns/Eastern_Invasion/utils/journey2.cfg
trunk/data/campaigns/Eastern_Invasion/utils/journey3.cfg
trunk/data/campaigns/Eastern_Invasion/utils/journey4.cfg
Modified:
trunk/data/campaigns/Descent_Into_Darkness/utils/journey.cfg
trunk/data/campaigns/Eastern_Invasion/utils/_final.cfg
trunk/data/tools/trackplacer
Modified: trunk/data/campaigns/Descent_Into_Darkness/utils/journey.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Descent_Into_Darkness/utils/journey.cfg?rev=30190&r1=30189&r2=30190&view=diff
==============================================================================
--- trunk/data/campaigns/Descent_Into_Darkness/utils/journey.cfg (original)
+++ trunk/data/campaigns/Descent_Into_Darkness/utils/journey.cfg Thu Oct 16
00:47:30 2008
@@ -1,8 +1,9 @@
-# Edited by trackplacer on Tue Oct 14 11:33:00 2008.
-# Hand-hack strictly at your own risk
+# trackplacer: tracks begin
+
+# Hand-hack this section strictly at your own risk.
+
#
# trackplacer:
map=data/campaigns/Descent_Into_Darkness/images/misc/descent-into-darkness.png
-# wmllint: no translatables
#
#define JOURNEY_STAGE_1
{NEW_BATTLE 800 425}
@@ -25,7 +26,7 @@
{NEW_JOURNEY 792 339}
{NEW_JOURNEY 750 355}
{NEW_JOURNEY 702 349}
- {NEW_JOURNEY 650 336}
+ {NEW_JOURNEY 643 332}
{NEW_JOURNEY 591 315}
{NEW_JOURNEY 552 287}
{NEW_BATTLE 538 267}
@@ -40,7 +41,7 @@
{OLD_JOURNEY 792 339}
{OLD_JOURNEY 750 355}
{OLD_JOURNEY 702 349}
- {OLD_JOURNEY 650 336}
+ {OLD_JOURNEY 643 332}
{OLD_JOURNEY 591 315}
{OLD_JOURNEY 552 287}
{OLD_BATTLE 538 267}
@@ -60,7 +61,7 @@
{OLD_JOURNEY 792 339}
{OLD_JOURNEY 750 355}
{OLD_JOURNEY 702 349}
- {OLD_JOURNEY 650 336}
+ {OLD_JOURNEY 643 332}
{OLD_JOURNEY 591 315}
{OLD_JOURNEY 552 287}
{OLD_BATTLE 538 267}
@@ -89,7 +90,7 @@
{OLD_JOURNEY 792 339}
{OLD_JOURNEY 750 355}
{OLD_JOURNEY 702 349}
- {OLD_JOURNEY 650 336}
+ {OLD_JOURNEY 643 332}
{OLD_JOURNEY 591 315}
{OLD_JOURNEY 552 287}
{OLD_BATTLE 538 267}
@@ -129,7 +130,7 @@
{OLD_JOURNEY 792 339}
{OLD_JOURNEY 750 355}
{OLD_JOURNEY 702 349}
- {OLD_JOURNEY 650 336}
+ {OLD_JOURNEY 643 332}
{OLD_JOURNEY 591 315}
{OLD_JOURNEY 552 287}
{OLD_BATTLE 538 267}
@@ -177,7 +178,7 @@
{OLD_JOURNEY 792 339}
{OLD_JOURNEY 750 355}
{OLD_JOURNEY 702 349}
- {OLD_JOURNEY 650 336}
+ {OLD_JOURNEY 643 332}
{OLD_JOURNEY 591 315}
{OLD_JOURNEY 552 287}
{OLD_BATTLE 538 267}
@@ -227,7 +228,7 @@
{OLD_JOURNEY 792 339}
{OLD_JOURNEY 750 355}
{OLD_JOURNEY 702 349}
- {OLD_JOURNEY 650 336}
+ {OLD_JOURNEY 643 332}
{OLD_JOURNEY 591 315}
{OLD_JOURNEY 552 287}
{OLD_BATTLE 538 267}
@@ -281,7 +282,7 @@
{OLD_JOURNEY 792 339}
{OLD_JOURNEY 750 355}
{OLD_JOURNEY 702 349}
- {OLD_JOURNEY 650 336}
+ {OLD_JOURNEY 643 332}
{OLD_JOURNEY 591 315}
{OLD_JOURNEY 552 287}
{OLD_BATTLE 538 267}
@@ -326,3 +327,4 @@
{OLD_BATTLE 458 263}
#enddef
+# trackplacer: tracks end
Modified: trunk/data/campaigns/Eastern_Invasion/utils/_final.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Eastern_Invasion/utils/_final.cfg?rev=30190&r1=30189&r2=30190&view=diff
==============================================================================
--- trunk/data/campaigns/Eastern_Invasion/utils/_final.cfg (original)
+++ trunk/data/campaigns/Eastern_Invasion/utils/_final.cfg Thu Oct 16 00:47:30
2008
@@ -1,4 +1,112 @@
# wmllint: no translatables
+
+# trackplacer: tracks begin
+# Hand-hack strictly at your own risk.
+#
+# trackplacer:
map=data/campaigns/Eastern_Invasion/images/eastern-invasion-map.png
+#
+
+#define JOURNEY1_STAGE_1
+ {NEW_BATTLE 759 508}
+#enddef
+
+#define JOURNEY1_STAGE_2
+ {OLD_BATTLE 759 508}
+ {NEW_JOURNEY 788 509}
+ {NEW_BATTLE 821 517}
+#enddef
+
+#define JOURNEY1_COMPLETE
+ {OLD_BATTLE 759 508}
+ {OLD_JOURNEY 788 509}
+ {OLD_BATTLE 821 517}
+#enddef
+
+#define JOURNEY2_STAGE_1
+ {NEW_JOURNEY 844 507}
+ {NEW_JOURNEY 847 487}
+ {NEW_BATTLE 847 469}
+#enddef
+
+#define JOURNEY2_STAGE_2
+ {OLD_JOURNEY 844 507}
+ {OLD_JOURNEY 847 487}
+ {OLD_BATTLE 847 469}
+ {NEW_JOURNEY 798 466}
+ {NEW_JOURNEY 772 471}
+ {NEW_BATTLE 729 460}
+#enddef
+
+#define JOURNEY2_COMPLETE
+ {OLD_JOURNEY 844 507}
+ {OLD_JOURNEY 847 487}
+ {OLD_BATTLE 847 469}
+ {OLD_JOURNEY 798 466}
+ {OLD_JOURNEY 772 471}
+ {OLD_BATTLE 729 460}
+#enddef
+
+#define JOURNEY3_STAGE_1
+ {NEW_JOURNEY 846 525}
+ {NEW_JOURNEY 879 545}
+ {NEW_JOURNEY 908 562}
+ {NEW_BATTLE 938 583}
+#enddef
+
+#define JOURNEY3_STAGE_2
+ {OLD_JOURNEY 846 525}
+ {OLD_JOURNEY 879 545}
+ {OLD_JOURNEY 908 562}
+ {OLD_BATTLE 938 583}
+ {NEW_JOURNEY 951 538}
+ {NEW_JOURNEY 984 568}
+ {NEW_JOURNEY 959 598}
+ {NEW_BATTLE 988 611}
+#enddef
+
+#define JOURNEY3_STAGE_3
+ {OLD_JOURNEY 846 525}
+ {OLD_JOURNEY 879 545}
+ {OLD_JOURNEY 908 562}
+ {OLD_BATTLE 938 583}
+ {OLD_JOURNEY 951 538}
+ {OLD_JOURNEY 984 568}
+ {OLD_JOURNEY 959 598}
+ {OLD_BATTLE 988 611}
+ {NEW_JOURNEY 932 503}
+ {NEW_JOURNEY 876 475}
+ {NEW_JOURNEY 831 467}
+ {NEW_JOURNEY 781 469}
+ {NEW_BATTLE 729 460}
+#enddef
+
+#define JOURNEY3_COMPLETE
+ {OLD_JOURNEY 846 525}
+ {OLD_JOURNEY 879 545}
+ {OLD_JOURNEY 908 562}
+ {OLD_BATTLE 938 583}
+ {OLD_JOURNEY 951 538}
+ {OLD_JOURNEY 984 568}
+ {OLD_JOURNEY 959 598}
+ {OLD_BATTLE 988 611}
+ {OLD_JOURNEY 932 503}
+ {OLD_JOURNEY 876 475}
+ {OLD_JOURNEY 831 467}
+ {OLD_JOURNEY 781 469}
+ {OLD_BATTLE 729 460}
+#enddef
+
+#define JOURNEY4_STAGE_1
+ {NEW_JOURNEY 709 449}
+ {NEW_BATTLE 709 412}
+#enddef
+
+#define JOURNEY4_COMPLETE
+ {OLD_JOURNEY 709 449}
+ {OLD_BATTLE 709 412}
+#enddef
+
+# trackplacer: tracks end
# This is where we stitch together the variant journey tracks.
# How these are assembled depends on the value of the variables
Removed: trunk/data/campaigns/Eastern_Invasion/utils/journey1.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Eastern_Invasion/utils/journey1.cfg?rev=30189&view=auto
==============================================================================
--- trunk/data/campaigns/Eastern_Invasion/utils/journey1.cfg (original)
+++ trunk/data/campaigns/Eastern_Invasion/utils/journey1.cfg (removed)
@@ -1,23 +1,0 @@
-# Edited by trackplacer on Tue Oct 14 22:17:48 2008.
-# Hand-hack strictly at your own risk
-#
-# trackplacer:
map=data/campaigns/Eastern_Invasion/images/eastern-invasion-map.png
-# trackplacer: prefix=JOURNEY1
-# wmllint: no translatables
-#
-#define JOURNEY1_STAGE_1
- {NEW_BATTLE 759 508}
-#enddef
-
-#define JOURNEY1_STAGE_2
- {OLD_BATTLE 759 508}
- {NEW_JOURNEY 788 509}
- {NEW_BATTLE 821 517}
-#enddef
-
-#define JOURNEY1_COMPLETE
- {OLD_BATTLE 759 508}
- {OLD_JOURNEY 788 509}
- {OLD_BATTLE 821 517}
-#enddef
-
Removed: trunk/data/campaigns/Eastern_Invasion/utils/journey2.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Eastern_Invasion/utils/journey2.cfg?rev=30189&view=auto
==============================================================================
--- trunk/data/campaigns/Eastern_Invasion/utils/journey2.cfg (original)
+++ trunk/data/campaigns/Eastern_Invasion/utils/journey2.cfg (removed)
@@ -1,31 +1,0 @@
-# Edited by trackplacer on Wed Oct 15 14:23:38 2008.
-# Hand-hack strictly at your own risk.
-#
-# trackplacer:
map=data/campaigns/Eastern_Invasion/images/eastern-invasion-map.png
-# trackplacer: prefix=JOURNEY2
-# wmllint: no translatables
-#
-#define JOURNEY2_STAGE_1
- {NEW_JOURNEY 844 507}
- {NEW_JOURNEY 847 487}
- {NEW_BATTLE 847 469}
-#enddef
-
-#define JOURNEY2_STAGE_2
- {OLD_JOURNEY 844 507}
- {OLD_JOURNEY 847 487}
- {OLD_BATTLE 847 469}
- {NEW_JOURNEY 798 466}
- {NEW_JOURNEY 772 471}
- {NEW_BATTLE 729 460}
-#enddef
-
-#define JOURNEY2_COMPLETE
- {OLD_JOURNEY 844 507}
- {OLD_JOURNEY 847 487}
- {OLD_BATTLE 847 469}
- {OLD_JOURNEY 798 466}
- {OLD_JOURNEY 772 471}
- {OLD_BATTLE 729 460}
-#enddef
-
Removed: trunk/data/campaigns/Eastern_Invasion/utils/journey3.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Eastern_Invasion/utils/journey3.cfg?rev=30189&view=auto
==============================================================================
--- trunk/data/campaigns/Eastern_Invasion/utils/journey3.cfg (original)
+++ trunk/data/campaigns/Eastern_Invasion/utils/journey3.cfg (removed)
@@ -1,57 +1,0 @@
-# Edited by trackplacer on Wed Oct 15 13:29:15 2008.
-# Hand-hack strictly at your own risk.
-#
-# trackplacer:
map=/home/esr/svn/wesnoth/data/campaigns/Eastern_Invasion/images/eastern-invasion-map.png
-# trackplacer: prefix=JOURNEY3
-# wmllint: no translatables
-#
-#define JOURNEY3_STAGE_1
- {NEW_JOURNEY 846 525}
- {NEW_JOURNEY 879 545}
- {NEW_JOURNEY 908 562}
- {NEW_BATTLE 938 583}
-#enddef
-
-#define JOURNEY3_STAGE_2
- {OLD_JOURNEY 846 525}
- {OLD_JOURNEY 879 545}
- {OLD_JOURNEY 908 562}
- {OLD_BATTLE 938 583}
- {NEW_JOURNEY 951 538}
- {NEW_JOURNEY 984 568}
- {NEW_JOURNEY 959 598}
- {NEW_BATTLE 988 611}
-#enddef
-
-#define JOURNEY3_STAGE_3
- {OLD_JOURNEY 846 525}
- {OLD_JOURNEY 879 545}
- {OLD_JOURNEY 908 562}
- {OLD_BATTLE 938 583}
- {OLD_JOURNEY 951 538}
- {OLD_JOURNEY 984 568}
- {OLD_JOURNEY 959 598}
- {OLD_BATTLE 988 611}
- {NEW_JOURNEY 932 503}
- {NEW_JOURNEY 876 475}
- {NEW_JOURNEY 831 467}
- {NEW_JOURNEY 781 469}
- {NEW_BATTLE 729 460}
-#enddef
-
-#define JOURNEY3_COMPLETE
- {OLD_JOURNEY 846 525}
- {OLD_JOURNEY 879 545}
- {OLD_JOURNEY 908 562}
- {OLD_BATTLE 938 583}
- {OLD_JOURNEY 951 538}
- {OLD_JOURNEY 984 568}
- {OLD_JOURNEY 959 598}
- {OLD_BATTLE 988 611}
- {OLD_JOURNEY 932 503}
- {OLD_JOURNEY 876 475}
- {OLD_JOURNEY 831 467}
- {OLD_JOURNEY 781 469}
- {OLD_BATTLE 729 460}
-#enddef
-
Removed: trunk/data/campaigns/Eastern_Invasion/utils/journey4.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Eastern_Invasion/utils/journey4.cfg?rev=30189&view=auto
==============================================================================
--- trunk/data/campaigns/Eastern_Invasion/utils/journey4.cfg (original)
+++ trunk/data/campaigns/Eastern_Invasion/utils/journey4.cfg (removed)
@@ -1,17 +1,0 @@
-# Edited by trackplacer on Wed Oct 15 14:33:56 2008.
-# Hand-hack strictly at your own risk.
-#
-# trackplacer:
map=/home/esr/svn/wesnoth/data/campaigns/Eastern_Invasion/images/eastern-invasion-map.png
-# trackplacer: prefix=JOURNEY4
-# wmllint: no translatables
-#
-#define JOURNEY4_STAGE_1
- {NEW_JOURNEY 709 449}
- {NEW_BATTLE 709 412}
-#enddef
-
-#define JOURNEY4_COMPLETE
- {OLD_JOURNEY 709 449}
- {OLD_BATTLE 709 412}
-#enddef
-
Modified: trunk/data/tools/trackplacer
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/trackplacer?rev=30190&r1=30189&r2=30190&view=diff
==============================================================================
--- trunk/data/tools/trackplacer (original)
+++ trunk/data/tools/trackplacer Thu Oct 16 00:47:30 2008
@@ -114,6 +114,7 @@
self.track_list = []
self.properties = {}
self.modified = False
+ self.before = self.after = ""
def selected_track(self):
"Select a track for modification"
return self.tracks[self.selected_id]
@@ -122,12 +123,14 @@
def write(self, fp):
"Record a set of named journey tracks."
if fp.name.endswith(".cfg"):
- fp.write("# Edited by trackplacer on
%s.\n"%time.ctime(time.time()))
- fp.write("# Hand-hack strictly at your own risk.\n")
+ fp.write(self.before)
+ fp.write("# trackplacer: tracks begin\n\n")
+ fp.write("# Hand-hack this section strictly at your own risk.\n\n")
fp.write("#\n")
+ if not self.before and not self.after:
+ fp.write("#\n# wmllint: no translatables\n\n")
for (key, val) in self.properties.items():
fp.write("# trackplacer: %s=%s\n" % (key, val))
- fp.write("# wmllint: no translatables\n")
fp.write("#\n")
for (name, track) in self.tracks.items():
index_tuples = zip(range(len(track)), track)
@@ -150,6 +153,8 @@
waypoint = track[j]
fp.write(" {OLD_%s %d %d}\n" % tuple(waypoint))
fp.write("#enddef\n\n")
+ fp.write("# trackplacer: tracks end\n")
+ fp.write(self.after)
fp.close()
self.modified = False
else:
@@ -174,7 +179,21 @@
+ " +([0-9]+) +([0-9]+)}")
property_re = re.compile("# *trackplacer: ([^=]+)=(.*)")
define_re = re.compile("#define ([^_]*)")
+ state = "before"
for line in fp:
+ # This is how we ignore stuff outside of track sections
+ if state == "before":
+ if line.startswith("# trackplacer: tracks begin"):
+ state = "tracks" # And fall through...
+ else:
+ self.before += line
+ continue
+ elif state == "after":
+ self.after += line
+ continue
+ elif line.startswith("# trackplacer: tracks end"):
+ state = "after"
+ continue
# Which track are we appending to?
m = re.search(define_re, line)
if m:
@@ -208,7 +227,7 @@
def __getitem__(self, n):
return self.tracks[self.selected_id][n]
def __setitem__(self, n, v):
- self.trackself.tracks[self.selected_id][n] = v
+ self.tracks[self.selected_id][n] = v
def has_unsaved_changes(self):
return self.modified
def neighbors(self, x, y):
@@ -489,14 +508,14 @@
"Return all track items with bounding boxes overlapping this one:"
rect = self.selected_dictionary[action].bounding_box(x, y)
return filter(lambda item: overlaps(rect, self.box(item)),
- self.journey.flattened())
+ self.journey.selected_track())
def erase_feature(self, widget, (action, x, y)):
"Erase specified (active) icon from the map."
# Erase all nearby features that might have been damaged.
save_select = self.journey.selected_id
- for (id, track) in self.journey.tracks:
- self.journey.set_selected_id(id)
+ for (id, track) in self.journey.tracks.items():
+ self.journey.set_selected_track(id)
neighbors = self.neighbors((action, x, y))
for (na, nx, ny) in neighbors:
rect = self.box((na, nx, ny))
@@ -508,7 +527,7 @@
if x != nx and y != ny:
self.log("Redrawing action=%s" % ((na, nx, ny),))
self.draw_feature(widget, (na, nx, ny))
- self.journey.set_selected_id(save_select)
+ self.journey.set_selected_track(save_select)
def draw_feature(self, widget, (action, x, y), selected):
"Draw specified icon on the map."
@@ -570,7 +589,7 @@
self.draw_feature(widget, (self.action, x, y), True)
self.journey.insert((self.action, x, y))
elif self.selected != None and self.action == "DELETE":
- (action, x, y) = self.journey.track[self.selected]
+ (action, x, y) = self.journey[self.selected]
self.log("Deletion snapped to feature %d %s" %
(self.selected,(action,x,y)))
self.erase_feature(widget, (action, x, y))
self.journey.remove(x, y)
@@ -589,11 +608,11 @@
# This code enables dragging icons.
if state & gtk.gdk.BUTTON1_MASK and self.pixmap != None:
if self.selected is not None:
- (action, lx, ly) = self.journey.track[self.selected]
+ (action, lx, ly) = self.journey[self.selected]
self.erase_feature(widget, (action, lx, ly))
- self.journey.track[self.selected] = (action, x, y)
- self.jouney.modified = True
- self.draw_feature(widget, (action, x, y))
+ self.journey[self.selected] = (action, x, y)
+ self.journey.modified = True
+ self.draw_feature(widget, (action, x, y), True)
self.log("Track is %s" % self.journey)
return True
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits