- Fix typo in frontend debug output
authorunc0rr
Sun, 22 Dec 2013 23:16:55 +0400
changeset 9815 d4621fb76284
parent 9814 c740c865294d
child 9816 e71188c140ee
- Fix typo in frontend debug output - Expose gravity to scripts (in percents, 100 = normal)
QTfrontend/model/ThemeModel.cpp
hedgewars/uScript.pas
--- a/QTfrontend/model/ThemeModel.cpp	Sun Dec 22 13:44:28 2013 -0500
+++ b/QTfrontend/model/ThemeModel.cpp	Sun Dec 22 23:16:55 2013 +0400
@@ -62,7 +62,7 @@
 
 void ThemeModel::loadThemes() const
 {
-    qDebug("[LAZINESS ThemeModel::loadThemes()]");
+    qDebug("[LAZINESS] ThemeModel::loadThemes()");
 
     m_themesLoaded = true;
 
--- a/hedgewars/uScript.pas	Sun Dec 22 13:44:28 2013 -0500
+++ b/hedgewars/uScript.pas	Sun Dec 22 23:16:55 2013 +0400
@@ -1898,6 +1898,28 @@
 end;
 
 
+function lc_getgravity(L : Plua_State) : LongInt; Cdecl;
+begin
+    if lua_gettop(L) <> 0 then
+        LuaParameterCountError('GetGravity', '', lua_gettop(L))
+    else
+        lua_pushinteger(L, hwRound(cGravity * 50 / cWindSpeed));
+    lc_getgravity:= 1
+end;
+
+function lc_setgravity(L : Plua_State) : LongInt; Cdecl;
+begin
+    if lua_gettop(L) <> 1 then
+        LuaParameterCountError('SetGravity', 'gravity', lua_gettop(L))
+    else
+        begin
+        cGravity:= cMaxWindSpeed * lua_tointeger(L, 1) * _0_02;
+        cGravityf:= 0.00025 * lua_tointeger(L, 1) * 0.02
+        end;
+    lc_setgravity:= 0
+end;
+
+
 function lc_setaihintsongear(L : Plua_State) : LongInt; Cdecl;
 var gear: PGear;
 begin
@@ -2574,6 +2596,8 @@
 lua_register(luaState, _P'PlaceGirder', @lc_placegirder);
 lua_register(luaState, _P'GetCurAmmoType', @lc_getcurammotype);
 lua_register(luaState, _P'TestRectForObstacle', @lc_testrectforobstacle);
+lua_register(luaState, _P'GetGravity', @lc_getgravity);
+lua_register(luaState, _P'SetGravity', @lc_setgravity);
 
 lua_register(luaState, _P'SetGearAIHints', @lc_setaihintsongear);
 lua_register(luaState, _P'HedgewarsScriptLoad', @lc_hedgewarsscriptload);