Author: esr
Date: Tue Oct 7 03:36:31 2008
New Revision: 29931
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29931&view=rev
Log:
Teach wmlomove how to accept a unit type qualifier on destinations.
Modified:
trunk/data/tools/wesnoth/wmltools.py
trunk/data/tools/wmlmove
Modified: trunk/data/tools/wesnoth/wmltools.py
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmltools.py?rev=29931&r1=29930&r2=29931&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmltools.py (original)
+++ trunk/data/tools/wesnoth/wmltools.py Tue Oct 7 03:36:31 2008
@@ -717,8 +717,12 @@
ns = directory_namespace(path)
return ns != None and ns == namespace
-def resolve_unit_cfg(namespace, resource):
+def resolve_unit_cfg(namespace, utype, resource=None):
"Get the location of a specified unit in a specified scope."
+ if resource:
+ resource = os.path.join(utype, resource)
+ else:
+ resource = utype
loc = namespace_directory(namespace) + "units/" + resource
if not loc.endswith(".cfg"):
loc += ".cfg"
Modified: trunk/data/tools/wmlmove
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlmove?rev=29931&r1=29930&r2=29931&view=diff
==============================================================================
--- trunk/data/tools/wmlmove (original)
+++ trunk/data/tools/wmlmove Tue Oct 7 03:36:31 2008
@@ -13,9 +13,12 @@
For purposes of this command, a "namespace identifier" is either the
basename of a campaign subdirectory or the special name "core",
-indicating the units, images and sounds directories in data/core. A
-source must be a namespace identifier, followed by "::", followed by
-the name of a unit (the basename of its path without the .cfg extwension). A
destination must be a namespace identifier.
+indicating the units, images and sounds directories in data/core.
+
+A source must be a namespace identifier, followed by "::", followed by
+the name of a unit (the basename of its path without the .cfg
+extension). A destination must be a namespace identifier, optionally
+followed by :: and a unit class.
The script generates a sequence of shell commands. These commands
will move the unit and all its resources to appropriate places under
@@ -53,7 +56,7 @@
Here is an example:
- wmlmove --imageclass=elves-wood Heir_To_The_Throne::Elvish_Lord
Heir_To_The_Throne::Elvish_High_Lord Heir_To_The_Throne::Elvish_Lady core
+ wmlmove --imageclass=elves-wood --unitclass=elves
Heir_To_The_Throne::Elvish_Lord Heir_To_The_Throne::Elvish_High_Lord
Heir_To_The_Throne::Elvish_Lady core::humans
'''
@@ -122,6 +125,12 @@
# Validate the destination.
if not delete:
+ uclass = None
+ if "::" in dst:
+ (dst, uclass) = dst.split("::")
+ elif dst == "core":
+ sys.stderr.write("wmlmove: moves to core require a unit
subclass.\n")
+ sys.exit(1)
dstdir = namespace_directory(dst)
if dstdir == None:
sys.stderr.write("wmlmove: invalid namespace %s\n" % dstdir)
@@ -218,7 +227,7 @@
print "# .cfg moves and transformations"
for filename in srclist:
source = directory_namespace(filename)
- target = resolve_unit_cfg(dst, os.path.basename(filename))
+ target = resolve_unit_cfg(dst, uclass, os.path.basename(filename))
if revert:
if not namespace_member(filename, source):
print vcunmove(filename, target)
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits