gameconfig.h File Reference

Game configuration interface, including options, areas, etc. More...

#include "message.h"
#include <SDL.h>

Include dependency graph for gameconfig.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  BattleFieldError_t
 A description with human readible error data from the last error while reading in a battlefield file. More...
struct  GameOptions_t
 Stores information on the current game's options. More...
struct  ScoreUpdate_t
 A store of score updates used to retain updates over a frame and send them all out together. More...

Defines

#define BFLDERRLEN   120
#define MAX_OBSTACLES_PER_MSG   62
 The maximum number of obstacles that can be transmitted in a single MSG_TYPE_OBSTACLE message.

Typedefs

typedef BattleFieldError_t BattleFieldError
typedef GameOptions_t GameOptions
typedef ScoreUpdate_t ScoreUpdate

Enumerations

enum  GAME_OPT_FLAGS {
  OPT_ISSET = 1, OPT_ERROR = 2, OPT_USEGUIDEDSHELL = 4, OPT_USEPONGSHELL = 8,
  OPT_ISCTF = 16, OPT_ISWINSCOREABS = 32, OPT_ALLOWDRAW = 64, OPT_UPDATESCORE = 128
}

Functions

void AddToConfigList (ClientData *client)
 Adds a client to the list of clients waiting for game configuration data.
Bool HandleArea (SocketAddr *origin, NetBuffer *buffer, Uint8 *unused, Uint16 noid)
 Handles an incomming message from the network describing the goal and spawn areas.
Bool HandleGameOption (SocketAddr *origin, NetBuffer *buffer, Uint8 *unused, Uint16 noid)
 Handles an incomming message from the network describing the game options.
Bool HandleObstacle (SocketAddr *origin, NetBuffer *buffer, Uint8 *unused, Uint16 noid)
 Handles an incomming message from the network describing the obstacles on the battlefield.
Bool HandleScoreUpdate (SocketAddr *origin, NetBuffer *buffer, Uint8 *unused, Uint16 noid)
 Handles an incomming message from the network with a updated scores.
Bool InitGameConfig (const char *fname)
 Loads in a game configuration and prepares to send the configuration to all clients.
void RemoveFromConfigList (ClientData *client)
 Removes a given client from the list of clients waiting to receive the game configuration if the client is in the list.
Bool SendScoreUpdate (ScoreUpdate *scores, int len)
 Sends a score update to all connected clients.
Bool ServiceGameConfig ()
 Handles an iteration of sending game configuration data.
void UninitGameConfig ()
 Destroyes a loaded game configuration and deallocates all memory used to store that configuration.

Variables

BattleFieldError bfErr
 The description of the last error to occur while reading a battlefield file.
ClientDataconfigListEnd
 The end of the list of clients that need to be given the game configuration.
ClientDataconfigListStart
 The start of the list of clients that need to be given the game configuration.
GameOptions gameOpts
 The current game's options.
SDL_Rect * goalAreas [TEAM_MAX]
 The lists of CTF goal areas for the game organized by owning team.
SDL_Rect * spawnAreas [TEAM_MAX]
 The lists of spawn areas for the game organized by owning team.


Detailed Description

Game configuration interface, including options, areas, etc.

Author:
Jeff Jackowski (jeffj@ro.com)
Copyright (C) 2007 Jeff Jackowski

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/

Definition in file gameconfig.h.


Define Documentation

#define BFLDERRLEN   120

Definition at line 155 of file gameconfig.h.

Referenced by ErrorOut().


Typedef Documentation

typedef struct BattleFieldError_t BattleFieldError

Definition at line 178 of file gameconfig.h.

typedef struct GameOptions_t GameOptions

Definition at line 92 of file gameconfig.h.


Enumeration Type Documentation

enum GAME_OPT_FLAGS

Enumerator:
OPT_ISSET  When true, indicates that the game configuration has been set and is now valid.

The configuration will not be sent to clients until after this flag is set in LoadConfig().

OPT_ERROR  True if an error occured in the last attempt to load a game configuration.

Used on the server to show that a battle field file could not be loaded becuase if errors within it.

OPT_USEGUIDEDSHELL  True to allow the use of guided shells.
OPT_USEPONGSHELL  True to allow the use of pong shells.
OPT_ISCTF  True if the game is a capture-the-flag match, false if it is a deathmatch.
OPT_ISWINSCOREABS  True if the winning score is absolute -- the team that reaches it first wins.

If false, the score is relative -- the team that scores the given amount above the other team's score wins.

OPT_ALLOWDRAW  Allow the game to end when neither team wins.

If false, sudden death overtime will be used to determine a victor.

OPT_UPDATESCORE  Indicates that the team score has changed and needs to be sent to the clients.

Only valid on the server.

Definition at line 94 of file gameconfig.h.


Variable Documentation

BattleFieldError bfErr

The description of the last error to occur while reading a battlefield file.

If no error has occured, the data is invalid.

Definition at line 52 of file gameconfig.c.

Referenced by BfldErrResize(), and ErrorOut().

GameOptions gameOpts

The current game's options.

Definition at line 47 of file gameconfig.c.

Referenced by ErrorOut(), FlagCfgMsg(), GameInit(), GameRun(), HandleArea(), HandleGameOption(), HandleObstacle(), HandleScoreUpdate(), InitGameConfig(), MakeBuffers(), MessageSrvToCli(), MoveShell(), MoveTank(), ObstacleInit(), ObstacleUninit(), ReadInts(), RenderScore(), SendScoreUpdate(), ServiceGameConfig(), SetupScrolling(), SpawnTank(), StartLoadConfig(), and UninitGameConfig().

SDL_Rect* goalAreas[TEAM_MAX]

The lists of CTF goal areas for the game organized by owning team.

Todo:
Determine if this is the best spot for this declaration.

Definition at line 50 of file gameconfig.c.

Referenced by HandleArea(), MakeBuffers(), and UninitGameConfig().

SDL_Rect* spawnAreas[TEAM_MAX]

The lists of spawn areas for the game organized by owning team.

Todo:
Determine if this is the best spot for this declaration.

Definition at line 49 of file gameconfig.c.

Referenced by HandleArea(), MakeBuffers(), SpawnTank(), and UninitGameConfig().


Generated on Mon May 28 04:41:39 2007 for Retro Tank Super Attack by  doxygen 1.5.2