--- deliantra/server/utils/cfutil.in 2010/10/05 23:52:02 1.90 +++ deliantra/server/utils/cfutil.in 2010/10/06 01:23:11 1.97 @@ -108,7 +108,7 @@ my $hash = substr +(Digest::MD5::md5 $$dataref), 0, $clen || 4; if (exists $hash{$hash}) { - # hahs collinion, but some files are simply identical + # hash collision, but some files are simply identical if (${$hash{$hash}[1]} ne $$dataref) { warn "hash collision $hash{$hash}[0] vs. $id\n"; exit 1; @@ -158,38 +158,21 @@ print "maps installed successfully.\n"; } -our %WALL_SUFFIX = ( - "0" => "⬤", - "1_3" => "╸", - "1_4" => "╺", - "2_1_2" => "━", - - "1_2" => "╹", - "2_2_4" => "┛", - "2_2_1" => "┗", - "3_1" => "┻", - - "1_1" => "╻", - "2_2_3" => "┓", - "2_2_2" => "┏", - "3_3" => "┳", - - "2_1_1" => "┃", - "3_4" => "┫", - "3_2" => "┣", - "4" => "╋", -); +our @WALL_SUFFIX = qw(⬤ ╹ ╺ ┗ ╻ ┃ ┏ ┣ ╸ ┛ ━ ┻ ┓ ┫ ┳ ╋); +# used to create crude text glyphs for text-based clients sub autoglyph { my ($stem, $face) = @_; if ($stem =~ /^wall\/|Nimwall/) { - while (my ($k, $v) = each %WALL_SUFFIX) { - return $v if $stem =~ /_$k.x11/; - } + return $WALL_SUFFIX[hex $1] + if $stem =~ /(_[0-9A-F]).x11/; "+" + } elsif ($stem =~ /^monster.*\/(.)/) { + $1 + } elsif ($stem =~ /^floor\/|^ground\/|Nimfloor/) { "." @@ -845,14 +828,16 @@ #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; - my $stem = delete $v->{stem}; - $v->{glyph} //= autoglyph $stem, $v; - if (my $magicmap = $v->{magicmap}) { $magicmap =~ y/A-Z_\-/a-z/d; $v->{magicmap} = $COLOR{$magicmap}; } + my $stem = delete $v->{stem}; + $v->{glyph} //= autoglyph $stem, $v; + utf8::encode $v->{glyph}; + $v->{glyph} = (chr $v->{magicmap}) . $v->{glyph}; + delete $v->{arc}; }