From: Christian Heller Date: Tue, 10 Mar 2015 03:18:50 +0000 (+0100) Subject: 7DRL: Add GOD_MOOD, GOD_FAVOR properties with no use so far. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/cards/%7B%7Bcard_id%7D%7D/task?a=commitdiff_plain;h=c6e0d389a3331ac499e96cbcad426c68c0c83ddc;p=plomrogue 7DRL: Add GOD_MOOD, GOD_FAVOR properties with no use so far. --- diff --git a/confclient/interface_conf b/confclient/interface_conf index 0055141..d183365 100644 --- a/confclient/interface_conf +++ b/confclient/interface_conf @@ -83,7 +83,7 @@ WINDOW i NAME 'Info' BREAK 2 WIDTH -38 -HEIGHT 1 +HEIGHT 2 WINDOW l NAME 'Log' @@ -95,7 +95,7 @@ WINDOW m NAME 'Map' BREAK 0 WIDTH -38 -HEIGHT -2 +HEIGHT -3 KEY 97 ai KEY 112 pick KEY 58 wait diff --git a/roguelike-server b/roguelike-server index 8cd8162..ea5b40a 100755 --- a/roguelike-server +++ b/roguelike-server @@ -324,7 +324,10 @@ def try_worldstate_update(): type_id = world_db["Things"][id]["T_TYPE"] name = world_db["ThingTypes"][type_id]["TT_NAME"] inventory = inventory + name + "\n" - string = str(world_db["TURN"]) + "\n" + \ + ## 7DRL additions: GOD_MOOD, GOD_FAVOR + string = str(world_db["GOD_MOOD"]) + "\n" + \ + str(world_db["GOD_FAVOR"]) + "\n" + \ + str(world_db["TURN"]) + "\n" + \ str(world_db["Things"][0]["T_LIFEPOINTS"]) + "\n" + \ str(world_db["Things"][0]["T_SATIATION"]) + "\n" + \ inventory + "%\n" + \ @@ -926,6 +929,9 @@ def get_dir_to_target(t, filter): dir_to_target = 0 return dir_to_target + def FOO(): + libpr.dijkstra_map() + dir_to_target = False mem_depth_c = b' ' run_i = 9 + 1 if "s" == filter else 1 @@ -934,7 +940,7 @@ def get_dir_to_target(t, filter): init_score_map() mem_depth_c = b'9' if b' ' == mem_depth_c \ else bytes([mem_depth_c[0] - 1]) - if libpr.dijkstra_map(): + if FOO(): # libpr.dijkstra_map(): raise RuntimeError("No score map allocated for dijkstra_map().") dir_to_target = get_dir_from_neighbors() libpr.free_score_map() @@ -1536,6 +1542,8 @@ commands_db = { "SEED_MAP": (1, False, command_seedmap), "SEED_RANDOMNESS": (1, False, command_seedrandomness), "TURN": (1, False, setter(None, "TURN", 0, 65535)), + "GOD_MOOD": (1, False, setter(None, "GOD_MOOD", -32768, 32767)), ## + "GOD_FAVOR": (1, False, setter(None, "GOD_FAVOR", -32768, 32767)), ## "PLAYER_TYPE": (1, False, setter(None, "PLAYER_TYPE", 0)), "MAP_LENGTH": (1, False, command_maplength), "WORLD_ACTIVE": (1, False, command_worldactive), @@ -1582,6 +1590,8 @@ world_db = { "SEED_MAP": 0, "PLAYER_TYPE": 0, "WORLD_ACTIVE": 0, + "GOD_MOOD": 0, ## + "GOD_FAVOR": 0, ## "ThingActions": {}, "ThingTypes": {}, "Things": {} diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c index 9857af5..ad4cc38 100644 --- a/src/client/draw_wins.c +++ b/src/client/draw_wins.c @@ -427,12 +427,16 @@ extern void draw_win_info(struct Win * win) char * dsc_turn = "Turn: "; char * dsc_hitpoints = "\nHitpoints: "; char * dsc_satiation = "\nSatiation: "; - uint16_t maxl = strlen(dsc_turn) + 5 + strlen(dsc_hitpoints) - + strlen(dsc_satiation) + 6 + 3; + char * dsc_godsmood = "\nGod's mood: "; // 7DRL + char * dsc_godsfavor = "\nGod's favor: "; // 7DRL + uint16_t maxl = strlen(dsc_turn) + 5 + strlen(dsc_hitpoints) + 3 // + + strlen(dsc_satiation) + 6 + strlen(dsc_godsmood) + 6 // + + strlen(dsc_godsfavor) + 6; // char * text = try_malloc(maxl + 1, __func__); - int test = sprintf(text, "%s%d%s%d%s%d", dsc_turn, world.turn, dsc_hitpoints, - world.player_lifepoints, dsc_satiation, - world.player_satiation); + int test = sprintf(text, "%s%d%s%d%s%d%s%d%s%d", dsc_turn, world.turn, + dsc_hitpoints, world.player_lifepoints, dsc_satiation, + world.player_satiation, dsc_godsmood, world.godsmood, // + dsc_godsfavor, world.godsfavor); // exit_trouble(test < 0, __func__, "sprintf"); add_text_with_linebreaks(win, text); free(text); diff --git a/src/client/io.c b/src/client/io.c index 54b65c2..247a681 100644 --- a/src/client/io.c +++ b/src/client/io.c @@ -184,6 +184,8 @@ static uint8_t read_worldstate() } uint32_t linemax = textfile_width(file); char * read_buf = try_malloc(linemax + 1, __func__); + world.godsmood = (int16_t) read_value_from_line(read_buf, linemax, file); // + world.godsfavor = (int16_t) read_value_from_line(read_buf, linemax, file); // world.turn = (uint16_t) read_value_from_line(read_buf, linemax, file); world.player_lifepoints = (uint16_t) read_value_from_line(read_buf, linemax, file); diff --git a/src/client/world.h b/src/client/world.h index 5681210..99ad75a 100644 --- a/src/client/world.h +++ b/src/client/world.h @@ -43,6 +43,8 @@ struct World struct yx_uint8 look_pos; /* coordinates of look cursor */ uint16_t turn; /* world/game turn */ int16_t player_satiation; /* player's belly fullness */ + int16_t godsmood; /* island god's mood */ // 7DRL + int16_t godsfavor; /* island god's favor to player */ // 7DRL uint8_t player_inventory_select; /* index of selected item in inventory */ uint8_t player_lifepoints; /* how alive the player is */ uint8_t winch; /* if set, SIGWINCH was registered; trigger reset_windows()*/