added support for 'percent multiplier' in the techtree docummentation tools

This commit is contained in:
filux 2016-12-08 22:30:44 +01:00
parent 9c203cd2b4
commit 7f55d9fc1d
2 changed files with 9 additions and 8 deletions

@ -1 +1 @@
Subproject commit fa2a0cac9e6fe0fc3434edc2cad728ecb4b8e6b1
Subproject commit 07aca95635dac967fc258c5176ef116a302c5f18

View File

@ -82,7 +82,6 @@ our $version = "0.8.1 beta";
# strange stuff in the techtrees:
# - persian magician splash radius 0?
# - tech workers move faster with load?
# - tech upgrades piercing/blade weapon don't work for battle machine?
# - f.e. battle machine with "hold" will only attack land units
# - workers are able to help a technician build an aerodrome faster. is that wanted?
@ -1927,18 +1926,20 @@ sub get_value {
my $nodeset = $xpath->find("$location");
print "doing location $location\n";
my ($node) = $nodeset->get_nodelist;
my $value;
if ( $node ) {
my $attribute = XML::XPath::XMLParser::as_string( $node );
# get only the value of an attribute, XML::Xpath returns f.e. regeneration="3", we want just 3
if ( $attribute =~ /\"(.+?)\"/ ) {
if ( $attribute =~ /(?<!value-percent-multiplier)[ \t]*=[ \t]*\"[ \t]*(.+?)[ \t]*\"/ ) {
$value = $1;
if ( $attribute =~ /value-percent-multiplier[ \t]*=[ \t]*\"[ \t]*true[ \t]*\"/ ) {
$value = "$value%";
}
}
else {
$value = $attribute;
}
#else {
# $value = $attribute;
#}
}
return $value;