#ifndef ITEMS_H #define ITEMS_H #include #define DAGGER_OF_DARKNESS *game_at(&g, (struct point){8,3}) = (struct object)\ {\ .type = ITEM,\ .symbol = 'T',\ .u.i = {"Dagger of Darkness", EQUIP, {{0, 2, 0}}}\ }; #define HP_POTION (struct object)\ {\ .type = ITEM,\ .symbol = 'p',\ .u.i = {"HP Potion", USE, {{5, 0, 0}}}\ }; static inline void spawn_item(struct game *g) { while(true) { struct point p = {randrange(0, g->ys), randrange(0, g->xs)}; if(in_bounds(g, p) && game_at(g, p)->type == NOOBJ) { *game_at(g, p) = HP_POTION; break; } } } #endif //ITEMS_H