Added load-map

This commit is contained in:
jsalmon3 2002-12-05 20:43:20 +00:00
parent 9507cc5843
commit 499d31eb80
3 changed files with 65 additions and 10 deletions
doc/scripts
src/stratagus

View file

@ -69,6 +69,7 @@
<A HREF="#get-unit-unholy-armor">get-unit-unholy-armor</A>
<A HREF="#group">group</A>
<A HREF="#library-path">library-path</A>
<A HREF="#load-map">load-map</A>
<A HREF="#load-pud">load-pud</A>
<A HREF="#log">log</A>
<A HREF="#make-unit">make-unit</A>
@ -863,34 +864,59 @@ Returns the current game cycle.
<A HREF="../../data/ccl/wc2.ccl"> $LIBARYPATH/ccl/wc2.ccl </A>
<A NAME="load-pud"></A>
<H3>load-pud</H3>
<A NAME="load-map"></A>
<H3>load-map</H3>
<H4>Description</H4>
.
Load a map using any of the supported formats.
<H4>Syntax</H4>
<CODE>(load-pud)</CODE>
<CODE>(load-map map)</CODE>
<DL>
<DT></DT>
<DD>.
<DT>map</DT>
<DD>Name of the map to load.
</DD>
</DL>
<H4>Example</H4>
<PRE>
(load-pud)
(load-map "campaigns/human/level01h.pud")
</PRE>
<P>.
<P>Loads the map.
<H4>Used</H4>
<H4>Not Used</H4>
<A HREF="../../data/ccl/wc2.ccl"> $LIBARYPATH/ccl/wc2.ccl </A>
<A NAME="load-pud"></A>
<H3>load-pud</H3>
<H4>Description</H4>
Load a map using the pud format.
<H4>Syntax</H4>
<CODE>(load-pud map)</CODE>
<DL>
<DT>map</DT>
<DD>Name of the map to load.
</DD>
</DL>
<H4>Example</H4>
<PRE>
(load-pud "campaigns/human/level01h.pud")
</PRE>
<P>Loads the pud.
<H4>Not Used</H4>
<A NAME="log"></A>
<H3>log</H3>

View file

@ -286,6 +286,8 @@
<DD></DD>
<DT><A HREF="game.html#library-path">library-path</A></DT>
<DD></DD>
<DT><A HREF="game.html#load-map">load-map</A></DT>
<DD></DD>
<DT><A HREF="game.html#load-pud">load-pud</A></DT>
<DD></DD>
<DT><A HREF="game.html#log">log</A></DT>

View file

@ -483,6 +483,32 @@ local SCM CclLoadPud(SCM file)
return SCM_UNSPECIFIED;
}
/**
** Load a map. (Try in library path first)
**
** @param file filename of map.
**
** @return FIXME: Nothing.
*/
local SCM CclLoadMap(SCM file)
{
char* name;
char buffer[1024];
name=gh_scm2newstr(file,NULL);
if( strcasestr(name,".pud") ) {
LoadPud(LibraryFileName(name,buffer),&TheMap);
} else if( strcasestr(name,".scm") ) {
LoadScm(LibraryFileName(name,buffer),&TheMap);
} else if( strcasestr(name,".chk") ) {
LoadChk(LibraryFileName(name,buffer),&TheMap);
}
free(name);
// FIXME: LoadPud should return an error
return SCM_UNSPECIFIED;
}
/**
** Define a map.
**
@ -601,6 +627,7 @@ global void InitCcl(void)
EditorCclRegister();
init_subr_1("load-pud",CclLoadPud);
init_subr_1("load-map",CclLoadMap);
init_subr_2("define-map",CclDefineMap);
gh_new_procedure0_0("units",CclUnits);