Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Map loading.



Excerpts from games.Crossfire: 30-Sep-93 Map loading. Mark
Wedel@rahul.net (463)


>  I am using the crossfire that comes with crossedit 0.6 (might as well
> make additions to the newest version, right?)

>  The problem I have is that everything is close (armor shop, weapon shop,
> gatehouse, etc..)  It loads the town map just fine, however.

>  IS there some script I need to run or something to get this working?


In this version, for some reason I can't quite fathom, the pathname to
the map is indicated by the variable "slaying" on an exit object.  If an
exit object does not have the slaying variable defined, it is considered
closed.  The value of the variable should be the pathname/mapname of the
new map to go to.  I don't know if the version you have uses "mapindex"
or not but in this version that file is no longer used. 

The perl script I used to go from maps without the "slaying" variable
and which used "mapindex" numbers to go to the new format is below. 
Note I was going from 0.89.2 maps (which had been mapconv'd et al) and
in that version of maps the new map to go to is held by the variable
"food".  Sheesh.


---- Enclosure ----
#!/vol/perl/bin/perl
open(IDX, "<../mapindex") || die("Can't get at mapindex");

while (<IDX>) {
	($num, $file) = split;
	$mapping{$num} = $file;
}

#@files = <*>;

while ($filename = pop(@ARGV)) {
	print "Working on $filename\n";
	open(FILE, "<$filename") || die("Cannot open $filename for reading");
	rename($filename, "$filename.bak") || die("Cannot rename $filename");
	open(OUT, ">$filename") || die("Cannot open $filename for writing");
	while (<FILE>) {
	    foo: {
		if (/^food (.*)$/) {
			if ($mapping{$1}) {
				print OUT "slaying " . $mapping{$1} . "\n";
				last foo;
			}
		}
		print OUT $_;
	    }
	}
	close(OUT);
	close(FILE);

}

---- Enclosure ----

Nick Williams                          E-mail: njw@cs.city.ac.uk (MIME and ATK)
Systems Architecture Research Centre,  Tel: +44 71 477 8551
London, EC1V 0HB                       Fax: +44 71 477 8587