#!perl
#
# convert civIII pediainfo.txt into civIV format
######################################################
open(PEDIA,"Civilopedia.txt") || die "$! tyring to read Civilopedia.txt\n";
open(OUT,">pedia.txt") || die "$! tyring to create pedia.txt\n";
# open(DEBUG,">debug.txt") || die "$! tyring to create debug.txt\n";
select OUT;
$/ = "\n; ";
while(<PEDIA>){
if ( /^ADVANCES/ ){
$_ =~s/\^(.*)\n/$1/g;
# print DEBUG "$_";
@lines = split(/\n/,$_);
foreach $i ( 1 .. $#lines ){
$line = @lines[$i];
if ( $line =~/^#DESC_TECH_(\S+)/ ){
$label = uc($1);
$tag = "TXT_KEY_TECH_$label";
}
elsif ( $line =~/^#TECH_/ || $line =~/\{New Ability\}/ ){
next;
}
elsif ( $line =~/^(.*)$/ ){
$text = $1;
$text =~s/^//g;
next if ( $text eq "" || $text =~/TECH_TECH/ );
print<<"EOP";
<TEXT>
<Tag>$tag</Tag>
<English>. .. .. .. .. .$text</English>
<German>. .. .. .. .. . boo </German>
<Italian>. .. .. .. .. . boo </Italian>
<Spanish>. .. .. .. .. . boo </Spanish>
</TEXT>
EOP
}
}
}
}