get params from topmost lua hash: - region = {x1,y1,x2,y2} - exclude = {x1,y1,x2,y2} (optional) - region_islev=true, exclude_islev=true (optional) - negative x and y are invalid */
| 5407 | - region_islev=true, exclude_islev=true (optional) |
| 5408 | - negative x and y are invalid */ |
| 5409 | staticfn void |
| 5410 | l_get_lregion(lua_State *L, lev_region *tmplregion) |
| 5411 | { |
| 5412 | lua_Integer x1,y1,x2,y2; |
| 5413 | |
| 5414 | get_table_region(L, "region", &x1, &y1, &x2, &y2, FALSE); |
| 5415 | tmplregion->inarea.x1 = x1; |
| 5416 | tmplregion->inarea.y1 = y1; |
| 5417 | tmplregion->inarea.x2 = x2; |
| 5418 | tmplregion->inarea.y2 = y2; |
| 5419 | |
| 5420 | x1 = y1 = x2 = y2 = -1; |
| 5421 | get_table_region(L, "exclude", &x1, &y1, &x2, &y2, TRUE); |
| 5422 | tmplregion->delarea.x1 = x1; |
| 5423 | tmplregion->delarea.y1 = y1; |
| 5424 | tmplregion->delarea.x2 = x2; |
| 5425 | tmplregion->delarea.y2 = y2; |
| 5426 | |
| 5427 | tmplregion->in_islev = get_table_boolean_opt(L, "region_islev", 0); |
| 5428 | tmplregion->del_islev = get_table_boolean_opt(L, "exclude_islev", 0); |
| 5429 | |
| 5430 | /* if x1 is still negative, exclude wasn't specified, so we should treat |
| 5431 | * it as if there is no exclude region at all. Force exclude_islev to |
| 5432 | * true so the -1,-1,-1,-1 region is safely off the map and won't |
| 5433 | * interfere with branch or portal placement. */ |
| 5434 | if (x1 < 0) |
| 5435 | tmplregion->del_islev = TRUE; |
| 5436 | } |
| 5437 | |
| 5438 | /* teleport_region({ region = { x1,y1, x2,y2 } }); */ |
| 5439 | /* teleport_region({ region = { x1,y1, x2,y2 }, [ region_islev = 1, ] |
no test coverage detected