#include "wincontrol.h" /* get_win_by_id(), get_winconf_by_win() */
#include "rrand.h" /* for rrand(), rrand_seed() */
#include "rexit.h" /* for exit_game(), exit_err() */
-#include "command_db.h" /* for init_command_db() */
+#include "command_db.h" /* for init_command_db(), is_command_id_shortdsc() */
#include "control.h" /* for *_control(), get_available_keycode_to_action() */
{
break;
}
+ if (is_command_id_shortdsc(&world, action, "drop"))
+ {
+ world.inventory_select = getc(file);
+ }
record_control(action, &world);
}
}
action = getc(file);
if (EOF != action)
{
+ if (is_command_id_shortdsc(&world, action, "drop"))
+ {
+ world.inventory_select = getc(file);
+ }
record_control(action, &world);
}
}
struct MapObjDef * map_obj_defs; /* Map object type definitions chain. */
struct MapObj * map_objs; /* Pointer to map objects chain start. */
uint8_t inventory_select; /* Player's inventory selection index. */
-};
+ uint8_t old_inventory_select; /* Temporarily stores for recordfile */
+}; /* writing inventory selection index. */
if (NULL == player->owns)
{
update_log(world, "\nYou try to drop an object, but you own none.");
+ world->old_inventory_select = 0;
}
else
{
+ world->old_inventory_select = world->inventory_select;
struct MapObj * owned = player->owns;
uint8_t i = 0;
for (; i != world->inventory_select; i++, owned = owned->next);
* sorted_wintoggle_and_activate()
*/
#include "windows.h" /* for suspend_win() */
+#include "command_db.h" /* for is_command_id_shortdsc() */
+
extern char * trouble_msg(struct World * w, char * parent, char * child)
}
try_fclose(file_old, world, f_name);
exit_err(write_uint8(action, file_new), world, err_write);
+ if (is_command_id_shortdsc(world, action, "drop"))
+ {
+ uint8_t inventory_select = world->old_inventory_select;
+ exit_err(write_uint8(inventory_select, file_new), world, err_write);
+ }
try_fclose_unlink_rename(file_new, recordfile_tmp, recordfile,
world, f_name);
}