aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs49
1 files changed, 41 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d5d8629..3c9f91b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1012,6 +1012,7 @@ namespace OpenSim.Region.Environment.Scenes
1012 //Vector3 AXdirection = new Vector3(); 1012 //Vector3 AXdirection = new Vector3();
1013 //Ray testRay = new Ray(); 1013 //Ray testRay = new Ray();
1014 //EntityIntersection rt = new EntityIntersection(); 1014 //EntityIntersection rt = new EntityIntersection();
1015 bool terraincorruptedwarningsaid = false;
1015 1016
1016 float low = 255; 1017 float low = 255;
1017 float high = 0; 1018 float high = 0;
@@ -1063,11 +1064,25 @@ namespace OpenSim.Region.Environment.Scenes
1063 if (heightvalue < 0) 1064 if (heightvalue < 0)
1064 heightvalue = 0; 1065 heightvalue = 0;
1065 1066
1067 if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
1068 heightvalue = 0;
1069 try
1070 {
1071 Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue);
1066 1072
1067 Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue); 1073 // Y flip the cordinates
1068 1074 mapbmp.SetPixel(x, (256 - y) - 1, green);
1069 // Y flip the cordinates 1075 }
1070 mapbmp.SetPixel(x, (256 - y) - 1, green); 1076 catch (System.ArgumentException)
1077 {
1078 if (!terraincorruptedwarningsaid)
1079 {
1080 m_log.WarnFormat("[MAPIMAGE]: Your terrain is corrupted in region {0}, it might take a few minutes to generate the map image depending on the corruption level",RegionInfo.RegionName);
1081 terraincorruptedwarningsaid = true;
1082 }
1083 Color black = Color.Black;
1084 mapbmp.SetPixel(x, (256 - y) - 1, black);
1085 }
1071 } 1086 }
1072 else 1087 else
1073 { 1088 {
@@ -1086,13 +1101,31 @@ namespace OpenSim.Region.Environment.Scenes
1086 if (heightvalue < 0) 1101 if (heightvalue < 0)
1087 heightvalue = 0; 1102 heightvalue = 0;
1088 1103
1089 Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255); 1104 if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
1090 mapbmp.SetPixel(x, (256 - y) - 1, water); 1105 heightvalue = 0;
1106
1107 try
1108 {
1109 Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255);
1110 mapbmp.SetPixel(x, (256 - y) - 1, water);
1111 }
1112 catch (System.ArgumentException)
1113 {
1114 if (!terraincorruptedwarningsaid)
1115 {
1116 m_log.WarnFormat("[MAPIMAGE]: Your terrain is corrupted in region {0}, it might take a few minutes to generate the map image depending on the corruption level", RegionInfo.RegionName);
1117 terraincorruptedwarningsaid = true;
1118 }
1119 Color black = Color.Black;
1120 mapbmp.SetPixel(x, (256 - y) - 1, black);
1121 }
1091 } 1122 }
1092 //} 1123
1124 }
1125 //}
1093 1126
1094 1127
1095 } 1128
1096 //tc = System.Environment.TickCount - tc; 1129 //tc = System.Environment.TickCount - tc;
1097 //m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms"); 1130 //m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms");
1098 } 1131 }