ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/cfutil.in
(Generate patch)

Comparing deliantra/server/utils/cfutil.in (file contents):
Revision 1.90 by root, Tue Oct 5 23:52:02 2010 UTC vs.
Revision 1.97 by root, Wed Oct 6 01:23:11 2010 UTC

106 my ($id, $dataref, $hashref, $clen) = @_; 106 my ($id, $dataref, $hashref, $clen) = @_;
107 107
108 my $hash = substr +(Digest::MD5::md5 $$dataref), 0, $clen || 4; 108 my $hash = substr +(Digest::MD5::md5 $$dataref), 0, $clen || 4;
109 109
110 if (exists $hash{$hash}) { 110 if (exists $hash{$hash}) {
111 # hahs collinion, but some files are simply identical 111 # hash collision, but some files are simply identical
112 if (${$hash{$hash}[1]} ne $$dataref) { 112 if (${$hash{$hash}[1]} ne $$dataref) {
113 warn "hash collision $hash{$hash}[0] vs. $id\n"; 113 warn "hash collision $hash{$hash}[0] vs. $id\n";
114 exit 1; 114 exit 1;
115 } else { 115 } else {
116 print "$hash{$hash}[0] and $id are identical (which is fine).\n" if $VERBOSE >= 3; 116 print "$hash{$hash}[0] and $id are identical (which is fine).\n" if $VERBOSE >= 3;
156 and die "map installation failed.\n"; 156 and die "map installation failed.\n";
157 157
158 print "maps installed successfully.\n"; 158 print "maps installed successfully.\n";
159} 159}
160 160
161our %WALL_SUFFIX = ( 161our @WALL_SUFFIX = qw(⬤ ╹ ╺ ┗ ╻ ┃ ┏ ┣ ╸ ┛ ━ ┻ ┓ ┫ ┳ ╋);
162 "0" => "⬤",
163 "1_3" => "╸",
164 "1_4" => "╺",
165 "2_1_2" => "━",
166 162
167 "1_2" => "╹", 163# used to create crude text glyphs for text-based clients
168 "2_2_4" => "┛",
169 "2_2_1" => "┗",
170 "3_1" => "┻",
171
172 "1_1" => "╻",
173 "2_2_3" => "┓",
174 "2_2_2" => "┏",
175 "3_3" => "┳",
176
177 "2_1_1" => "┃",
178 "3_4" => "┫",
179 "3_2" => "┣",
180 "4" => "╋",
181);
182
183sub autoglyph { 164sub autoglyph {
184 my ($stem, $face) = @_; 165 my ($stem, $face) = @_;
185 166
186 if ($stem =~ /^wall\/|Nimwall/) { 167 if ($stem =~ /^wall\/|Nimwall/) {
187 while (my ($k, $v) = each %WALL_SUFFIX) { 168 return $WALL_SUFFIX[hex $1]
188 return $v if $stem =~ /_$k.x11/; 169 if $stem =~ /(_[0-9A-F]).x11/;
189 }
190 170
191 "+" 171 "+"
172
173 } elsif ($stem =~ /^monster.*\/(.)/) {
174 $1
192 175
193 } elsif ($stem =~ /^floor\/|^ground\/|Nimfloor/) { 176 } elsif ($stem =~ /^floor\/|^ground\/|Nimfloor/) {
194 "." 177 "."
195 178
196 } elsif ($stem =~ /^player\//) { 179 } elsif ($stem =~ /^player\//) {
843 make_hash $k, $v->{data64}, $v->{hash64}; 826 make_hash $k, $v->{data64}, $v->{hash64};
844 827
845 #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; 828 #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n";
846 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; 829 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n";
847 830
848 my $stem = delete $v->{stem};
849 $v->{glyph} //= autoglyph $stem, $v;
850
851 if (my $magicmap = $v->{magicmap}) { 831 if (my $magicmap = $v->{magicmap}) {
852 $magicmap =~ y/A-Z_\-/a-z/d; 832 $magicmap =~ y/A-Z_\-/a-z/d;
853 $v->{magicmap} = $COLOR{$magicmap}; 833 $v->{magicmap} = $COLOR{$magicmap};
854 } 834 }
835
836 my $stem = delete $v->{stem};
837 $v->{glyph} //= autoglyph $stem, $v;
838 utf8::encode $v->{glyph};
839 $v->{glyph} = (chr $v->{magicmap}) . $v->{glyph};
855 840
856 delete $v->{arc}; 841 delete $v->{arc};
857 } 842 }
858 843
859 print "processing resources...\n" if $VERBOSE; 844 print "processing resources...\n" if $VERBOSE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines