| 5368 | RESTORE_WARNING_UNREACHABLE_CODE |
| 5369 | |
| 5370 | staticfn void |
| 5371 | levregion_add(lev_region *lregion) |
| 5372 | { |
| 5373 | if (!lregion->in_islev) { |
| 5374 | get_location(&lregion->inarea.x1, &lregion->inarea.y1, ANY_LOC, |
| 5375 | (struct mkroom *) 0); |
| 5376 | get_location(&lregion->inarea.x2, &lregion->inarea.y2, ANY_LOC, |
| 5377 | (struct mkroom *) 0); |
| 5378 | } |
| 5379 | |
| 5380 | if (!lregion->del_islev) { |
| 5381 | get_location(&lregion->delarea.x1, &lregion->delarea.y1, |
| 5382 | ANY_LOC, (struct mkroom *) 0); |
| 5383 | get_location(&lregion->delarea.x2, &lregion->delarea.y2, |
| 5384 | ANY_LOC, (struct mkroom *) 0); |
| 5385 | } |
| 5386 | if (gn.num_lregions) { |
| 5387 | /* realloc the lregion space to add the new one */ |
| 5388 | lev_region *newl = (lev_region *) alloc( |
| 5389 | sizeof (lev_region) * (unsigned) (1 + gn.num_lregions)); |
| 5390 | |
| 5391 | (void) memcpy((genericptr_t) (newl), (genericptr_t) gl.lregions, |
| 5392 | sizeof (lev_region) * gn.num_lregions); |
| 5393 | Free(gl.lregions); |
| 5394 | gn.num_lregions++; |
| 5395 | gl.lregions = newl; |
| 5396 | } else { |
| 5397 | gn.num_lregions = 1; |
| 5398 | gl.lregions = (lev_region *) alloc(sizeof (lev_region)); |
| 5399 | } |
| 5400 | (void) memcpy(&gl.lregions[gn.num_lregions - 1], lregion, |
| 5401 | sizeof (lev_region)); |
| 5402 | } |
| 5403 | |
| 5404 | /* get params from topmost lua hash: |
| 5405 | - region = {x1,y1,x2,y2} |
no test coverage detected