Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Perlscript to replace missing bitmaps with default
Hi,
I'm missing some bitmaps for some archetypes used in crossfire 0.89.3.
This sometimes completely messes up the display.
So I wrote the following perl-script, which replaces these
with a default character (277, which is a filled square).
Wouldn't it be nice if crossfire itself could do this
if necessary? I'm not a X11-Guru, but I don't think it would be much work
to implement this. A special-missing-bitmap might be useful for such a case.
-Till
--Snip snip 8<---------------------------------------
#!/usr/local/bin/perl
# Usage: replacefaces <archetypes.orig >archetypes.fixed
# bmaps must be in the current directory
eval "exec /usr/local/bin/perl -S $0 $*"
if $running_under_some_shell;
# this emulates #! processing on NIH machines.
# (remove #! line above if indigestible)
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_]+=)(.*)/ && shift;
# process any FOO=bar switches
open(AX,"bmaps") || die "missing bmaps" ;
while(<AX>)
{
if(/^\\([0-9]+)/){
$char{$1}=1;
}
}
close(AX);
$[ = 1; # set array base to 1
while (<>) {
if(/^face ([0-9]+)/) {
if (!defined($char{$1})) {
printf (("face 277\n"));
warn "replacing $1";
}
else {
print $_;
}
}
else { print $_; }
}