# HG changeset patch # User nemo # Date 1386648827 18000 # Node ID 65cfbf379bdfd6e98fda8231235375b54632e361 # Parent d6f8b9cb729e5188c9d2cd45c12108f145dac12f clear hat if load fails diff -r d6f8b9cb729e -r 65cfbf379bdf hedgewars/uStore.pas --- a/hedgewars/uStore.pas Mon Dec 09 23:13:17 2013 -0500 +++ b/hedgewars/uStore.pas Mon Dec 09 23:13:47 2013 -0500 @@ -642,14 +642,18 @@ procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring); var texsurf: PSDL_Surface; begin + // free the mem of any previously assigned texture. This was previously only if the new one could be loaded, but, NoHat is usually a better choice + if HH.HatTex <> nil then + begin + FreeTexture(HH.HatTex); + HH.HatTex:= nil + end; texsurf:= LoadDataImage(ptHats, newHat, ifNone); AddFileLog('Hat => '+newHat); // only do something if the hat could be loaded if texsurf <> nil then begin AddFileLog('Got Hat'); - // free the mem of any previously assigned texture - FreeTexture(HH.HatTex); // assign new hat to hedgehog HH.HatTex:= Surface2Tex(texsurf, true); diff -r d6f8b9cb729e -r 65cfbf379bdf share/hedgewars/Data/Graphics/amRubber.png Binary file share/hedgewars/Data/Graphics/amRubber.png has changed