diff options
author | Debucquoy Anthony tonitch <debucquoy.anthony@gmail.com> | 2022-06-18 02:09:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-18 02:09:58 +0200 |
commit | f089103c2b121f8128abfd6cdf0bd3cfbeca4465 (patch) | |
tree | 89c90001954484d22084cc68e29940cfe19e0e21 /src/Bindings/ManualBindings_BlockArea.cpp | |
parent | Remove redundant initialisations (diff) | |
download | cuberite-f089103c2b121f8128abfd6cdf0bd3cfbeca4465.tar cuberite-f089103c2b121f8128abfd6cdf0bd3cfbeca4465.tar.gz cuberite-f089103c2b121f8128abfd6cdf0bd3cfbeca4465.tar.bz2 cuberite-f089103c2b121f8128abfd6cdf0bd3cfbeca4465.tar.lz cuberite-f089103c2b121f8128abfd6cdf0bd3cfbeca4465.tar.xz cuberite-f089103c2b121f8128abfd6cdf0bd3cfbeca4465.tar.zst cuberite-f089103c2b121f8128abfd6cdf0bd3cfbeca4465.zip |
Diffstat (limited to 'src/Bindings/ManualBindings_BlockArea.cpp')
-rw-r--r-- | src/Bindings/ManualBindings_BlockArea.cpp | 37 |
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; |