From 801d5cbe68a0d1e3786601cf2ae532977ca07ba2 Mon Sep 17 00:00:00 2001 From: wraitii Date: Mon, 12 Aug 2019 08:03:23 +0000 Subject: [PATCH] Fix checkrefs script following eab4f9fdde (phenotypes), and fix the unit_motion_integration_test map from b637fdbae9. In eab4f9fdde the `gender`-tag was replaced with `phenotype`. the checkrefs script however was not updated and complained. b637fdbae9 introduced a map that checkrefs did not validate. Based on a patch by: Freagarach Differential Revision: https://code.wildfiregames.com/D2141 This was SVN commit r22647. --- .../unit_motion_integration_test.xml | 4 +-- source/tools/entity/checkrefs.pl | 33 ++++++++++++++----- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/binaries/data/mods/public/maps/scenarios/unit_motion_integration_test.xml b/binaries/data/mods/public/maps/scenarios/unit_motion_integration_test.xml index f03bcd08db..ea0673a166 100755 --- a/binaries/data/mods/public/maps/scenarios/unit_motion_integration_test.xml +++ b/binaries/data/mods/public/maps/scenarios/unit_motion_integration_test.xml @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c6c895ae9fde2a1f804e4b817d0fc5624a3946714113d22f08ba256d2769c16 -size 1659 +oid sha256:b98e1f8684e98bfd387989f6958afcd1a2995eff4719aa520c0b466c301707fe +size 1993 diff --git a/source/tools/entity/checkrefs.pl b/source/tools/entity/checkrefs.pl index fb8441a6f5..e4d0731300 100755 --- a/source/tools/entity/checkrefs.pl +++ b/source/tools/entity/checkrefs.pl @@ -135,24 +135,39 @@ sub add_entities if ($f !~ /^template_/) { push @roots, $path; - if ($ent->{Entity}{VisualActor}) + if ($ent->{Entity}{VisualActor} and $ent->{Entity}{VisualActor}{Actor}) { - push @deps, [ $path, "art/actors/" . $ent->{Entity}{VisualActor}{Actor}{' content'} ] if $ent->{Entity}{VisualActor}{Actor}; + my $phenotypes = $ent->{Entity}{Identity}{Phenotype}{' content'} || "default"; + my @phenotypes = split /\s/,$phenotypes; + + for my $phenotype (@phenotypes) + { + # See simulation2/components/CCmpVisualActor.cpp and Identity.js for explanation. + my $actorPath = $ent->{Entity}{VisualActor}{Actor}{' content'}; + $actorPath =~ s/{phenotype}/$phenotype/g; + push @deps, [ $path, "art/actors/" . $actorPath ]; + } + push @deps, [ $path, "art/actors/" . $ent->{Entity}{VisualActor}{FoundationActor}{' content'} ] if $ent->{Entity}{VisualActor}{FoundationActor}; } if ($ent->{Entity}{Sound}) { - my $gender = $ent->{Entity}{Identity}{Gender}{' content'} || "male"; + my $phenotypes = $ent->{Entity}{Identity}{Phenotype}{' content'} || "default"; my $lang = $ent->{Entity}{Identity}{Lang}{' content'} || "greek"; - for (grep ref($_), values %{$ent->{Entity}{Sound}{SoundGroups}}) + my @phenotypes = split /\s/,$phenotypes; + + for my $phenotype (@phenotypes) { - # see simulation/components/Sound.js and Identity.js for explanation - my $soundPath = $_->{' content'}; - $soundPath =~ s/{gender}/$gender/g; - $soundPath =~ s/{lang}/$lang/g; - push @deps, [ $path, "audio/" . $soundPath ]; + for (grep ref($_), values %{$ent->{Entity}{Sound}{SoundGroups}}) + { + # see simulation/components/Sound.js and Identity.js for explanation + my $soundPath = $_->{' content'}; + $soundPath =~ s/{phenotype}/$phenotype/g; + $soundPath =~ s/{lang}/$lang/g; + push @deps, [ $path, "audio/" . $soundPath ]; + } } }