comparison rogue4/state.c @ 227:696277507a2e

Rogue V4, V5: disable a cheat granting permanent monster detection. In these two games, a potion of monster detection turns on the player's SEEMONST flag. A fuse is set to call turn_see() to turn the flag back off. But the save and restore functions do not recognize turn_see() and fail to set the fuse up again. When restoring, Rogue V4 merely sets the fuse's function to NULL and leaves it burning. When it goes off, a segfault results. Rogue V5 clears all the fuse's fields, and the player retains the ability to see all monsters on the level. The save and restore code can now handle the fuse. The function used is a new wrapper, turn_see_off(), which should lead to less problems with daemons being multiple incompatible types. Also, Rogue V4 and Super-Rogue now properly clear unrecognized daemon and fuse slots when restoring a saved game.
author John "Elwin" Edwards
date Sat, 05 Mar 2016 12:10:20 -0500
parents 1b73a8641b37
children c10fe421b8fb
comparison
equal deleted inserted replaced
226:b922f66acf4d 227:696277507a2e
965 func = 7; 965 func = 7;
966 else if (d_list[i].d_func == unsee) 966 else if (d_list[i].d_func == unsee)
967 func = 8; 967 func = 8;
968 else if (d_list[i].d_func == sight) 968 else if (d_list[i].d_func == sight)
969 func = 9; 969 func = 9;
970 else if (d_list[i].d_func == turn_see_off)
971 func = 10;
970 else 972 else
971 func = 0; 973 func = 0;
972 974
973 rs_write_int(savef, d_list[i].d_type); 975 rs_write_int(savef, d_list[i].d_type);
974 rs_write_int(savef, func); 976 rs_write_int(savef, func);
1035 break; 1037 break;
1036 case 8: d_list[i].d_func = unsee; 1038 case 8: d_list[i].d_func = unsee;
1037 break; 1039 break;
1038 case 9: d_list[i].d_func = sight; 1040 case 9: d_list[i].d_func = sight;
1039 break; 1041 break;
1042 case 10: d_list[i].d_func = turn_see_off;
1043 break;
1040 default:d_list[i].d_func = NULL; 1044 default:d_list[i].d_func = NULL;
1041 break; 1045 break;
1046 }
1047
1048 if (d_list[i].d_func == NULL)
1049 {
1050 d_list[i].d_type = 0;
1051 d_list[i].d_arg = 0;
1052 d_list[i].d_time = 0;
1042 } 1053 }
1043 } 1054 }
1044 } 1055 }
1045 } 1056 }
1046 } 1057 }