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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
// enum to make characters easy to identify
enum struct characterType
{
object,
humanplayer,
enemy,
editing,
null
};
// struct to store sizes
struct objSizeType
{
int ybottom;
int xleft;
int ytop;
int xright;
};
// make storage container
std::multimap<characterType, objSizeType> objSizeMap;
// make temp struct to hold data that will be stored in objSizeMap
objSizeType objSize;
// humanplayer
objSize.ybottom = 0;
objSize.xleft = 0;
objSize.ytop = -2;
objSize.xright = 2;
objSizeMap.insert(std::pair<characterType, objSizeType>(characterType::humanplayer, objSize));
objSize.ybottom = -3;
objSize.xleft = 1;
objSize.ytop = -3;
objSize.xright = 1;
objSizeMap.insert(std::pair<characterType, objSizeType>(characterType::humanplayer, objSize));
// object
objSize.ybottom = 0;
objSize.xleft = 0;
objSize.ytop = 0;
objSize.xright = 0;
objSizeMap.insert(std::pair<characterType, objSizeType>(characterType::object, objSize));
// enemy
objSize.ybottom = -3;
objSize.xleft = 1;
objSize.ytop = -3;
objSize.xright = 1;
objSizeMap.insert(std::pair<characterType, objSizeType>(characterType::enemy, objSize));
objSize.ybottom = 0;
objSize.xleft = 0;
objSize.ytop = -2;
objSize.xright = 2;
objSizeMap.insert(std::pair<characterType, objSizeType>(characterType::enemy, objSize));
objSize.ybottom = 1;
objSize.xleft = -3;
objSize.ytop = 1;
objSize.xright = 5;
objSizeMap.insert(std::pair<characterType, objSizeType>(characterType::enemy, objSize));
// so i've got this far and works fine; info is stored and can be displayed...
// now i'd like to search and capture multiple instances of lets say, 'enemy'
// make temp storage of struct
objSizeType tempMap;
// store found struct to use in code later
tempMap = objSizeMap.find(characterType::enemy)->second;
|