// xConq
// Foundation for Project

// $Id: projbase.h,v 1.2 2006/05/14 16:18:48 eric_mcdonald Exp $

/*//////////////////////////// COPYRIGHT NOTICE ////////////////////////////////

  Copyright (C) 1987-1989   Stanley T. Shebs
  Copyright (C) 1991-2000   Stanley T. Shebs
  Copyright (C) 2006        Eric A. McDonald

//////////////////////////////////// LICENSE ///////////////////////////////////

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

//////////////////////////////////////////////////////////////////////////////*/

/*! \mainpage Developer Guide for xConq
    \section sec_intro Introduction
    Welcome to the source documentation for xConq. The various APIs are here documented.
    Most of the internals are documented as well.
    In addition to documenting the data structures, functions, and their relations, this guide
    also:
    <ul>
	<li> gives an overview of the software architecture (\ref pg_overview).
	<li> discusses the rationale behind the design (\ref pg_design).
	<li> argues the choice of development tools and techniques (\ref pg_tools).
	<li> indicates the programming guidelines to follow (\ref pg_rules).
    </ul>

    \page pg_overview Overview
    \page pg_design Design
    \page pg_tools Tools and Techniques
    \page pg_rules Programming Guidelines
*/

/*! \file
    \brief Foundation and system includes for project.
    \todo Wrap header includes with 'HAVE_' macros, and move to separate file.

    Defines the base namespace for the project.\n
    Includes useful system headers.\n
    Includes basic configuration options.
*/

#ifndef XCONQ_BASE_H
#define XCONQ_BASE_H

#ifdef NAMESPACE_XCONQ_BEGIN
#undef NAMESPACE_XCONQ_BEGIN
#endif
#ifdef NAMESPACE_XCONQ_END
#undef NAMESPACE_XCONQ_END
#endif
//! Begin namespace.
#define NAMESPACE_XCONQ_BEGIN	    namespace xconq {
//! End namespace.
#define NAMESPACE_XCONQ_END	    }

#ifdef USING_NAMESPACE_XCONQ
#undef USING_NAMESPACE_XCONQ
#endif
//! Use namespace.
#define USING_NAMESPACE_XCONQ	    using namespace xconq;

/*! \brief Base namespace for project.

    Contains all of the project namespaces.
*/

NAMESPACE_XCONQ_BEGIN
NAMESPACE_XCONQ_END

// Is the autogenerated header available? If so, then use it.

#ifdef HAVE_CONFIG_H
#   include "acconfig.h"
#endif

#if (0)
// Include standard C++ headers.

#include <stdexcept>
#include <string>
#include <iostream>
#include <iomanip>

// Include standard C-compatibility headers.

#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <cstdarg>
#include <cstring>
#include <climits>
#include <cerrno>
#endif

#ifndef MAXSIDES
//! Absolute maximum number of sides that can play.
/*! This cannot be set higher than 30 without hacking up
    side mask machinery.  Smaller values will incur fewer
    assorted memory penalties, and in any case games with
    lots of sides don't usually play very well.\n
    IMPORTANT! The actual number of sides, including the
    independents (side 0) is MAXSIDES + 1. All arrays 
    should be allocated accordingly: foo[MAXSIDES + 1].
*/
#define MAXSIDES 15
#endif

//! Default path buffer size.
/*! All path names must be able to fit in statically
    allocated buffers of this size.
*/
#define PATH_SIZE 8192

#if (0)
/* Universally required include files. */

#include <ctype.h>

/* Prototypes for snprintf(3) and vsnprintf(3). */
#include "snprintf.h"

/* Declarations of missing time structs and functions. */
#include "timestuff.h"

// Some common typedefs.
namespace Xconq {
    typedef signed char		Z8;
    typedef unsigned char	Byte;
    typedef short		Z16;
    typedef unsigned short	Z16u;
#ifdef HAVE_ACDEFS_H
#if (SIZEOF_INT == 4)
    typedef int			Z32;
    typedef unsigned int	Z32u;
#else
    typedef long		Z32;
    typedef unsigned long	Z32u;
#endif // sizeof int == 4
#if (SIZEOF_LONG == 8)
    typedef long		Z64;
    typedef unsigned long	Z64u;
#else
    typedef long long		Z64;
    typedef unsigned long long	Z64u;
#endif // sizeof long == 8
#else
// No autogenerated defs available.
    typedef int			Z32;
    typedef unsigned int	Z32u;
    // Hope that we have long long, and that it is not 128 bits.
    typedef long long		Z64;
    typedef unsigned long long	Z64u;
#endif
}

/* Implementation of offsetof. (Is it safe?) (Should add to 'missing' dir.) */
#ifndef offsetof
#define offsetof(TYPE,FLD)	\
    ((unsigned int) (((char *) (&(((TYPE *) NULL)->FLD))) - ((char *) NULL)))
#endif

/* Assume 32-bit INT_*. (Need to do the right thing at some point.) */
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
#ifndef INT_MIN
#define INT_MIN (-INT_MAX -1)
#endif

/* Some platform-specific flags. */
#if (defined (MAC) && !defined (AVOID_OBSTACK))
#define AVOID_OBSTACK
#endif

#ifndef SCOREFILE
/*! \brief Scores file. */
#ifdef WIN32
#define SCOREFILE "XconqScores.txt"
#else
#define SCOREFILE "XconqScores"
#endif
#endif
#ifndef OLD_SCOREFILE
#define OLD_SCOREFILE "scores.xcq"
#endif

#ifndef STATSFILE
/*! \brief Statistics file. */
#ifdef WIN32
#define STATSFILE "XconqStats.txt"
#else
#define STATSFILE "XconqStats"
#endif
#endif

#ifndef SAVEFILE
/*! \brief Save file. */
#define SAVEFILE "Save.xcq"
#endif

/* (This gets overridden by the individual platforms.) */
#ifndef CHECKPOINTFILE
/*! \brief Checkpoint file. */
#define CHECKPOINTFILE "check.xcq"
#endif

#ifndef PREFERENCESFILE
/*! \brief preferences file. */
#ifdef WIN32
#define PREFERENCESFILE "XconqPrefs.txt"
#else
#define PREFERENCESFILE "XconqPrefs"
#endif
#endif
#ifndef OLD_PREFERENCESFILE
#define OLD_PREFERENCESFILE "prefs.xcq"
#endif

/* The name of the default game. */

#ifndef STANDARD_GAME
/*! \brief Default game. */
#define STANDARD_GAME "standard"
#endif

/* The name of the introductory game. */

#ifndef INTRO_GAME
/*! \brief Introductory game file. */
#define INTRO_GAME "intro"
#endif


#ifndef DEFAULTWIDTH
/*! \brief Default world width. 
 *
 * Default random world size.  Adjust these to taste - for the standard
 * game, 60x60 is a moderate length game, 30x30 is short, 360x120 is
 * L-O-N-G !  (Remember to multiply the two numbers to get an idea of the
 * number of cells that will be in the world!)  Defaults can also be set
 * by modules explicitly, so this is really a "default default" :-) .
 */
#define DEFAULTWIDTH 60
#endif
#ifndef DEFAULTHEIGHT
/*! \brief Default world height.
 *
 * \see DEFAULTWIDTH 
 */
#define DEFAULTHEIGHT 30
#endif

#ifndef DEFAULTCIRCUMFERENCE
/*! \brief Default world circumference.
 *
 * If this matches the default width, then the game area
 * wraps around in x; otherwise it will be a polygon.
 */
#define DEFAULTCIRCUMFERENCE 360
#endif

/*! \brief Maximum numbers of types of AIs. */
#define MAXAITYPES 10

/*! \brief Default string buffer size.
 *
 * The game blurb must be able to fit in statically
 * allocated buffers of this size.
 */
#define BLURBSIZE 480

/* \note The following options are (should be anyway) mostly independent of
   each other, and settable at will. */

/*! \brief Message rudeness.
 *
 * When defined, messages will be somewhat nastier.  Set this to be
 * appropriate for your intended audience, heh-heh :-)
 */
#define RUDE

/*! \brief Design mode availability.
 *
 * If defined, then an editing mode is available.  This is also a
 * powerful way to cheat, which is why it can be disabled.
 */
#define DESIGNERS

/*! \brief DEBUG flag.
 *
 * If defined, some (actually a lot) debugging code will be included.
 */
#define DEBUGGING
#include <assert.h>
#if (0)
#define NDEBUG
#endif

#endif // Temp disable.

#endif // ifndef XCONQ_BASE_H
