stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src/ui interface.c


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src/ui interface.c
Date: 15 Dec 2003 10:37:54 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       03/12/15 10:37:54

Modified files:
        src/ui         : interface.c 

Log message:
        Only allow 'ai me' cheat in debug

Patches:
Index: stratagus/src/ui/interface.c
diff -u stratagus/src/ui/interface.c:1.147 stratagus/src/ui/interface.c:1.148
--- stratagus/src/ui/interface.c:1.147  Mon Dec 15 08:37:21 2003
+++ stratagus/src/ui/interface.c        Mon Dec 15 10:37:53 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: interface.c,v 1.147 2003/12/14 21:37:21 jsalmon3 Exp $
+//     $Id: interface.c,v 1.148 2003/12/14 23:37:53 jsalmon3 Exp $
 
 //@{
 
@@ -1113,6 +1113,7 @@
 #elif defined(USE_LUA)
     int ret;
 
+#ifdef DEBUG
     if (!strcmp(input, "ai me")) {
        if (ThisPlayer->AiEnabled) {
            ThisPlayer->AiEnabled = 0;
@@ -1126,21 +1127,21 @@
            }
            SetMessage("I'm the BORG, resistance is futile!");
        }
-       ret = 1;
+       return 1;
+    }
+#endif
+    lua_pushstring(Lua, "HandleCheats");
+    lua_gettable(Lua, LUA_GLOBALSINDEX);
+    lua_pushstring(Lua, input);
+    LuaCall(1, 0);
+    ret = lua_gettop(Lua);
+    if (lua_gettop(Lua) == 1) {
+       ret = LuaToBoolean(Lua, 1);
+       lua_pop(Lua, 1);
     } else {
-       lua_pushstring(Lua, "HandleCheats");
-       lua_gettable(Lua, LUA_GLOBALSINDEX);
-       lua_pushstring(Lua, input);
-       LuaCall(1, 0);
-       ret = lua_gettop(Lua);
-       if (lua_gettop(Lua) == 1) {
-           ret = LuaToBoolean(Lua, 1);
-           lua_pop(Lua, 1);
-       } else {
-           lua_pushstring(Lua, "HandleCheats must return a boolean");
-           lua_error(Lua);
-           ret = 0;
-       }
+       lua_pushstring(Lua, "HandleCheats must return a boolean");
+       lua_error(Lua);
+       ret = 0;
     }
     return ret;
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]