| 4396 | } |
| 4397 | |
| 4398 | void |
| 4399 | add_damage( |
| 4400 | coordxy x, |
| 4401 | coordxy y, |
| 4402 | long cost) |
| 4403 | { |
| 4404 | struct damage *tmp_dam; |
| 4405 | char *shops; |
| 4406 | |
| 4407 | if (IS_DOOR(levl[x][y].typ)) { |
| 4408 | struct monst *mtmp; |
| 4409 | |
| 4410 | /* Don't schedule for repair unless it's a real shop entrance */ |
| 4411 | for (shops = in_rooms(x, y, SHOPBASE); *shops; shops++) |
| 4412 | if ((mtmp = shop_keeper(*shops)) != 0 |
| 4413 | && x == ESHK(mtmp)->shd.x && y == ESHK(mtmp)->shd.y) |
| 4414 | break; |
| 4415 | if (!*shops) |
| 4416 | return; |
| 4417 | } |
| 4418 | for (tmp_dam = svl.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) |
| 4419 | if (tmp_dam->place.x == x && tmp_dam->place.y == y) { |
| 4420 | tmp_dam->cost += cost; |
| 4421 | tmp_dam->when = svm.moves; /* needed by pay_for_damage() */ |
| 4422 | return; |
| 4423 | } |
| 4424 | tmp_dam = (struct damage *) alloc((unsigned) sizeof *tmp_dam); |
| 4425 | (void) memset((genericptr_t) tmp_dam, 0, sizeof *tmp_dam); |
| 4426 | tmp_dam->when = svm.moves; |
| 4427 | tmp_dam->place.x = x; |
| 4428 | tmp_dam->place.y = y; |
| 4429 | tmp_dam->cost = cost; |
| 4430 | tmp_dam->typ = levl[x][y].typ; |
| 4431 | tmp_dam->flags = levl[x][y].flags; |
| 4432 | tmp_dam->next = svl.level.damagelist; |
| 4433 | svl.level.damagelist = tmp_dam; |
| 4434 | /* If player saw damage, display walls post-repair as walls, not stone */ |
| 4435 | if (cansee(x, y)) |
| 4436 | levl[x][y].seenv = SVALL; |
| 4437 | } |
| 4438 | |
| 4439 | /* is shopkeeper impaired, so they cannot act? */ |
| 4440 | staticfn boolean |
no test coverage detected