____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

upgrade.cpp File Reference

The upgrade/allow functions. More...

#include "stratagus.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <map>
#include "upgrade.h"
#include "player.h"
#include "interface.h"
#include "map.h"
#include "script.h"
#include "spells.h"
#include "unit.h"
#include "unittype.h"
#include "actions.h"
#include "iolib.h"

Go to the source code of this file.

Functions

static void AllowUnitId (CPlayer *player, int id, int units)
void SaveUpgrades (CFile *file)
 < save the upgrades
static int CclDefineUnitAllow (lua_State *l)
static int CclDefineAllow (lua_State *l)
void UpgradesCclRegister (void)
int UnitTypeIdByIdent (const std::string &ident)
int UnitIdAllowed (const CPlayer *player, int id)


Detailed Description

The upgrade/allow functions.

Definition in file upgrade.cpp.


Function Documentation

static void AllowUnitId ( CPlayer player,
int  id,
int  units 
) [static]

Change allow for a unit-type.

Parameters:
player Player to change
id unit type id
units maximum amount of units allowed

Definition at line 213 of file upgrade.cpp.

References CPlayer::Allow, and CAllow::Units.

Referenced by CclDefineAllow(), and CclDefineUnitAllow().

static int CclDefineAllow ( lua_State *  l  )  [static]

Define which units/upgrades are allowed.

Definition at line 129 of file upgrade.cpp.

References _C_, AllowUnitId(), DebugPrint, LuaToString(), PlayerMax, Players, UnitMax, and UnitTypeIdByIdent().

Referenced by UpgradesCclRegister().

static int CclDefineUnitAllow ( lua_State *  l  )  [static]

Define which units are allowed and how much.

Definition at line 98 of file upgrade.cpp.

References _C_, AllowUnitId(), DebugPrint, LuaToNumber(), LuaToString(), PlayerMax, Players, and UnitTypeIdByIdent().

Referenced by UpgradesCclRegister().

void SaveUpgrades ( CFile file  ) 

< save the upgrades

Save state of the dependencies to file.

Parameters:
file Output file.

Definition at line 70 of file upgrade.cpp.

References PlayerMax, Players, CFile::printf(), CPlayer::Units, and UnitTypes.

Referenced by SaveGame().

int UnitIdAllowed ( const CPlayer player,
int  id 
)

Return the allow state of the unit.

Parameters:
player Check state of this player.
id Unit identifier.
Returns:
the allow state of the unit.

Definition at line 226 of file upgrade.cpp.

References CPlayer::Allow, Assert, CAllow::Units, and UnitTypeMax.

Referenced by AiCountUnitBuilders().

int UnitTypeIdByIdent ( const std::string &  ident  ) 

UnitType ID by identifier.

Parameters:
ident The unit-type identifier.
Returns:
Unit-type ID (int) or -1 if not found.

Definition at line 188 of file upgrade.cpp.

References _C_, Assert, DebugPrint, CUnitType::Slot, and UnitTypeByIdent().

Referenced by AddButton(), CclDefineAllow(), and CclDefineUnitAllow().

void UpgradesCclRegister ( void   ) 

Register CCL features for upgrades.

Definition at line 169 of file upgrade.cpp.

References CclDefineAllow(), CclDefineUnitAllow(), and Lua.

Referenced by InitCcl().


Generated on Sat Feb 21 00:28:22 2009 for Bos Wars by  doxygen 1.5.6