Fix: when a themeroom failed, xstart/ystart weren't reset

Revealed this bug when testing the previous commit:

Themed room generation with a randomly placed map involves picking a
single random point on the map at which to plop it down, and then
declaring the themed room failed and exiting if it would go beyond the
map bounds or overlaps with an existing room. In the process,
xstart/ystart/xsize/ysize have been modified, but weren't getting reset.
(They would get reset if the map successfully got placed and it had a
contents function, as of commit 4af086b, but there wasn't handling for
the failure to place it.)
This commit is contained in:
copperwater
2023-05-21 21:02:10 -04:00
committed by PatR
parent 2ae5ce8ab3
commit 0e01828ed8

View File

@@ -6829,7 +6829,12 @@ TODO: gc.coder->croom needs to be updated
skipmap:
mapfrag_free(&mf);
if (has_contents && !(gi.in_mk_themerooms && gt.themeroom_failed)) {
if (gi.in_mk_themerooms && gt.themeroom_failed) {
/* this mutated xstart and ystart in the process of trying to make a
* themed room, so undo them */
reset_xystart_size();
}
else if (has_contents) {
l_push_wid_hei_table(L, gx.xsize, gy.ysize);
if (nhl_pcall(L, 1, 0)){
impossible("Lua error: %s", lua_tostring(L, -1));