save traps; gf.ftrap is the only trap chain so 2nd arg is superfluous */
| 917 | |
| 918 | /* save traps; gf.ftrap is the only trap chain so 2nd arg is superfluous */ |
| 919 | staticfn void |
| 920 | savetrapchn(NHFILE *nhfp, struct trap *trap) |
| 921 | { |
| 922 | static struct trap zerotrap; |
| 923 | struct trap *trap2; |
| 924 | |
| 925 | while (trap) { |
| 926 | boolean use_relative = (program_state.restoring != REST_GSTATE |
| 927 | && trap->dst.dnum == u.uz.dnum); |
| 928 | trap2 = trap->ntrap; |
| 929 | if (use_relative) |
| 930 | trap->dst.dlevel -= u.uz.dlevel; /* make it relative */ |
| 931 | if (update_file(nhfp)) { |
| 932 | Sfo_trap(nhfp, trap, "trap"); |
| 933 | } |
| 934 | if (use_relative) |
| 935 | trap->dst.dlevel += u.uz.dlevel; /* reset back to absolute */ |
| 936 | if (release_data(nhfp)) |
| 937 | dealloc_trap(trap); |
| 938 | trap = trap2; |
| 939 | } |
| 940 | if (update_file(nhfp)) { |
| 941 | Sfo_trap(nhfp, &zerotrap, "trap"); |
| 942 | } |
| 943 | } |
| 944 | |
| 945 | /* save all the fruit names and ID's; this is used only in saving whole games |
| 946 | * (not levels) and in saving bones levels. When saving a bones level, |
no test coverage detected