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.88 by root, Tue Oct 5 23:26:44 2010 UTC vs.
Revision 1.92 by root, Tue Oct 5 23:59:10 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 = (
162 "_0" => "⬤",
163 "_1_3" => "╸",
164 "_1_4" => "╺",
165 "_2_1_2" => "━",
166
167 "_1_2" => "╹",
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
161sub autoglyph { 183sub autoglyph {
162 my ($stem, $face) = @_; 184 my ($stem, $face) = @_;
163 185
164 if ($stem =~ /^wall\/|Nimwall/) { 186 if ($stem =~ /^wall\/|Nimwall/) {
165# warn $stem; 187 if ($stem =~ /((?:_[0-4])+).x11/) {
188 return $WALL_SUFFIX{$1} if exists $WALL_SUFFIX{$1};
189 }
190
166 "+" 191 "+"
192
167 } elsif ($stem =~ /^floor\/|^ground\/|Nimfloor/) { 193 } elsif ($stem =~ /^floor\/|^ground\/|Nimfloor/) {
168 "." 194 "."
195
169 } elsif ($stem =~ /^player\//) { 196 } elsif ($stem =~ /^player\//) {
170 "@" 197 "\@"
198
171 } else { 199 } else {
172 substr $stem, 0, 1 200 substr $stem, 0, 1
173 } 201 }
174} 202}
175 203
815 make_hash $k, $v->{data64}, $v->{hash64}; 843 make_hash $k, $v->{data64}, $v->{hash64};
816 844
817 #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; 845 #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n";
818 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; 846 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n";
819 847
820 my $stem = delete $v->{stem};
821 $v->{glyph} //= autoglyph $stem, $v;
822
823 if (my $magicmap = $v->{magicmap}) { 848 if (my $magicmap = $v->{magicmap}) {
824 $magicmap =~ y/A-Z_\-/a-z/d; 849 $magicmap =~ y/A-Z_\-/a-z/d;
825 $v->{magicmap} = $COLOR{$magicmap}; 850 $v->{magicmap} = $COLOR{$magicmap};
826 } 851 }
852
853 my $stem = delete $v->{stem};
854 $v->{glyph} //= autoglyph $stem, $v;
855 $v->{glyph} = (chr $v->{magicmap}) . $v->{glyph};
827 856
828 delete $v->{arc}; 857 delete $v->{arc};
829 } 858 }
830 859
831 print "processing resources...\n" if $VERBOSE; 860 print "processing resources...\n" if $VERBOSE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines