Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
etorth committed Apr 10, 2022
1 parent 9ecadcf commit a704d45
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion server/src/servermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,19 @@ ServerMap::ServerMapLuaModule::ServerMapLuaModule(ServerMap *mapPtr)
}
}

// failed to pick a random location
// try brutle force to get a location, shall always succeeds if given region has valid grid(s)

if(const auto locopt = mapPtr->getRCValidGrid(false, false, -1, regionX, regionY, regionW, regionH); locopt.has_value()){
return sol::as_returns(std::array<int, 2>
{
std::get<0>(locopt.value()),
std::get<1>(locopt.value()),
});
}

// give detailed failure message
// need it to validate map monster gen coroutine
// need it to validate map monster gen coroutine, otherwise this can throw

if(useFullMap){
throw fflerror("no valid grid on map: map = %s", to_cstr(DBCOM_MAPRECORD(mapPtr->ID()).name));
Expand Down

0 comments on commit a704d45

Please sign in to comment.