GetAmmoName now returns ammo name overwritten by SetAmmoTexts
authorWuzzy <almikes@aol.com>
Sat, 19 Nov 2016 22:00:23 +0100
changeset 11944 87edf67f2107
parent 11943 a50cf6f5e3cd
child 11945 1e58845fa3c1
GetAmmoName now returns ammo name overwritten by SetAmmoTexts
hedgewars/uScript.pas
--- a/hedgewars/uScript.pas	Sat Nov 19 21:39:52 2016 +0100
+++ b/hedgewars/uScript.pas	Sat Nov 19 22:00:23 2016 +0100
@@ -2612,7 +2612,10 @@
         begin
         at:= LuaToAmmoTypeOrd(L, 1, call, params);                                                                                                   
         if at >= 0 then   
-            lua_pushstring(L, PChar(trammo[Ammoz[TAmmoType(at)].NameId]));
+            if length(trluaammo[Ammoz[TAmmoType(at)].NameId]) > 0 then
+                lua_pushstring(L, PChar(trluaammo[Ammoz[TAmmoType(at)].NameId]))
+            else
+                lua_pushstring(L, PChar(trammo[Ammoz[TAmmoType(at)].NameId]));
         end
     else
         lua_pushnil(L);