00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __UNIT_CACHE_H__
00029 #define __UNIT_CACHE_H__
00030
00032
00033
00034
00035
00036
00037 #include <vector>
00038
00039
00040
00041
00042
00043
00044 class CUnit;
00045
00049 class CUnitCache
00050 {
00051 public:
00053 void Init(int mapWidth, int mapHeight);
00054
00056 void Insert(CUnit *unit);
00057
00059 void Remove(CUnit *unit);
00060
00062 int Select(int x1, int y1, int x2, int y2, CUnit **table, int tablesize);
00063
00065 int Select(int x, int y, CUnit **table, int tablesize);
00066
00067 private:
00068 int width;
00069 int height;
00070 std::vector<std::vector<std::vector<CUnit *> > > cache;
00071 };
00072
00073 extern CUnitCache UnitCache;
00074
00075
00077
00078 #endif // !__UNIT_CACHE_H__