@aleteoryx@labyrinth.zone
typedef enum {
NOTHING,
BULLET,
GUN,
FOOT
} location_contents;
typedef struct {
location_contents contents;
} location;
typedef struct {
location* target;
} gun;
typedef struct {
location* position;
} foot;
void gun_point_at_foot(gun* g, foot* f) {
g->target = f->position;
}
void gun_shoot(gun* g) {
g->target->contents = BULLET;
}
int main() {
gun my_gun;
foot my_foot;
gun_point_at_foot(&my_gun, &my_foot);
gun_shoot(&my_gun);
}