 |
Stratagus
2.2.7
$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/include/unit_manager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __UNITMANAGER_H__
00030 #define __UNITMANAGER_H__
00031
00033
00034
00035
00036
00037
00038 #include <vector>
00039 #include <list>
00040
00041
00042
00043
00044
00045
00046 class CUnit;
00047 class CFile;
00048 struct lua_State;
00049
00050 class CUnitManager
00051 {
00052 public:
00053 typedef std::vector<CUnit *>::iterator Iterator;
00054 public:
00055 CUnitManager();
00056 void Init();
00057
00058 CUnit *AllocUnit();
00059 void ReleaseUnit(CUnit *unit);
00060 void Save(CFile &file) const;
00061 void Load(lua_State *Lua);
00062
00063
00064 void Add(CUnit *unit);
00065 Iterator begin();
00066 Iterator end();
00067 bool empty() const;
00068
00069 CUnit *lastCreatedUnit();
00070
00071
00072 CUnit &GetSlotUnit(int index) const;
00073 unsigned int GetUsedSlotCount() const;
00074
00075 private:
00076 std::vector<CUnit *> units;
00077 std::vector<CUnit *> unitSlots;
00078 std::list<CUnit *> releasedUnits;
00079 CUnit *lastCreated;
00080 };
00081
00082
00083
00084
00085
00086
00087 extern CUnitManager UnitManager;
00088
00090
00091 #endif // !__UNITMANAGER_H__
(C) Copyright 1998-2012 by The