341 begin |
341 begin |
342 TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true); |
342 TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true); |
343 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels); |
343 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels); |
344 TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true); |
344 TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true); |
345 tmpsurf:= doSurfaceConversion(tmpsurf); |
345 tmpsurf:= doSurfaceConversion(tmpsurf); |
346 if (NameTex <> nil) then |
346 // these two lines lines crash when run multiple times? |
347 FreeTexture(NameTex); |
347 //if (NameTex <> nil) then |
|
348 // FreeTexture(NameTex); |
348 NameTex:= Surface2Tex(tmpsurf, false); |
349 NameTex:= Surface2Tex(tmpsurf, false); |
349 SDL_FreeSurface(tmpsurf) |
350 SDL_FreeSurface(tmpsurf) |
350 end; |
351 end; |
351 |
352 |
352 // number of weapons in ammo menu |
353 // number of weapons in ammo menu |
353 for i:= Low(CountTexz) to High(CountTexz) do |
354 for i:= Low(CountTexz) to High(CountTexz) do |
354 begin |
355 begin |
355 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels); |
356 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels); |
356 tmpsurf:= doSurfaceConversion(tmpsurf); |
357 tmpsurf:= doSurfaceConversion(tmpsurf); |
357 if (CountTexz[i] <> nil) then |
358 // these two lines lines crash when run multiple times? |
358 FreeTexture(CountTexz[i]); |
359 //if (CountTexz[i] <> nil) then |
|
360 // FreeTexture(CountTexz[i]); |
359 CountTexz[i]:= Surface2Tex(tmpsurf, false); |
361 CountTexz[i]:= Surface2Tex(tmpsurf, false); |
360 SDL_FreeSurface(tmpsurf) |
362 SDL_FreeSurface(tmpsurf) |
361 end; |
363 end; |
362 |
364 |
363 AddProgress; |
365 AddProgress; |