1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef _GROUP_HANDLER_H
#define _GROUP_HANDLER_H
#include "System/creg/creg_cond.h"
#include <string>
#include <vector>
class CGroup;
/**
* Handles all groups of a single team.
* The default groups (aka hot-key groups) are the ones with
* single digit IDs (1 - 9).
* Groups with higher IDs are considered special.
* Manual group creation/selection only works for the default groups.
*/
class CGroupHandler {
CR_DECLARE_STRUCT(CGroupHandler)
public:
CGroupHandler(int teamId);
~CGroupHandler();
/// lowest ID of the first group not reachable through a hot-key
static const size_t FIRST_SPECIAL_GROUP = 10;
void Update();
bool GroupCommand(int num);
bool GroupCommand(int num, const std::string& cmd);
CGroup* CreateNewGroup();
void RemoveGroup(CGroup* group);
void PushGroupChange(int id);
public:
std::vector<CGroup*> groups;
int team;
protected:
std::vector<int> freeGroups;
/**
* The lowest ID not in use.
* This is always greater or equal FIRST_SPECIAL_GROUP.
*/
int firstUnusedGroup;
std::vector<int> changedGroups;
};
extern std::vector<CGroupHandler*> grouphandlers;
#endif // _GROUP_HANDLER_H
|