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

Comparing deliantra/server/lib/collect.pl.in (file contents):
Revision 1.1 by root, Fri Feb 3 07:13:04 2006 UTC vs.
Revision 1.2 by pippijn, Sun May 7 13:19:17 2006 UTC

6 if ($ARGV[0] =~ m/^--?[hH](elp)?$/) { 6 if ($ARGV[0] =~ m/^--?[hH](elp)?$/) {
7 die ("\nUSAGE: perl collect.pl ARCHDIR\n". 7 die ("\nUSAGE: perl collect.pl ARCHDIR\n".
8 "\nWhere ARCHDIR is the directory where you stored the ". 8 "\nWhere ARCHDIR is the directory where you stored the ".
9 "raw archetypes.\n". 9 "raw archetypes.\n".
10 "This script will then create these files:\n". 10 "This script will then create these files:\n".
11 "archetypes,bmaps,bmaps.paths,faces,treasures.bld,animations.\n" 11 "archetypes,bmaps,bmaps.paths,faces,smooth,treasures.bld,animations.\n"
12 ) 12 )
13 } 13 }
14} 14}
15 15
16# archonly is used to only build the archetypes. I find this 16# archonly is used to only build the archetypes. I find this
30$faces = "faces"; 30$faces = "faces";
31$treasures = "treasures.bld"; 31$treasures = "treasures.bld";
32$animations = "animations"; 32$animations = "animations";
33$paths = $bmaps."."."paths"; 33$paths = $bmaps."."."paths";
34$faceExt = "\\.[a-zA-Z0-9][A-Z0-9][A-Z0-9]"; 34$faceExt = "\\.[a-zA-Z0-9][A-Z0-9][A-Z0-9]";
35$smooths = "smooth"; 35$smooth = "smooth";
36 36
37### main 37### main
38&info("looking ..."); 38&info("looking ...");
39&traverse($root); 39&traverse($root);
40 40
65$attacktype{ 'lifestealing' } = ( 1 << 24 ); 65$attacktype{ 'lifestealing' } = ( 1 << 24 );
66$attacktype{ 'disease' } = ( 1 << 25 ); 66$attacktype{ 'disease' } = ( 1 << 25 );
67 67
68&info("writing ...$archetypes"); 68&info("writing ...$archetypes");
69open(ARCH,">".$archetypes) || &die("cannot open ".$archetypes); 69open(ARCH,">".$archetypes) || &die("cannot open ".$archetypes);
70&archsOut; 70&archsOut($root);
71close(ARCH); 71close(ARCH);
72 72
73 73
74if (!$archonly) { 74if (!$archonly) {
75 &info("$bmaps"); 75 &info("$bmaps");
84 &info("$faces"); 84 &info("$faces");
85 open(FACES,">".$faces) || &die("cannot open ".$faces); 85 open(FACES,">".$faces) || &die("cannot open ".$faces);
86 &facesOut; 86 &facesOut;
87 close(FACES); 87 close(FACES);
88 88
89 &info("$smooths"); 89 &info("$smooth");
90 open(SMOOTHS,">".$smooths) || &die("cannot open ".$smooths); 90 open(SMOOTHS,">".$smooth) || &die("cannot open ".$smooth);
91 &smoothOut; 91 &smoothOut;
92 close(SMOOTHS); 92 close(SMOOTHS);
93 93
94 &info("$treasures"); 94 &info("$treasures");
95 # We still support the old consolidated treasure information 95 # We still support the old consolidated treasure information
217 } 217 }
218} 218}
219 219
220 220
221sub archsOut { 221sub archsOut {
222 local($dir) = shift;
223
222 foreach $arch (@archs) { 224 foreach $arch (@archs) {
225 # Assume the filename $arch begins with $dir. Assign all path name
226 # components after $dir to $pathto.
227 if($arch =~ /^\Q$dir\E\/(.*)\/[^\/]*[.]arc$/) {
228 $pathto = $1;
229 } else {
230 &warn("cannot determine editor_folder from arch '$arch'");
231 $pathto = "";
232 }
223 open(ARC,$arch) || &die("cannot open ".$arch); 233 open(ARC,$arch) || &die("cannot open ".$arch);
224 $pathto = $arch;
225 $pathto =~ s@[^/]*/@@;
226 $pathto =~ s@[a-z]*/(.*)/.*arc@$1@;
227line: while(<ARC>) { 234line: while(<ARC>) {
228 chop; 235 chop;
229 ($var,@values) = split; 236 ($var,@values) = split;
230 if ($var eq "#") { 237 if ($var eq "#") {
231 #developper comment, switch to next line 238 #developper comment, switch to next line
263 if ($var eq "color_bg") { 270 if ($var eq "color_bg") {
264 $lbg = $values[0]; 271 $lbg = $values[0];
265 next line; 272 next line;
266 } 273 }
267 if ($var eq "end") { 274 if ($var eq "end") {
268 print ARCH "editor_folder $pathto\n"; 275 print ARCH "editor_folder $pathto\n" if $pathto ne "";
269 } 276 }
270 if ($var eq "visibility") { 277 if ($var eq "visibility") {
271 $lvis = $values[0]; 278 $lvis = $values[0];
272 next line; 279 next line;
273 } 280 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines