@@ -59,7 +59,16 @@ void move_player(const int8_t direction)
5959 g_player -> direction == g_mission -> entrance_direction &&
6060 direction == g_mission -> entrance_direction )
6161 {
62- end_mission ();
62+ g_game_paused = true;
63+ show_window (g_main_menu_window );
64+ if (g_mission -> completed )
65+ {
66+ adjust_player_money (g_mission -> reward );
67+ }
68+ g_current_narration = MISSION_CONCLUSION_NARRATION ;
69+ show_narration ();
70+ persist_delete (MISSION_STORAGE_KEY );
71+ persist_write_data (PLAYER_STORAGE_KEY , g_player , sizeof (player_t ));
6372 }
6473 else if (occupiable (destination ))
6574 {
@@ -284,6 +293,8 @@ void adjust_player_current_hp(const int16_t amount)
284293 g_current_narration = DEATH_NARRATION ;
285294 show_narration ();
286295 deinit_mission ();
296+ persist_delete (MISSION_STORAGE_KEY );
297+ persist_write_data (PLAYER_STORAGE_KEY , g_player , sizeof (player_t ));
287298 }
288299}
289300
@@ -307,30 +318,6 @@ void adjust_player_current_ammo(const int16_t amount)
307318 }
308319}
309320
310- /******************************************************************************
311- Function: end_mission
312-
313- Description: Called when the player walks into the exit, ending the current
314- mission. Determines how much reward money to bestow, ensures no
315- mission data remains in persistent storage, etc.
316-
317- Inputs: None.
318-
319- Outputs: None.
320- ******************************************************************************/
321- void end_mission (void )
322- {
323- g_game_paused = true;
324- show_window (g_main_menu_window );
325- if (g_mission -> completed )
326- {
327- adjust_player_money (g_mission -> reward );
328- }
329- g_current_narration = MISSION_CONCLUSION_NARRATION ;
330- show_narration ();
331- persist_delete (MISSION_STORAGE_KEY );
332- }
333-
334321/******************************************************************************
335322 Function: add_new_npc
336323
0 commit comments