summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Bindings/ManualBindings_BlockArea.cpp37
1 files changed, 5 insertions, 32 deletions
diff --git a/src/Bindings/ManualBindings_BlockArea.cpp b/src/Bindings/ManualBindings_BlockArea.cpp
index a53a7bebf..c363e082f 100644
--- a/src/Bindings/ManualBindings_BlockArea.cpp
+++ b/src/Bindings/ManualBindings_BlockArea.cpp
@@ -590,41 +590,14 @@ static int tolua_cBlockArea_Read(lua_State * a_LuaState)
return L.ApiParamError("Invalid baDataTypes combination (%d)", dataTypes);
}
- // Check the coords, shift if needed:
- bounds.Sort();
- if (bounds.p1.y < 0)
+ // Check the coords:
+ if (!cChunkDef::IsValidHeight(bounds.p1) || !cChunkDef::IsValidHeight(bounds.p2))
{
- FLOGWARNING("cBlockArea:Read(): MinBlockY less than zero, adjusting to zero. Coords: {0} - {1}",
- bounds.p1, bounds.p2
- );
- L.LogStackTrace();
- bounds.p1.y = 0;
- }
- else if (bounds.p1.y >= cChunkDef::Height)
- {
- FLOGWARNING("cBlockArea:Read(): MinBlockY more than chunk height, adjusting to chunk height. Coords: {0} - {1}",
- bounds.p1, bounds.p2
- );
- L.LogStackTrace();
- bounds.p1.y = cChunkDef::Height - 1;
- }
- if (bounds.p2.y < 0)
- {
- FLOGWARNING("cBlockArea:Read(): MaxBlockY less than zero, adjusting to zero. Coords: {0} - {1}",
- bounds.p1, bounds.p2
- );
- L.LogStackTrace();
- bounds.p2.y = 0;
- }
- else if (bounds.p2.y > cChunkDef::Height)
- {
- FLOGWARNING("cBlockArea:Read(): MaxBlockY more than chunk height, adjusting to chunk height. Coords: {0} - {1}",
- bounds.p1, bounds.p2
- );
- L.LogStackTrace();
- bounds.p2.y = cChunkDef::Height;
+ return L.FApiParamError("Coordinates {0} - {1} exceed world bounds", bounds.p1, bounds.p2);
}
+ bounds.Sort();
+
// Do the actual read:
L.Push(self->Read(*world, bounds, dataTypes));
return 1;