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.86 by root, Tue Oct 5 22:33:10 2010 UTC vs.
Revision 1.102 by root, Wed Oct 6 18:23:52 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;
154 "--exclude", "CVS", "--exclude", "/world-precomposed", 154 "--exclude", "CVS", "--exclude", "/world-precomposed",
155 "--delete", "--delete-excluded" 155 "--delete", "--delete-excluded"
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}
160
161our @WALL_SUFFIX = qw(⬤ ╹ ╺ ┗ ╻ ┃ ┏ ┣ ╸ ┛ ━ ┻ ┓ ┫ ┳ ╋);
162
163# used to create crude text glyphs for text-based clients
164sub autoglyph {
165 my ($stem, $face) = @_;
166
167 if ($stem =~ /^wall\/|Nimwall/) {
168 return $WALL_SUFFIX[hex $1]
169 if $stem =~ /(_[0-9A-F]).x11/;
170
171 "█"
172
173 } elsif ($stem =~ /^traps\//) {
174 "☠"
175
176 } elsif ($stem =~ /^armour\/shield/) {
177 "Ø"
178
179 } elsif ($stem =~ /^armour\//) {
180 "A"
181
182 } elsif ($stem =~ /^weapon\//) {
183 "†"
184
185 } elsif ($stem =~ /^readable\//) {
186 "✉"
187
188 } elsif ($stem =~ /^river\//) {
189 "~"
190
191 } elsif ($stem =~ /^floor\/|^ground\/|Nimfloor/) {
192 "·"
193
194 } elsif ($stem =~ /^spells\//) {
195 "!"
196
197 } elsif ($stem =~ /^exit\//) {
198 "⎆"
199
200 } elsif ($stem =~ /^construct\//) {
201 "⌂"
202
203 } elsif ($stem =~ /^player\//) {
204 "\@"
205
206 } elsif ($stem =~ /^(?:monster|misc|class|connect|gods|indoor|inorganic|mining|music|skills).*\/(.)/) {
207 $1
208
209 } else {
210 substr $stem, 0, 1
211 }
159} 212}
160 213
161{ 214{
162 our %ANIMINFO; 215 our %ANIMINFO;
163 our %FACEINFO; 216 our %FACEINFO;
800 make_hash $k, $v->{data64}, $v->{hash64}; 853 make_hash $k, $v->{data64}, $v->{hash64};
801 854
802 #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; 855 #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n";
803 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; 856 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n";
804 857
805 my $stem = delete $v->{stem};
806 $v->{glyph} //= substr $stem, 0, 1;
807
808 if (my $magicmap = $v->{magicmap}) { 858 if (my $magicmap = $v->{magicmap}) {
809 $magicmap =~ y/A-Z_\-/a-z/d; 859 $magicmap =~ y/A-Z_\-/a-z/d;
810 $v->{magicmap} = $COLOR{$magicmap}; 860 $v->{magicmap} = $COLOR{$magicmap};
811 } 861 }
862
863 my $stem = delete $v->{stem};
864 $v->{glyph} //= autoglyph $stem, $v;
865 utf8::encode $v->{glyph};
866 $v->{glyph} = (chr $v->{magicmap}) . $v->{glyph};
812 867
813 delete $v->{arc}; 868 delete $v->{arc};
814 } 869 }
815 870
816 print "processing resources...\n" if $VERBOSE; 871 print "processing resources...\n" if $VERBOSE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines