$treeview $search $mathjax
Stratagus  2.2.6
$projectbrief
$projectbrief
$searchbox
-->
         _________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
           Stratagus - A free fantasy real time strategy game engine

src/stratagus/groups.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include "unit.h"
#include "unit_manager.h"
#include "unittype.h"
#include "script.h"
#include "player.h"
#include "iolib.h"
#include "actions.h"

Classes

struct  CUnitGroup

groups.cpp - The units' groups handling.

static CUnitGroup Groups [NUM_GROUPS]
 group of units
void InitGroups ()
 Number of groups predefined.
void SaveGroups (CFile *file)
 Save groups.
void CleanGroups ()
 Cleanup groups.
int IsGroupTainted (int num)
int GetNumberUnitsOfGroup (int num, GroupSelectionMode mode)
 Get the number of units in a particular group.
CUnit ** GetUnitsOfGroup (int num)
 Get the array of units of a particular group.
void ClearGroup (int num)
 Remove all units from a group.
void AddToGroup (CUnit **units, int nunits, int num)
 Add the array of units to the group.
void SetGroup (CUnit **units, int nunits, int num)
 Set the contents of a particular group with an array of units.
void RemoveUnitFromGroups (CUnit &unit)
 Remove a unit from a group.
void GroupHelpMe (CUnit *attacker, CUnit &defender)
 ask group members for help
static int CclGroup (lua_State *l)
void GroupCclRegister ()
 Register CCL group features.

Function Documentation

void AddToGroup ( CUnit **  units,
int  nunits,
int  num 
)

Add the array of units to the group.

Add units to group num contents from unit array "units"

Parameters:
units Array of units to place into group.
nunits Number of units in array.
num Group number for storage.

static int CclGroup ( lua_State *  l  )  [static]

Define the group.

Parameters:
l Lua state.

void CleanGroups (  ) 

Cleanup groups.

Clean up group part.

void ClearGroup ( int  num  ) 

Remove all units from a group.

Clear contents of group num

Parameters:
num Group number.

int GetNumberUnitsOfGroup ( int  num,
GroupSelectionMode  mode 
)

Get the number of units in a particular group.

Return the number of units of group num

Parameters:
num Group number.
Returns:
Returns the number of units in the group.

CUnit** GetUnitsOfGroup ( int  num  ) 

Get the array of units of a particular group.

Return the units of group num

Parameters:
num Group number.
Returns:
Returns an array of all units in the group.

void GroupCclRegister (  ) 

Register CCL group features.

Register CCL features for groups.

void GroupHelpMe ( CUnit attacker,
CUnit defender 
)

ask group members for help

Called if a member of Group is Attacked

Parameters:
attacker Pointer to attacker unit.
defender Pointer to unit that is being attacked.

void InitGroups (  ) 

Number of groups predefined.

Initialize data structures for groups.

Initialize group part.

Todo:
Not needed with the new unit code!

int IsGroupTainted ( int  num  ) 

void RemoveUnitFromGroups ( CUnit unit  ) 

Remove a unit from a group.

Remove unit from its groups

Parameters:
unit Unit to remove from group.

void SaveGroups ( CFile file  ) 

Save groups.

Save groups.

Parameters:
file Output file.

void SetGroup ( CUnit **  units,
int  nunits,
int  num 
)

Set the contents of a particular group with an array of units.

Set group num contents to unit array "units"

Parameters:
units Array of units to place into group.
nunits Number of units in array.
num Group number for storage.


Variable Documentation

CUnitGroup Groups[NUM_GROUPS] [static]

group of units

(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.