X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fmain.c;h=f2409758bf13183103d73686575b5868a77729d6;hb=951248dddace9f7cadcf30700a3c3e6ad7ae2888;hp=dff5d208414e02ea3749a85b96980de8dccfe37e;hpb=4ca4f2fc97bd592bcbbef5ed2b21b320c7336425;p=plomrogue diff --git a/src/main.c b/src/main.c index dff5d20..f240975 100644 --- a/src/main.c +++ b/src/main.c @@ -5,8 +5,8 @@ #include /* for FILE typedef, F_OK, rename() */ #include /* for initscr(), noecho(), curs_set(), keypad(), raw() */ #include /* for time() */ -#include /* for unlink(), getopt(), optarg */ -#include /* for uint8_t */ +#include /* for getopt(), optarg */ +#include /* for uint16_t, uint32_t */ #include /* for errno */ #include "windows.h" /* for structs WinMeta, Win, init_win(), init_win_meta(), * draw_all_wins() @@ -14,27 +14,30 @@ #include "draw_wins.h" /* for draw_keys_win(), draw_map_win(), draw_info_win(), * draw_log_win() */ -#include "keybindings.h" /* for initkeybindings(), get_action_key() */ +#include "keybindings.h" /* for init_keybindings(), get_action_key() */ #include "readwrite.h" /* for [read/write]_uint[8/16/32][_bigendian]() */ #include "map_objects.h" /* for structs Monster, Item, Player, * init_map_object_defs(), read_map_objects(), * build_map_objects() */ -#include "map_object_actions.h" /* for player_wait(), move_player() */ #include "map.h" /* for struct Map, init_map() */ #include "misc.h" /* for update_log(), toggle_window(), find_passable_pos(), * save_game() */ -#include "yx_uint16.h" /* for dir enum */ #include "rrand.h" /* for rrand(), rrand_seed() */ #include "rexit.h" /* for exit_game() */ #include "control.h" /* for meta_control() */ +#include "command_db.h" /* for init_command_db() */ + int main(int argc, char *argv[]) { struct World world; + init_command_db(&world); + set_cleanup_flag(CLEANUP_COMMAND_DB); + /* Check for corrupted savefile / recordfile savings. */ char * recordfile = "record"; char * savefile = "savefile"; @@ -100,7 +103,7 @@ int main(int argc, char *argv[]) world.player = &player; world.monster = 0; world.item = 0; - init_map_object_defs(&world, "defs"); + init_map_object_defs(&world, "config/defs"); /* For interactive mode, try to load world state from savefile. */ char * err_o = "Trouble loading game (fopen() in main()) / " @@ -245,7 +248,7 @@ int main(int argc, char *argv[]) draw_all_wins(&win_meta); key = getch(); if ( EOF != action - && key == get_action_key(world.keybindings, "wait / next turn")) + && key == get_action_key(world.keybindings, "wait")) { action = getc(file); if (EOF != action)