Engine:
authorsmxx
Wed, 24 Mar 2010 14:03:03 +0000
changeset 3058 2ebc20485344
parent 3057 e6e4c109ceb8
child 3059 5d71be884c19
Engine: * Free land objects right after map drawing Frontend: * No longer remove duplicates from friends/ignore lists (to keep Qt 4.4 compatibility) Maps: * No longer lock camera on balls on Knockball
QTfrontend/chatwidget.cpp
hedgewars/hwengine.pas
hedgewars/uLand.pas
hedgewars/uScript.pas
share/hedgewars/Data/Maps/Knockball/map.lua
--- a/QTfrontend/chatwidget.cpp	Wed Mar 24 11:01:21 2010 +0000
+++ b/QTfrontend/chatwidget.cpp	Wed Mar 24 14:03:03 2010 +0000
@@ -120,7 +120,8 @@
             continue;
         list << str.trimmed();
     }
-    list.removeDuplicates();
+    //readd once we require newer Qt than 4.4
+    //list.removeDuplicates();
     txt.close();
 }
 
--- a/hedgewars/hwengine.pas	Wed Mar 24 11:01:21 2010 +0000
+++ b/hedgewars/hwengine.pas	Wed Mar 24 14:03:03 2010 +0000
@@ -155,7 +155,6 @@
     StoreRelease();
     FreeGearsList();
     FreeVisualGears();
-    FreeLandObjects();
     FreeLand();
     ControllerClose();
     SendKB();
--- a/hedgewars/uLand.pas	Wed Mar 24 11:01:21 2010 +0000
+++ b/hedgewars/uLand.pas	Wed Mar 24 14:03:03 2010 +0000
@@ -828,6 +828,8 @@
 
 if ((GameFlags and gfForts) = 0) and (Pathz[ptMapCurrent] = '') then AddObjects;
 
+FreeLandObjects;
+
 UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT);
 end;
 
--- a/hedgewars/uScript.pas	Wed Mar 24 11:01:21 2010 +0000
+++ b/hedgewars/uScript.pas	Wed Mar 24 14:03:03 2010 +0000
@@ -133,6 +133,21 @@
     lc_addgear:= 1; // 1 return value
 end;
 
+function lc_getfollowgear(L : Plua_State) : LongInt; Cdecl;
+begin
+    if lua_gettop(L) <> 0 then
+        begin
+        WriteLnToConsole('LUA: Wrong number of parameters passed to GetFollowGear!');
+        lua_pushnil(L); // return value on stack (nil)
+        end
+    else
+        if FollowGear = nil then
+            lua_pushnil(L)
+        else
+            lua_pushnumber(L, FollowGear^.uid);
+    lc_getfollowgear:= 1; // 1 return value
+end;
+
 function lc_getgeartype(L : Plua_State) : LongInt; Cdecl;
 var gear : PGear;
 begin
@@ -786,6 +801,7 @@
 lua_register(luaState, 'CopyPV', @lc_copypv);
 lua_register(luaState, 'CopyPV2', @lc_copypv2);
 lua_register(luaState, 'FollowGear', @lc_followgear);
+lua_register(luaState, 'GetFollowGear', @lc_getfollowgear);
 lua_register(luaState, 'SetState', @lc_setstate);
 lua_register(luaState, 'GetState', @lc_getstate);
 lua_register(luaState, 'SetTag', @lc_settag);
--- a/share/hedgewars/Data/Maps/Knockball/map.lua	Wed Mar 24 11:01:21 2010 +0000
+++ b/share/hedgewars/Data/Maps/Knockball/map.lua	Wed Mar 24 14:03:03 2010 +0000
@@ -57,7 +57,7 @@
 end
 
 function onGameTick()
-	if ball ~= nil then FollowGear(ball) end
+	if ball ~= nil and GetFollowGear() ~= nil then FollowGear(ball) end
 end
 
 function onAmmoStoreInit()
@@ -72,6 +72,7 @@
 			CopyPV2(gear, ball)
 			SetState(ball, 0x200) -- temporary - might change!
 			SetTag(ball, 8) -- baseball skin
+			FollowGear(ball)
 		end
 	end
 end