normally repair is done when a shopkeeper moves, but we also try to catch up for lost time when reloading a previously visited level */
| 4847 | /* normally repair is done when a shopkeeper moves, but we also try to |
| 4848 | catch up for lost time when reloading a previously visited level */ |
| 4849 | void |
| 4850 | fix_shop_damage(void) |
| 4851 | { |
| 4852 | struct monst *shkp; |
| 4853 | struct damage *damg, *nextdamg; |
| 4854 | |
| 4855 | /* if this level has no shop damage, there's nothing to do */ |
| 4856 | if (!svl.level.damagelist) |
| 4857 | return; |
| 4858 | |
| 4859 | /* go through all shopkeepers on the level */ |
| 4860 | for (shkp = next_shkp(fmon, FALSE); shkp; |
| 4861 | shkp = next_shkp(shkp->nmon, FALSE)) { |
| 4862 | /* if this shopkeeper isn't in his shop or can't move, skip */ |
| 4863 | if (shk_impaired(shkp)) |
| 4864 | continue; |
| 4865 | /* go through all damage data trying to have this shopkeeper |
| 4866 | fix it; repair_damage() will only make repairs for damage |
| 4867 | matching shop controlled by specified shopkeeper */ |
| 4868 | for (damg = svl.level.damagelist; damg; damg = nextdamg) { |
| 4869 | nextdamg = damg->next; |
| 4870 | if (repair_damage(shkp, damg, TRUE)) |
| 4871 | discard_damage_struct(damg); |
| 4872 | } |
| 4873 | } |
| 4874 | } |
| 4875 | |
| 4876 | /* |
| 4877 | * shk_move: return 1: moved 0: didn't -1: let m_move do it -2: died |
no test coverage detected