… | |
… | |
260 | * to check for objects to make sure there are no common errors. |
260 | * to check for objects to make sure there are no common errors. |
261 | */ |
261 | */ |
262 | void |
262 | void |
263 | object::post_load_check () |
263 | object::post_load_check () |
264 | { |
264 | { |
|
|
265 | if (type >= NUM_TYPES) |
|
|
266 | { |
|
|
267 | LOG (llevError, "%s: type out of range, resetting to 0.\n", debug_desc ()); |
|
|
268 | type = 0; |
|
|
269 | } |
|
|
270 | |
265 | switch (type) |
271 | switch (type) |
266 | { |
272 | { |
267 | case BOW: |
273 | case BOW: |
268 | case WAND: |
274 | case WAND: |
269 | case ROD: |
275 | case ROD: |
270 | case HORN: |
276 | case HORN: |
271 | case SKILL_TOOL: |
|
|
272 | if (slot [body_range].info != -1) |
277 | if (slot [body_range].info != -1) |
273 | { |
278 | { |
274 | LOG (llevError, "%s: body_range %d != -1\n", debug_desc (), slot [body_range].info); |
279 | LOG (llevError, "%s: body_range %d != -1\n", debug_desc (), slot [body_range].info); |
275 | slot [body_range].info = -1; |
280 | slot [body_range].info = -1; |
276 | } |
281 | } |
… | |
… | |
379 | * something that has item_power 1 is probably just fine if our calculated |
384 | * something that has item_power 1 is probably just fine if our calculated |
380 | * value is 1 or 2 - these values are small enough that hard to be precise. |
385 | * value is 1 or 2 - these values are small enough that hard to be precise. |
381 | * similarly, it item_power is 0, the first check will always pass, |
386 | * similarly, it item_power is 0, the first check will always pass, |
382 | * but not the second one. |
387 | * but not the second one. |
383 | */ |
388 | */ |
|
|
389 | #if 0 //TODO |
384 | if (ip > 2 * item_power && ip > (item_power + 3)) |
390 | if (ip > 2 * item_power && ip > (item_power + 3)) |
385 | LOG (llevDebug, "Object %s seems to have too low item power? %d > %d\n", debug_desc (), ip, item_power); |
391 | LOG (llevDebug, "Object %s seems to have too low item power? %d > %d\n", debug_desc (), ip, item_power); |
|
|
392 | #endif |
386 | } |
393 | } |
387 | |
394 | |
388 | /* Old spellcasting object - need to load in the appropiate object */ |
395 | /* Old spellcasting object - need to load in the appropiate object */ |
389 | if ((type == ROD || type == WAND || type == SCROLL || type == HORN || type == FIREWALL || |
396 | if ((type == ROD || type == WAND || type == SCROLL || type == HORN || type == FIREWALL || |
390 | /* POTIONS and ALTARS don't always cast spells, but if they do, update them */ |
397 | /* POTIONS and ALTARS don't always cast spells, but if they do, update them */ |
… | |
… | |
767 | GET_FLAG (this, FLAG_IDENTIFIED); |
774 | GET_FLAG (this, FLAG_IDENTIFIED); |
768 | //TODO: move to check_object or so |
775 | //TODO: move to check_object or so |
769 | if (QUERY_FLAG (this, FLAG_IDENTIFIED)) |
776 | if (QUERY_FLAG (this, FLAG_IDENTIFIED)) |
770 | CLEAR_FLAG (this, FLAG_KNOWN_MAGICAL); |
777 | CLEAR_FLAG (this, FLAG_KNOWN_MAGICAL); |
771 | |
778 | |
772 | break; |
|
|
773 | |
|
|
774 | case KW_wiz: |
|
|
775 | GET_FLAG (this, FLAG_WIZ); |
|
|
776 | //TODO: move to check_object |
|
|
777 | if (QUERY_FLAG (this, FLAG_WIZ)) |
|
|
778 | { |
|
|
779 | SET_FLAG (this, FLAG_WAS_WIZ); |
|
|
780 | SET_FLAG (this, FLAG_WIZPASS); |
|
|
781 | SET_FLAG (this, FLAG_WIZCAST); |
|
|
782 | } |
|
|
783 | else |
|
|
784 | { |
|
|
785 | CLEAR_FLAG (this, FLAG_WIZPASS); |
|
|
786 | CLEAR_FLAG (this, FLAG_WIZCAST); |
|
|
787 | } |
|
|
788 | break; |
779 | break; |
789 | |
780 | |
790 | case KW_friendly: |
781 | case KW_friendly: |
791 | if (f.get_sint32 ()) |
782 | if (f.get_sint32 ()) |
792 | if (type != PLAYER) |
783 | if (type != PLAYER) |
… | |
… | |
825 | case KW_reflect_missile: GET_FLAG (this, FLAG_REFL_MISSILE); break; |
816 | case KW_reflect_missile: GET_FLAG (this, FLAG_REFL_MISSILE); break; |
826 | case KW_reflect_spell: GET_FLAG (this, FLAG_REFL_SPELL); break; |
817 | case KW_reflect_spell: GET_FLAG (this, FLAG_REFL_SPELL); break; |
827 | case KW_no_magic: GET_FLAG (this, FLAG_NO_MAGIC); break; |
818 | case KW_no_magic: GET_FLAG (this, FLAG_NO_MAGIC); break; |
828 | case KW_no_drop: GET_FLAG (this, FLAG_NO_DROP); break; |
819 | case KW_no_drop: GET_FLAG (this, FLAG_NO_DROP); break; |
829 | case KW_random_movement: GET_FLAG (this, FLAG_RANDOM_MOVE); break; |
820 | case KW_random_movement: GET_FLAG (this, FLAG_RANDOM_MOVE); break; |
830 | case KW_was_wiz: GET_FLAG (this, FLAG_WAS_WIZ); break; |
|
|
831 | case KW_no_fix_player: GET_FLAG (this, FLAG_NO_FIX_PLAYER); break; |
821 | case KW_no_fix_player: GET_FLAG (this, FLAG_NO_FIX_PLAYER); break; |
832 | case KW_is_lightable: GET_FLAG (this, FLAG_IS_LIGHTABLE); break; |
822 | case KW_is_lightable: GET_FLAG (this, FLAG_IS_LIGHTABLE); break; |
833 | case KW_tear_down: GET_FLAG (this, FLAG_TEAR_DOWN); break; |
823 | case KW_tear_down: GET_FLAG (this, FLAG_TEAR_DOWN); break; |
834 | case KW_can_use_shield: GET_FLAG (this, FLAG_USE_SHIELD); break; |
824 | case KW_can_use_shield: GET_FLAG (this, FLAG_USE_SHIELD); break; |
835 | case KW_can_cast_spell: GET_FLAG (this, FLAG_CAST_SPELL); break; |
825 | case KW_can_cast_spell: GET_FLAG (this, FLAG_CAST_SPELL); break; |
… | |
… | |
1135 | * the 15'th element of this array should match that name. |
1125 | * the 15'th element of this array should match that name. |
1136 | * If an entry is NULL, that is a flag not to loaded/saved. |
1126 | * If an entry is NULL, that is a flag not to loaded/saved. |
1137 | */ |
1127 | */ |
1138 | static const keyword flag_names [NUM_FLAGS] = { |
1128 | static const keyword flag_names [NUM_FLAGS] = { |
1139 | KW_alive, |
1129 | KW_alive, |
1140 | KW_wiz, |
|
|
1141 | KW_NULL, |
1130 | KW_NULL, |
1142 | KW_NULL, |
1131 | KW_NULL, |
1143 | KW_was_wiz, |
1132 | KW_NULL, |
|
|
1133 | KW_NULL, |
1144 | KW_applied, |
1134 | KW_applied, |
1145 | KW_unpaid, |
1135 | KW_unpaid, |
1146 | KW_can_use_shield, |
1136 | KW_can_use_shield, |
1147 | KW_no_pick, |
1137 | KW_no_pick, |
1148 | KW_NULL, // walk_on |
1138 | KW_NULL, // walk_on |