Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 74fbd0eb33bb08f719b79951bc4e329e > files > 26

xconq-7.5.0-1.20050612.5mdv2009.1.i586.rpm

<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.39
     from ./hacking.texi on 12 June 2005 -->

<TITLE>Hacking Xconq - Error Handling</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="hacking_1.html">first</A>, <A HREF="hacking_16.html">previous</A>, <A HREF="hacking_18.html">next</A>, <A HREF="hacking_35.html">last</A> section, <A HREF="hacking_toc.html">table of contents</A>.
<HR>


<H2><A NAME="SEC17" HREF="hacking_toc.html#SEC17">Error Handling</A></H2>

<P>
The interface must provide implementations of these error-handling
functions:

</P>

<UL>

<LI>

<CODE>void cmd_error(Side *side, char *fmt, ...)</CODE>

This is for player command errors.  Syntax is like printf.  Normal
behavior should be to display the formatted output somewhere that will
get the player's attention.

<LI>

<CODE>void low_init_warning(char *str)</CODE>

This is for undesirable but not necessarily wrong things that happen
while setting up a game.  For instance, if players start out too close
or too far from each other, it will often affect the play of the game
adversely, so the kernel issues a warning, therby giving the prospective
players a chance to cancel the game and start over.  The kernel's
warning message should indicate any likely results of continuing on, so
the players can decide whether or not to chance it.

<LI>

<CODE>low_init_error(char *str)</CODE>

This function should indicate a serious and unrecoverable error during
initialization.  It should not return to its caller.

<LI>

<CODE>low_run_warning(char *str)</CODE>

Warnings during the game are rare but not unknown.  They are very often
due to bugs in <I>Xconq</I>, so any occurrence should be investigated
further.  It is possible for some game designs to have latent flaws that
may result in a warning.  In any case, the interface should allow the
players to continue on, to save their game and quit, by calling
<CODE>save_the_game</CODE>, or else quit without saving anything.

<LI>

<CODE>low_run_error(char *str)</CODE>

In the worst case, <I>Xconq</I> can get into a situation, such as memory
exhaustion, where there is no way to continue.  The kernel will then
call <CODE>run_error</CODE>, which should inform players that <I>Xconq</I> must
shut itself down.  They do get the option of saving the game, and the
routine should call <CODE>save_game_state??</CODE> to do this safely.  This
routine should also not return to its caller.

<LI>

<CODE>printlisp(Obj *obj)</CODE>

This is needed to print GDL objects to "stdout" or its equivalent.

</UL>

<HR>
Go to the <A HREF="hacking_1.html">first</A>, <A HREF="hacking_16.html">previous</A>, <A HREF="hacking_18.html">next</A>, <A HREF="hacking_35.html">last</A> section, <A HREF="hacking_toc.html">table of contents</A>.
</BODY>
</HTML>