I'd maintain two mappings.
Item->Allocation Slot
Allocation Slot->ItemID
Items have status usually, slots don't have status. You could give allocation slots damage in order to prevent multiple hits to the same spot, but I don't think that is worth it.
So, your mech becomes a collection of of "items" (including gyroscopes, weapons, cockpit, engine, etc), and a collection of allocation spots, each knowing about the other.
On a hit to an allocation spot, you look up which item is damaged, then you apply the damage to the item.
Quote:
I've been thinking about using an array for it, but that array would also be kinda hefty
|
Numbers less than 1 million are not hefty. =)
A traditional way to deal with a hex board is to treat it as a grid with a skew on it.
Imagine taking grid paper, and shifting each row by half a "grid size" in turn. Notice that each cell is now in contact with 6 other cells... And, it isn't that hard to know which grid cells are adjacent to each other.
Maintain an array of "struct"s for a zone map:
typedef hex_element zone_map[max_zone_size][max_zone_size];
struct hex_element {
terrain_type basic_type;
bool on_fire;
bool smokey;
bool full_of_chickens;
};
If your terrain is sparse, you can do this a bit better, but at the battle-mech scale of maps, this is good enough.