Cache WoM env and terrain identifiers.

This commit is contained in:
UnknownShadow200 2015-04-28 06:26:46 +10:00
parent 1a61c78ed6
commit 60f0086680
2 changed files with 6 additions and 3 deletions

View File

@ -316,7 +316,9 @@ namespace ClassicalSharp {
// different world, the environment settings from the last world are not loaded in the
// new world if the async 'get request' didn't complete before the new world was loaded.
womCounter++;
Window.AsyncDownloader.DownloadPage( url, true, "womenv_" + womCounter );
womEnvIdentifier = "womenv_" + womCounter;
womTerrainIdentifier = "womterrain_" + womCounter;
Window.AsyncDownloader.DownloadPage( url, true, womEnvIdentifier );
sendWomId = true;
}
receivedFirstPosition = false;

View File

@ -7,9 +7,10 @@ namespace ClassicalSharp {
public partial class NetworkProcessor {
string womEnvIdentifier = "womenv_0", womTerrainIdentifier = "womterrain_0";
void CheckForWomEnvironment() {
string page;
Window.AsyncDownloader.TryGetPage( "womenv_" + womCounter, out page );
Window.AsyncDownloader.TryGetPage( womEnvIdentifier, out page );
if( page != null ) {
ParseWomConfig( page );
}
@ -18,7 +19,7 @@ namespace ClassicalSharp {
void CheckWomBitmaps() {
Bitmap terrainBmp;
Window.AsyncDownloader.TryGetImage( "womterrain_" + womCounter, out terrainBmp );
Window.AsyncDownloader.TryGetImage( womTerrainIdentifier, out terrainBmp );
if( terrainBmp != null ) {
Window.ChangeTerrainAtlas( terrainBmp );
}