[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/editor ccl_editor.c
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus/src/editor ccl_editor.c |
Date: |
Thu, 20 Nov 2003 00:03:34 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/11/20 00:03:34
Modified files:
src/editor : ccl_editor.c
Log message:
Added DefineEditorUnitTypes, SetEditorSelectIcon, and SetEditorUnitsIcon
Patches:
Index: stratagus/src/editor/ccl_editor.c
diff -u stratagus/src/editor/ccl_editor.c:1.11
stratagus/src/editor/ccl_editor.c:1.12
--- stratagus/src/editor/ccl_editor.c:1.11 Wed Nov 12 15:41:42 2003
+++ stratagus/src/editor/ccl_editor.c Thu Nov 20 00:03:34 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_editor.c,v 1.11 2003/11/12 20:41:42 jsalmon3 Exp $
+// $Id: ccl_editor.c,v 1.12 2003/11/20 05:03:34 jsalmon3 Exp $
//@{
@@ -89,6 +89,36 @@
return SCM_UNSPECIFIED;
}
#elif defined(USE_LUA)
+local int CclDefineEditorUnitTypes(lua_State* l)
+{
+ char** cp;
+ int args;
+ int j;
+
+ if ((cp = EditorUnitTypes)) { // Free all old names
+ while (*cp) {
+ free(*cp++);
+ }
+ free(EditorUnitTypes);
+ }
+
+ //
+ // Get new table.
+ //
+ args = lua_gettop(l);
+ EditorUnitTypes = cp = malloc((args + 1) * sizeof(char*));
+ MaxUnitIndex = args;
+ for (j = 0; j < args; ++j) {
+ if (!lua_isstring(l, j + 1)) {
+ lua_pushstring(l, "incorrect argument");
+ lua_error(l);
+ }
+ *cp++ = strdup(lua_tostring(l, j + 1));
+ }
+ *cp = NULL;
+
+ return 0;
+}
#endif
/**
@@ -102,6 +132,16 @@
return SCM_UNSPECIFIED;
}
#elif defined(USE_LUA)
+local int CclSetEditorSelectIcon(lua_State* l)
+{
+ if (lua_gettop(l) != 1 || !lua_isstring(l, 1)) {
+ lua_pushstring(l, "incorrect argument");
+ lua_error(l);
+ }
+ free(EditorSelectIcon);
+ EditorSelectIcon = strdup(lua_tostring(l, 1));
+ return 0;
+}
#endif
/**
@@ -115,6 +155,16 @@
return SCM_UNSPECIFIED;
}
#elif defined(USE_LUA)
+local int CclSetEditorUnitsIcon(lua_State* l)
+{
+ if (lua_gettop(l) != 1 || !lua_isstring(l, 1)) {
+ lua_pushstring(l, "incorrect argument");
+ lua_error(l);
+ }
+ free(EditorUnitsIcon);
+ EditorUnitsIcon = strdup(lua_tostring(l, 1));
+ return 0;
+}
#endif
/**
@@ -123,12 +173,13 @@
global void EditorCclRegister(void)
{
#if defined(USE_GUILE) || defined(USE_SIOD)
- //gh_new_procedureN("player", CclPlayer);
- //gh_new_procedure0_0("get-this-player", CclGetThisPlayer);
- //gh_new_procedure1_0("set-this-player!", CclSetThisPlayer);
gh_new_procedureN("define-editor-unittypes", CclDefineEditorUnitTypes);
gh_new_procedure1_0("set-editor-select-icon!", CclSetEditorSelectIcon);
gh_new_procedure1_0("set-editor-units-icon!", CclSetEditorUnitsIcon);
+#elif defined(USE_LUA)
+ lua_register(Lua, "DefineEditorUnitTypes", CclDefineEditorUnitTypes);
+ lua_register(Lua, "SetEditorSelectIcon", CclSetEditorSelectIcon);
+ lua_register(Lua, "SetEditorUnitsIcon", CclSetEditorUnitsIcon);
#endif
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src/editor ccl_editor.c,
Jimmy Salmon <=