From 82ab883ea279150645b7e76ae761a45cb02ac907 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 28 May 2007 23:32:05 +0000 Subject: * Escaped log messages properly when logging to DB * World map textures are now checked against DBNull before returning * MySQL now informs when it gets a connection * "Fastmode" support added to world map queries (MySQL-only), disabled by default. --- .../OpenGridServices.GridServer/GridManager.cs | 56 +++++++++++++++------- 1 file changed, 40 insertions(+), 16 deletions(-) (limited to 'OpenGridServices/OpenGridServices.GridServer/GridManager.cs') diff --git a/OpenGridServices/OpenGridServices.GridServer/GridManager.cs b/OpenGridServices/OpenGridServices.GridServer/GridManager.cs index b73f24d..74ce973 100644 --- a/OpenGridServices/OpenGridServices.GridServer/GridManager.cs +++ b/OpenGridServices/OpenGridServices.GridServer/GridManager.cs @@ -315,25 +315,49 @@ namespace OpenGridServices.GridServer response.Value = responseData; IList simProfileList = new ArrayList(); - SimProfileData simProfile; - for (int x = xmin; x < xmax; x++) + bool fastMode = false; // MySQL Only + + if (fastMode) { - for (int y = ymin; y < ymax; y++) + Dictionary neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); + + foreach (KeyValuePair aSim in neighbours) { - simProfile = getRegion(Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256))); - if (simProfile != null) + Hashtable simProfileBlock = new Hashtable(); + simProfileBlock["x"] = aSim.Value.regionLocX; + simProfileBlock["y"] = aSim.Value.regionLocY; + simProfileBlock["name"] = aSim.Value.regionName; + simProfileBlock["access"] = 0; + simProfileBlock["region-flags"] = 0; + simProfileBlock["water-height"] = 20; + simProfileBlock["agents"] = 1; + simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); + + simProfileList.Add(simProfileBlock); + } + } + else + { + SimProfileData simProfile; + for (int x = xmin; x < xmax; x++) + { + for (int y = ymin; y < ymax; y++) { - Hashtable simProfileBlock = new Hashtable(); - simProfileBlock["x"] = x; - simProfileBlock["y"] = y; - simProfileBlock["name"] = simProfile.regionName; - simProfileBlock["access"] = 0; - simProfileBlock["region-flags"] = 0; - simProfileBlock["water-height"] = 20; - simProfileBlock["agents"] = 1; - simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); - - simProfileList.Add(simProfileBlock); + simProfile = getRegion(Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256))); + if (simProfile != null) + { + Hashtable simProfileBlock = new Hashtable(); + simProfileBlock["x"] = x; + simProfileBlock["y"] = y; + simProfileBlock["name"] = simProfile.regionName; + simProfileBlock["access"] = 0; + simProfileBlock["region-flags"] = 0; + simProfileBlock["water-height"] = 20; + simProfileBlock["agents"] = 1; + simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); + + simProfileList.Add(simProfileBlock); + } } } } -- cgit v1.1