#include "keybindings.h"
#include "readwrite.h"
#include "map_objects.h"
+#include "map_object_actions.h"
#include "map.h"
#include "misc.h"
default:
exit(EXIT_FAILURE); } }
- // Initialize log, player, monsters and items.
+ // Initialize log, player, monster/item definitions and monsters/items.
world.log = calloc(1, sizeof(char));
update_log (&world, " ");
struct Player player;
world.player = &player;
world.monster = 0;
world.item = 0;
+ init_map_object_defs(&world, "defs");
// For interactive mode, try to load world state from savefile.
FILE * file;
world.map = ↦
if (1 == world.turn) {
player.pos = find_passable_pos(&map);
- unsigned char n_monsters = rrand(0, 0) % 16;
- unsigned char n_items = rrand(0, 0) % 48;
- build_map_objects (&world.monster, n_monsters, sizeof(struct Monster), build_map_objects_monsterdata, &map);
- build_map_objects (&world.item, n_items, sizeof(struct Item), build_map_objects_itemdata, &map); }
+ void * foo = build_map_objects (&world, &world.monster, 0, 1 + rrand(0,0) % 27, sizeof(struct Monster),
+ build_map_objects_monsterdata);
+ foo = build_map_objects (&world, foo, 1, 1 + rrand(0,0) % 9, sizeof(struct Monster),
+ build_map_objects_monsterdata);
+ build_map_objects (&world, foo, 2, 1 + rrand(0,0) % 3, sizeof(struct Monster),
+ build_map_objects_monsterdata);
+ foo = build_map_objects (&world, &world.item, 3, 1 + rrand(0,0) % 3, sizeof(struct Item),
+ build_map_objects_itemdata);
+ build_map_objects (&world, foo, 4, 1 + rrand(0,0) % 3, sizeof(struct Item), build_map_objects_itemdata); }
// Initialize window system and windows.
WINDOW * screen = initscr();