diff --git a/TShockAPI/DB/RememberPosManager.cs b/TShockAPI/DB/RememberPosManager.cs index 429437ea..d7485511 100644 --- a/TShockAPI/DB/RememberPosManager.cs +++ b/TShockAPI/DB/RememberPosManager.cs @@ -52,7 +52,14 @@ namespace TShockAPI.DB { if (reader.Read()) { - return new Vector2(reader.Get("X"), reader.Get("Y")); + int checkX=reader.Get("X"); + int checkY=reader.Get("Y"); + //fix leftover inconsistancies + if (checkX==0) + checkX++; + if (checkY==0) + checkY++; + return new Vector2(checkX, checkY); } } } @@ -92,6 +99,7 @@ namespace TShockAPI.DB { try { + if ((X != 0) && ( Y !=0)) //invalid pos! database.Query("INSERT INTO RememberedPos (Name, IP, X, Y, WorldID) VALUES (@0, @1, @2, @3, @4);", name, IP, X, Y , Main.worldID.ToString()); } catch (Exception ex) @@ -103,6 +111,7 @@ namespace TShockAPI.DB { try { + if ((X != 0) && ( Y !=0)) //invalid pos! database.Query("UPDATE RememberedPos SET X = @0, Y = @1, IP = @2 WHERE Name = @3 AND WorldID = @4;", X, Y, IP, name, Main.worldID.ToString()); } catch (Exception ex) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index bb595a5c..b9e9e251 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -472,11 +472,19 @@ namespace TShockAPI { num4 = Main.maxTilesY; } + for (int c = num; c < num2; c++) + { + for (int d = num3; d< num4; d++) + { + if (Main.tile[c,d].liquid != 0) + return false; + } + } for (int i = num; i < num2; i++) { for (int j = num3; j < num4; j++) { - if (Main.tile[i, j] != null && Main.tile[i, j].active && Main.tileSolid[(int)Main.tile[i, j].type] && !Main.tileSolidTop[(int)Main.tile[i, j].type] &&(((int)Main.tile[i,j].type !=53) && ((int)Main.tile[i,j].type !=112) && ((int)Main.tile[i,j].type !=116) && ((int)Main.tile[i,j].type !=123)) && ((Main.tile[i,j].liquid == 0 )&& !Main.tile[i,j].lava)) + if (Main.tile[i, j] != null && Main.tile[i, j].active && Main.tileSolid[(int)Main.tile[i, j].type] && !Main.tileSolidTop[(int)Main.tile[i, j].type] &&(((int)Main.tile[i,j].type !=53) && ((int)Main.tile[i,j].type !=112) && ((int)Main.tile[i,j].type !=116) && ((int)Main.tile[i,j].type !=123)) && !Main.tile[i,j].lava) { Vector2 vector; vector.X = (float)(i * 16);