stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus ./Makefile ./Rules.make.in ./Rules.ma...


From: address@hidden
Subject: [Stratagus-CVS] stratagus ./Makefile ./Rules.make.in ./Rules.ma...
Date: Fri, 02 Jan 2004 00:06:49 -0000

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/02 08:24:22

Modified files:
        .              : Makefile Rules.make.in Rules.make.orig 
        doc            : ChangeLog.html 
        src/ai         : ai.c ai_building.c ai_force.c ai_local.h 
                         ai_plan.c ai_resource.c ccl_ai.c 
        src/editor     : ccl_editor.c editloop.c 
        src/game       : campaign.c game.c intro.c loadgame.c trigger.c 
        src/include    : Module.make ccl.h ccl_helpers.h ccl_sound.h 
                         font.h spells.h trigger.h 
        src/map        : ccl_map.c ccl_tileset.c tileset.c 
        src/missile    : ccl_missile.c 
        src/network    : commands.c 
        src/pathfinder : ccl_pathfinder.c 
        src/sound      : ccl_sound.c 
        src/stratagus  : ccl.c ccl_player.c ccl_spell.c construct.c 
                         groups.c selection.c spells.c stratagus.c 
        src/ui         : ccl_ui.c icons.c interface.c 
        src/unit       : ccl_unit.c ccl_unittype.c depend.c unit_draw.c 
                         upgrade.c 
        src/video      : font.c 
Removed files:
        data/ccl       : guile.ccl siod.ccl 
        doc            : SIOD.txt 
        src/ai         : ai_rules.c 
        src/include    : siod.h siodp.h 
        src/siod       : .cvsignore Module.make siod.html slib.c sliba.c 
                         slibu.c trace.c 
        src/stratagus  : ccl_helpers.c 

Log message:
        Converted scripts to Lua

Patches:
Index: stratagus/Makefile
diff -u stratagus/Makefile:1.183 stratagus/Makefile:1.184
--- stratagus/Makefile:1.183    Wed Dec 24 04:31:14 2003
+++ stratagus/Makefile  Fri Jan  2 08:23:59 2004
@@ -21,7 +21,7 @@
 ##     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ##     GNU General Public License for more details.
 ##
-##     $Id: Makefile,v 1.183 2003/12/23 17:31:14 nehalmistry Exp $
+##     $Id: Makefile,v 1.184 2004/01/01 21:23:59 jsalmon3 Exp $
 ##
 
 TOPDIR=        .
@@ -38,7 +38,7 @@
 INCLUDE_DIRS = src/include src/movie/vp31/include etlib
 
 MODULES = src/action src/ai src/beos src/stratagus src/editor src/stratagus 
src/game src/libmodplug src/map \
-          src/missile src/movie src/movie/vp31 src/network src/pathfinder 
src/siod src/sound src/ui src/unit \
+          src/missile src/movie src/movie/vp31 src/network src/pathfinder 
src/sound src/ui src/unit \
           src/video etlib
 
 MODULES_TOOLS = tools
@@ -216,7 +216,7 @@
 DOCS    = README doc/index.html doc/install.html \
          doc/media.html doc/datadir.html doc/README-SDL.txt\
          doc/faq.html doc/ChangeLog.html doc/todo.html \
-         doc/development.html doc/gpl.html doc/SIOD.txt \
+         doc/development.html doc/gpl.html \
          doc/ccl/ai.html doc/ccl/ccl.html doc/ccl/config.html \
          doc/ccl/icon.html doc/ccl/tileset.html doc/ccl/unittype.html \
          doc/ccl/research.html doc/graphic/* \
@@ -249,7 +249,7 @@
          data/ccl/orc/campaign1.ccl data/ccl/orc/campaign2.ccl \
          data/ccl/anim.ccl data/ccl/wc2.ccl data/ccl/ranks.ccl \
          data/ccl/tips.ccl data/ccl/menus.ccl data/ccl/keystrokes.ccl \
-         data/ccl/siod.ccl data/ccl/spells.ccl \
+         data/ccl/spells.ccl \
          data/ccl/editor.ccl # data/campaigns/*/*.cm
 
 CONTRIB        = contrib/cross.png contrib/red_cross.png \
Index: stratagus/Rules.make.in
diff -u stratagus/Rules.make.in:1.18 stratagus/Rules.make.in:1.19
--- stratagus/Rules.make.in:1.18        Fri Dec 12 12:37:32 2003
+++ stratagus/Rules.make.in     Fri Jan  2 08:23:59 2004
@@ -18,8 +18,8 @@
 # Prefix for 'make install'
 address@hidden@
 
-# Use SIOD support
-CCL            = -DUSE_SIOD
+# Use LUA support
+CCL            = -DUSE_LUA
 CCLLIB         = -lm
 
 # Video support
Index: stratagus/Rules.make.orig
diff -u stratagus/Rules.make.orig:1.155 stratagus/Rules.make.orig:1.156
--- stratagus/Rules.make.orig:1.155     Fri Dec 12 12:37:32 2003
+++ stratagus/Rules.make.orig   Fri Jan  2 08:23:59 2004
@@ -21,7 +21,7 @@
 ##     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ##     GNU General Public License for more details.
 ##
-##     $Id: Rules.make.orig,v 1.155 2003/12/12 01:37:32 jsalmon3 Exp $
+##     $Id: Rules.make.orig,v 1.156 2004/01/01 21:23:59 jsalmon3 Exp $
 ##
 
 ############################################################################
@@ -130,10 +130,10 @@
 XIFLAGS                = -I/usr/X11R6/include -I/usr/local/include 
 
 #------------------------------------------------------------------------------
-#      Support for SIOD (scheme interpreter)
+#      Support for LUA
 #      C C L   -       Craft Configuration Language
 
-CCL    = -DUSE_SIOD
+CCL    = -DUSE_LUA
 CCLLIB = -lm
 
 #------------------------------------------------------------------------------
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.591 stratagus/doc/ChangeLog.html:1.592
--- stratagus/doc/ChangeLog.html:1.591  Mon Dec 22 19:01:24 2003
+++ stratagus/doc/ChangeLog.html        Fri Jan  2 08:24:01 2004
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-----   $Id: ChangeLog.html,v 1.591 2003/12/22 08:01:24 wizzard Exp $
+----   $Id: ChangeLog.html,v 1.592 2004/01/01 21:24:01 jsalmon3 Exp $
 
 ----   (c) Copyright 1998-2003 by Lutz Sammer
 
@@ -36,6 +36,8 @@
 <li>Future 2.00 Release<p>
     <ul>
     <li>++
+    <li>Moved cheat codes out of the engine and into ccl (from Jimmy Salmon).
+    <li>Converted scripts to Lua (from Jimmy Salmon).
     <li>Added Text strings support to Title Screen (from Carlos Perelló Marín).
     <li>Splash Damage Configurable (from Russell Smith).
     <li>Fixed Bug #6924: missile cast near map border (from Russell Smith).
Index: stratagus/src/ai/ai.c
diff -u stratagus/src/ai/ai.c:1.104 stratagus/src/ai/ai.c:1.105
--- stratagus/src/ai/ai.c:1.104 Tue Dec 23 11:20:42 2003
+++ stratagus/src/ai/ai.c       Fri Jan  2 08:24:02 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai.c,v 1.104 2003/12/23 00:20:42 jsalmon3 Exp $
+//      $Id: ai.c,v 1.105 2004/01/01 21:24:02 jsalmon3 Exp $
 
 
 //@{
@@ -170,11 +170,8 @@
 
 global AiType* AiTypes;                                                /// 
List of all AI types.
 global AiHelper AiHelpers;                             /// AI helper variables
-global int AiScriptActionNum = 0;              /// number of action script ( 
FIXME : initialized only once )
-global AiScriptAction AiScriptActions[MaxAiScriptActions];             /// 
definitions of action scripts
 
 global PlayerAi* AiPlayer;                             /// Current AI player
-global AiRunningScript* AiScript;              /// Current AI script
 /**
 **  W*rCr*ft number to internal ai-type name.
 */
@@ -185,135 +182,21 @@
 ----------------------------------------------------------------------------*/
 
 /**
-**  FIXME: docu
-*/
-local void debugForces(void)
-{
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       const AiActionEvaluation* aiaction;
-       int force;
-       int i;
-       int count[UnitTypeMax + 1];
-       int want[UnitTypeMax + 1];
-       char* str;
-
-       DebugLevel2Fn(" AI MEMORY (%d)\n" _C_ AiPlayer->EvaluationCount);
-       aiaction = AiPlayer->FirstEvaluation;
-       while (aiaction) {
-               str = 
gh_scm2newstr(gh_car(gh_car(aiaction->AiScriptAction->Action)),NULL);
-               DebugLevel2(" %8lu: (%3d,%3d) => points:%9d, needs: %9d ( %s 
)\n" _C_
-                       aiaction->GameCycle _C_
-                       aiaction->HotSpotX _C_
-                       aiaction->HotSpotY _C_
-                       aiaction->HotSpotValue _C_
-                       aiaction->Value _C_
-                       str);
-               free(str);
-               aiaction = aiaction->Next;
-       }
-       DebugLevel2Fn(" AI FORCES         ! : completed A/D : 
attacking/defending\n");
-       for (force = 0; force < AI_MAX_FORCES; ++force) {
-               DebugLevel2("force %5d %c%c :" _C_
-                       force _C_
-                       (AiPlayer->Force[force].Role == AiForceRoleAttack ? 'A' 
: 'D') _C_
-                       (AiPlayer->Force[force].Completed ? '!' : ' '));
-
-               AiForceCountUnits(force, count);
-
-               for (i = 0; i <= UnitTypeMax; ++i) {
-                       want[i] = 0;
-               }
-               AiForceSubstractWant(force, want);
-
-               for (i = 0; i < UnitTypeMax; ++i) {
-                       if (count[i] || want[i]) {
-                               DebugLevel2(" %s(%d/%d)" _C_ 
UnitTypes[i]->Ident _C_ count[i] _C_ (-want[i]));
-                       }
-               }
-
-               if (force > AI_GENERIC_FORCES || force == 0) {
-                       if (!gh_null_p(AiPlayer->Scripts[force ? force - 
AI_GENERIC_FORCES : 0].Script)) {
-                                       DebugLevel2(" => ");
-                               fflush(stdout);
-                               gh_display(gh_car(AiPlayer->Scripts[force ? 
force - AI_GENERIC_FORCES : 0].Script));
-                               CclFlushOutput();
-                       }
-               }
-               DebugLevel2("\n");
-       }
-#elif defined(USE_LUA)
-#endif
-}
-
-/**
 **  Execute the AI Script.
 */
-local void AiExecuteScripts(void)
+local void AiExecuteScript(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       int i;
-       PlayerAi* pai;
-       SCM value;
-
-       pai = AiPlayer;
-
-       // Debugging
-       if (pai->ScriptDebug) {
-               debugForces();
-       }
-
-       for (i = 0; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
-               AiScript = pai->Scripts + i;
-               if (!gh_null_p(AiScript->Script)) {
-                       /*DebugLevel3Fn("%d.%d (%12s) @ %3d.%3d :" _C_
-                               pai->Player->Player _C_ i _C_ AiScript->Ident 
_C_
-                               AiScript->HotSpotX _C_ AiScript->HotSpotY);
-                       gh_display(AiScript->Script);
-                       gh_newline();*/
-
-                       value = gh_eval(gh_car(AiScript->Script), NIL);
-                       if (!gh_eq_p(value, SCM_BOOL_T)) {
-                               CclGcProtectedAssign(&AiScript->Script, 
gh_cdr(AiScript->Script));
-                       }
-
-                       if (gh_null_p(AiScript->Script) && AiScript->OwnForce) {
-                               AiEraseForce(AiScript->OwnForce);
-                       }
-               }
-       }
-#elif defined(USE_LUA)
-       int i;
        PlayerAi* pai;
 
        pai = AiPlayer;
-
-       // Debugging
-       if (pai->ScriptDebug) {
-               debugForces();
-       }
-
-       for (i = 0; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
-               AiScript = pai->Scripts + i;
-               if (AiScript->Script) {
-                       /*DebugLevel3Fn("%d.%d (%12s) @ %3d.%3d :" _C_
-                               pai->Player->Player _C_ i _C_ AiScript->Ident 
_C_
-                               AiScript->HotSpotX _C_ AiScript->HotSpotY);
-                       gh_display(AiScript->Script);
-                       gh_newline();*/
-
-                       lua_pushstring(Lua, "_ai_scripts_");
-                       lua_gettable(Lua, LUA_GLOBALSINDEX);
-                       lua_pushstring(Lua, AiScript->Script);
-                       lua_rawget(Lua, 1);
-                       LuaCall(0, 1);
-                       lua_pop(Lua, 1);
-
-                       if (!AiScript->Script && AiScript->OwnForce) {
-                               AiEraseForce(AiScript->OwnForce);
-                       }
-               }
+       if (pai->Script) {
+               lua_pushstring(Lua, "_ai_scripts_");
+               lua_gettable(Lua, LUA_GLOBALSINDEX);
+               lua_pushstring(Lua, pai->Script);
+               lua_rawget(Lua, 1);
+               LuaCall(0, 1);
+               lua_pop(Lua, 1);
        }
-#endif
 }
 
 /**
@@ -322,6 +205,7 @@
 local void AiCheckUnits(void)
 {
        int counter[UnitTypeMax];
+       int attacking[UnitTypeMax];
        const AiBuildQueue* queue;
        const int* unit_types_count;
        int i;
@@ -332,6 +216,7 @@
        int e;
 
        memset(counter, 0, sizeof (counter));
+       memset(attacking,0,sizeof(attacking));
 
        //
        //  Count the already made build requests.
@@ -386,14 +271,13 @@
        }
 
        //
-       // Magically complete all forces
+       // Look through the forces what is missing.
        //
-       for (i = 0; i < AI_MAX_FORCES; ++i) {
-               if (!AiPlayer->Force[i].Completed &&
-                               (AiPlayer->Force[i].PopulateMode == 
AiForcePopulateFromAttack ||
-                                       AiPlayer->Force[i].PopulateMode == 
AiForcePopulateAny)) {
-                       // This force should be completed from other forces.
-                       AiForceComplete(i);
+       for (i = AI_MAX_FORCES; i < AI_MAX_ATTACKING_FORCES; ++i) {
+               const AiUnit* unit;
+
+               for (unit = AiPlayer->Force[i].Units; unit; unit = unit->Next) {
+                       attacking[unit->Unit->Type->Type]++;
                }
        }
 
@@ -403,20 +287,22 @@
        for (i = 0; i < AI_MAX_FORCES; ++i) {
                const AiUnitType* aiut;
 
-               // Create units only for AiForceCreateFromScratch forces
-               if (AiPlayer->Force[i].PopulateMode != 
AiForcePopulateFromScratch) {
+               // No troops for attacking force
+               if (!AiPlayer->Force[i].Defending &&
+                               AiPlayer->Force[i].Attacking) {
                        continue;
                }
 
                for (aiut = AiPlayer->Force[i].UnitTypes; aiut; aiut = 
aiut->Next) {
                        t = aiut->Type->Type;
                        x = aiut->Want;
-                       if (x > unit_types_count[t] + counter[t]) {  // Request 
it.
+                       if (x > unit_types_count[t] + counter[t] - 
attacking[t]) {    // Request it.
                                DebugLevel2Fn("Force %d need %s * %d\n" _C_ i 
_C_ aiut->Type->
                                        Ident _C_ x);
-                               AiAddUnitTypeRequest(aiut->Type, x - 
unit_types_count[t] - counter[t]);
-                               counter[t] += x - unit_types_count[t] - 
counter[t];
-                               AiPlayer->Force[i].Completed = 0;
+                               AiAddUnitTypeRequest(aiut->Type,
+                                       x - (unit_types_count[t] + counter[t] - 
attacking[t]));
+                               counter[t] += x - (unit_types_count[t] + 
counter[t] - attacking[t]);
+                               AiPlayer->Force[i].Completed=0;
                        }
                        counter[t] -= x;
                }
@@ -705,32 +591,6 @@
 }
 
 /**
-**  Save all the AiScriptAction defined
-**
-**  @param file  Output file
-*/
-local void SaveAiScriptActions(CLFile* file)
-{
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       AiScriptAction* aiScriptAction;
-       int i;
-
-       // FIXME : should import the built-in lambda as well ( really needed ? )
-       for (i = 0; i < AiScriptActionNum; ++i) {
-               aiScriptAction = AiScriptActions + i;
-
-               CLprintf(file, "(define-ai-action '(%s%s)\n  '",
-                       (aiScriptAction->Defensive ? " defense " : ""),
-                       (aiScriptAction->Offensive ? " attack " : ""));
-
-               lprin1CL(aiScriptAction->Action, file);
-               CLprintf(file, "\n)\n");
-       }
-#elif defined(USE_LUA)
-#endif
-}
-
-/**
 **  Save the AI type. (recursive)
 **
 **  @param file    Output file.
@@ -738,7 +598,7 @@
 */
 local void SaveAiType(CLFile* file, const AiType* aitype)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
+#if 0
        SCM list;
 
        if (aitype->Next) {
@@ -753,11 +613,11 @@
        list = aitype->Script;
        while (!gh_null_p(list)) {
                CLprintf(file, "\n      ");
-               //lprin1CL(gh_car(list),file);
+               lprin1CL(gh_car(list), file);
                list = gh_cdr(list);
        }
        CLprintf(file, " ))\n\n");
-#elif defined(USE_LUA)
+#else
 #endif
 }
 
@@ -783,7 +643,7 @@
 */
 local void SaveAiPlayer(CLFile* file, unsigned plynr, PlayerAi* ai)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
+#if 0
        IOOutFile = file;
        IOLoadingMode = 0;
        IOTabLevel = 1;
@@ -791,7 +651,7 @@
        CLprintf(IOOutFile, "(define-ai-player '");
        IOPlayerAiFullPtr(SCM_UNSPECIFIED, &ai, 0);
        CLprintf(IOOutFile, ")\n");
-#elif defined(USE_LUA)
+#else
 #endif
 }
 
@@ -820,12 +680,11 @@
 {
        CLprintf(file, "\n;;; -----------------------------------------\n");
        CLprintf(file,
-               ";;; MODULE: AI $Id: ai.c,v 1.104 2003/12/23 00:20:42 jsalmon3 
Exp $\n\n");
+               ";;; MODULE: AI $Id: ai.c,v 1.105 2004/01/01 21:24:02 jsalmon3 
Exp $\n\n");
 
        SaveAiTypesWcName(file);
        SaveAiHelper(file);
        SaveAiTypes(file);
-       SaveAiScriptActions(file);
        SaveAiPlayers(file);
 
        DebugLevel0Fn("FIXME: Saving AI isn't supported\n");
@@ -838,7 +697,6 @@
 */
 global void AiInit(Player* player)
 {
-       int i;
        PlayerAi* pai;
        AiType* ait;
        char* ainame;
@@ -853,35 +711,6 @@
        pai->Player = player;
        ait = AiTypes;
 
-       for (i = 0; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
-               pai->Scripts[i].OwnForce = AI_GENERIC_FORCES + i;
-               pai->Scripts[i].HotSpotX = -1;
-               pai->Scripts[i].HotSpotY = -1;
-               pai->Scripts[i].HotSpotRay = -1;
-               pai->Scripts[i].Gauges = 0;
-               pai->Scripts[i].SleepCycles = 0;
-#if defined(USE_GUILE) || defined(USE_SIOD)
-               pai->Scripts[i].Script = NIL;
-               CclGcProtect(&pai->Scripts[i].Script);
-#elif defined(USE_LUA)
-               pai->Scripts[i].Script = NULL;
-#endif
-               snprintf(pai->Scripts[i].Ident, 10, "Empty");
-       }
-
-       // Set autoattack to 1 as default
-       pai->AutoAttack = 1;
-
-       for (i = 0; i < AI_GENERIC_FORCES; ++i) {
-               // First force defend, others are attacking...
-               pai->Force[i].Role = (i ? AiForceRoleAttack : 
AiForceRoleDefend);
-
-               // Theses forces should be built from scratch
-               pai->Force[i].PopulateMode = AiForcePopulateFromScratch;
-               pai->Force[i].UnitsReusable = 1;
-               pai->Force[i].HelpMode = AiForceHelpFull;
-       }
-
        ainame = AiTypeWcNames[player->AiNum];
        DebugLevel0(" looking for class %s\n" _C_ ainame);
 
@@ -931,11 +760,7 @@
                _C_ ainame _C_ ait->Class);
 
        pai->AiType = ait;
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       CclGcProtectedAssign(&pai->Scripts[0].Script, ait->Script);
-#elif defined(USE_LUA)
-       pai->Scripts[0].Script = ait->Script;
-#endif
+       pai->Script = ait->Script;
 
        pai->Collect[TimeCost] = 0;
        pai->Collect[GoldCost] = 50;
@@ -975,7 +800,7 @@
                        //
                        //  Free forces
                        //
-                       for (i = 0; i < AI_MAX_FORCES; ++i) {
+                       for (i = 0; i < AI_MAX_ATTACKING_FORCES; ++i) {
                                AiUnitType* aut;
                                AiUnit* aiunit;
 
@@ -989,16 +814,6 @@
                                }
                        }
 
-                       for (i = 0; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
-                               if (pai->Scripts[i].Gauges) {
-                                       free(pai->Scripts[i].Gauges);
-                               }
-#if defined(USE_GUILE) || defined(USE_SIOD)
-                               CclGcUnprotect(&pai->Scripts[i].Script);
-#elif defined(USE_LUA)
-#endif
-                       }
-
                        //
                        //  Free UnitTypeRequests
                        //
@@ -1041,14 +856,7 @@
                free(aitype->Name);
                free(aitype->Race);
                free(aitype->Class);
-
-               // ai-type->Script freed by ccl
-#if defined(USE_GUILE) || defined(USE_SIOD)
-               CclGcUnprotect(&aitype->Script);
-#elif defined(USE_LUA)
                free(aitype->Script);
-               aitype->Script = NULL;
-#endif
 
                temp = aitype->Next;
                free(aitype);
@@ -1106,19 +914,7 @@
                AiTypeWcNames = NULL;
        }
 
-       // Free script action scm...
-       for (i = 0; i < AiScriptActionNum; ++i) {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-               CclGcUnprotect(&AiScriptActions[i].Action);
-#elif defined(USE_LUA)
-               free(AiScriptActions[i].Action);
-               AiScriptActions[i].Action = NULL;
-#endif
-       }
-
        AiResetUnitTypeEquiv();
-
-       AiScriptActionNum = 0;
 }
 
 /*----------------------------------------------------------------------------
@@ -1268,24 +1064,45 @@
        }
 
        AiPlayer = pai = defender->Player->Ai;
+       if (pai->Force[0].Attacking) {  // Force 0 busy
+               return;
+       }
 
        //
-       //  If unit belongs to an attack/defend force, don't defend it.
+       //  If unit belongs to an attacking force, don't defend it.
        //
-       for (force = 1; force < AI_MAX_FORCES; ++force) {
+       for (force = 0; force < AI_MAX_ATTACKING_FORCES; ++force) {
+               if (!pai->Force[force].Attacking) {  // none attacking
+                       // FIXME, send the force for help
+                       continue;
+               }
                aiunit = pai->Force[force].Units;
-
                while (aiunit) {
                        if (defender == aiunit->Unit) {
-                               AiForceHelpMe(force, attacker, defender);
                                return;
                        }
                        aiunit = aiunit->Next;
                }
        }
 
-       // Unit can't be found in forces, consider it's in force 0
-       AiForceHelpMe(0, attacker, defender);
+       DebugLevel2Fn("Sending force 0 and 1 to defend\n");
+       //
+       //  Send force 0 defending, also send force 1 if this is home.
+       //
+       if (attacker) {
+               AiAttackWithForceAt(0, attacker->X, attacker->Y);
+               if (!pai->Force[1].Attacking) {  // none attacking
+                       pai->Force[1].Defending = 1;
+                       AiAttackWithForceAt(1, attacker->X, attacker->Y);
+               }
+       } else {
+               AiAttackWithForceAt(0, defender->X, defender->Y);
+               if (!pai->Force[1].Attacking) {  // none attacking
+                       pai->Force[1].Defending = 1;
+                       AiAttackWithForceAt(1, defender->X, defender->Y);
+               }
+       }
+       pai->Force[0].Defending = 1;
 }
 
 /**
@@ -1915,7 +1732,7 @@
        //
        //  Advance script
        //
-       AiExecuteScripts();
+       AiExecuteScript();
 
        //
        //  Look if everything is fine.
@@ -1933,10 +1750,6 @@
        //  Check for magic actions.
        //
        AiCheckMagic();
-
-       if (AiPlayer->AutoAttack) {
-               AiPeriodicAttack();
-       }
 
        // At most 1 explorer each 5 seconds
        if (GameCycle > AiPlayer->LastExplorationGameCycle + 5 * 
CYCLES_PER_SECOND) {
Index: stratagus/src/ai/ai_building.c
diff -u stratagus/src/ai/ai_building.c:1.45 stratagus/src/ai/ai_building.c:1.46
--- stratagus/src/ai/ai_building.c:1.45 Sun Dec 14 20:44:31 2003
+++ stratagus/src/ai/ai_building.c      Fri Jan  2 08:24:03 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai_building.c,v 1.45 2003/12/14 09:44:31 wizzard Exp $
+//      $Id: ai_building.c,v 1.46 2004/01/01 21:24:03 jsalmon3 Exp $
 
 //@{
 
@@ -290,7 +290,7 @@
 **
 **  @return        True if place found, false if not found.
 **
-**  @todo          FIXME: This is slow really slow, using 
+**  @todo          FIXME: This is slow really slow, using
 **                 two flood fills, is not a perfect solution.
 */
 local int AiFindHallPlace(const Unit * worker, const UnitType * type, int *dx, 
int *dy)
Index: stratagus/src/ai/ai_force.c
diff -u stratagus/src/ai/ai_force.c:1.46 stratagus/src/ai/ai_force.c:1.47
--- stratagus/src/ai/ai_force.c:1.46    Tue Dec 23 11:17:22 2003
+++ stratagus/src/ai/ai_force.c Fri Jan  2 08:24:03 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai_force.c,v 1.46 2003/12/23 00:17:22 jsalmon3 Exp $
+//      $Id: ai_force.c,v 1.47 2004/01/01 21:24:03 jsalmon3 Exp $
 
 //@{
 
@@ -191,191 +191,16 @@
 }
 
 /**
-**  Count available units by type in a force.
-**
-**  The returned array will map UnitType=>number of unit
-**
-**  @param force        the force to count unit
-**  @param countByType  array[UnitTypeMax+1] of int
-*/
-global void AiForceCountUnits(int force, int* countByType)
-{
-       int type;
-       AiUnit* aiunit;
-
-       memset(countByType, 0, sizeof(int) * (UnitTypeMax + 1));
-
-       aiunit = AiPlayer->Force[force].Units;
-       while (aiunit) {
-               if (!aiunit->Unit->Destroyed && aiunit->Unit->HP &&
-                               aiunit->Unit->Orders[0].Action != 
UnitActionDie) {
-                       type = UnitTypeEquivs[aiunit->Unit->Type->Type];
-
-                       DebugCheck(type < 0 || type > UnitTypeMax);
-                       countByType[type]++;
-               }
-               aiunit = aiunit->Next;
-       }
-}
-
-/**
-**  Substract wanted unit in a force. ( from the result of AiForceCountUnits )
-**
-**  @param force        the force to count unit
-**  @param countByType  array[UnitTypeMax+1] of int
-**
-**  @return             The number of missing unit
-*/
-global int AiForceSubstractWant(int force, int* countByType)
-{
-       int missing;
-       int type;
-       const AiUnitType* aitype;
-
-       missing = 0;
-       aitype = AiPlayer->Force[force].UnitTypes;
-       while (aitype) {
-               type = UnitTypeEquivs[aitype->Type->Type];
-               countByType[type] -= aitype->Want;
-               if (countByType[type] < 0) {
-                       missing -= countByType[type];
-               }
-               aitype = aitype->Next;
-       }
-
-       return missing;
-}
-
-/**
-**  Complete dst force with units from src force.
-**
-**  @todo FIXME: should check that unit can reach dst force's hotspot.
-**
-**  @param src  the force from which units are taken
-**  @param dst  the force into which units go
-*/
-global void AiForceTransfert(int src, int dst)
-{
-       AiUnit** prev;
-       AiUnit* aiunit;
-       int type;
-       int counter[UnitTypeMax + 1];
-       int missing;
-
-       //
-       // Count units in dest force.
-       //
-       AiForceCountUnits(dst, counter);
-
-       //
-       // Check the dest force requirements.
-       //
-       if ((missing = AiForceSubstractWant(dst, counter)) == 0) {
-               // Nothing missing => mark completed & abort.
-               AiPlayer->Force[dst].Completed = 1;
-               return;
-       }
-
-       // Iterate the source force, moving needed units into dest...
-       prev = &AiPlayer->Force[src].Units;
-       while (*prev) {
-               aiunit = (*prev);
-               type = UnitTypeEquivs[aiunit->Unit->Type->Type];
-               if (counter[type] < 0) {
-                       // move in dest force...
-                       *prev = aiunit->Next;
-
-                       aiunit->Next = AiPlayer->Force[dst].Units;
-                       AiPlayer->Force[dst].Units = aiunit;
-
-                       counter[type]++;
-                       --missing;
-
-                       if (!missing) {
-                               AiPlayer->Force[dst].Completed = 1;
-                               return;
-                       }
-               } else {
-                       // Just iterate
-                       prev = &aiunit->Next;
-               }
-       }
-}
-
-/**
-**  Complete dst force with overflow units in src force.
-**
-**  @todo FIXME: should check that unit can reach dst force's hotspot.
-**
-**  @param src  the force from which units are taken
-**  @param dst  the force into which units go
-*/
-global void AiForceTransfertOverflow(int src, int dst)
-{
-       AiUnit** prev;
-       AiUnit* aiunit;
-       int type;
-       int counter[UnitTypeMax + 1];
-       int overflow[UnitTypeMax + 1];
-       int missing;
-
-       //
-       // Count units in dest force.
-       //
-       AiForceCountUnits(dst, counter);
-
-       //
-       // Check the dest force requirements.
-       //
-       if ((missing = AiForceSubstractWant(dst, counter)) == 0) {
-               // Nothing missing => abort.
-               AiPlayer->Force[dst].Completed = 1;
-               return;
-       }
-
-       //
-       // Find overflow units in src force
-       //
-       AiForceCountUnits(src, overflow);
-       AiForceSubstractWant(src, overflow);
-
-       // Iterate the source force, moving needed units into dest...
-       prev = &AiPlayer->Force[src].Units;
-       while (*prev) {
-               aiunit = (*prev);
-               type = UnitTypeEquivs[aiunit->Unit->Type->Type];
-               if (counter[type] < 0 && overflow[type] > 0) {
-                       // move in dest force...
-                       *prev = aiunit->Next;
-
-                       aiunit->Next = AiPlayer->Force[dst].Units;
-                       AiPlayer->Force[dst].Units = aiunit;
-
-                       ++counter[type];
-                       --overflow[type];
-                       --missing;
-                       if (!missing) {
-                               AiPlayer->Force[dst].Completed = 1;
-                               return;
-                       }
-               } else {
-                       // Just iterate
-                       prev = &aiunit->Next;
-               }
-       }
-}
-
-/**
 **  Ai clean units in a force.
 **
 **  @param force  Force number.
 */
-global void AiCleanForce(int force)
+local void AiCleanForce(int force)
 {
        AiUnit** prev;
        AiUnit* aiunit;
+       const AiUnitType* aitype;
        int counter[UnitTypeMax + 1];
-       int unit_released;
 
        //
        // Release all killed units.
@@ -400,31 +225,40 @@
        //
        // Count units in force.
        //
-       AiForceCountUnits(force, counter);
+       memset(counter, 0, sizeof(counter));
+       aiunit = AiPlayer->Force[force].Units;
+       while (aiunit) {
+               // FIXME: Should I use equivalent unit types?
+               counter[aiunit->Unit->Type->Type]++;
+               aiunit = aiunit->Next;
+       }
 
        //
        // Look if the force is complete.
        //
-       AiPlayer->Force[force].Completed = (AiForceSubstractWant(force, 
counter) == 0);
+       AiPlayer->Force[force].Completed = 1;
+       aitype = AiPlayer->Force[force].UnitTypes;
+       while (aitype) {
+               if (aitype->Want > counter[aitype->Type->Type]) {
+                       DebugLevel3Fn("%d: missing %s.\n" _C_ force _C_ 
aitype->Type->Ident);
+                       AiPlayer->Force[force].Completed = 0;
+               }
+               counter[aitype->Type->Type] -= aitype->Want;
+               aitype = aitype->Next;
+       }
 
-       // Don't prune the 0 force in any case
-       if (force > 0) {
-               //
-               // Release units too much in force.
-               //
-               unit_released = 0;
-               prev = (&AiPlayer->Force[force].Units);
-               while ((aiunit = (*prev))) {
+       //
+       // Release units too much in force.
+       //
+       if (!AiPlayer->Force[force].Attacking) {
+               prev = &AiPlayer->Force[force].Units;
+               while ((aiunit = *prev)) {
                        if (counter[aiunit->Unit->Type->Type] > 0) {
                                DebugLevel3Fn("Release unit %s\n" _C_ 
aiunit->Unit->Type->Ident);
                                counter[aiunit->Unit->Type->Type]--;
                                RefsDecrease(aiunit->Unit);
                                *prev = aiunit->Next;
-
-                               // Move this unit somewhere else...
-                               AiAssignToForce(aiunit->Unit);
                                free(aiunit);
-
                                continue;
                        }
                        prev = &aiunit->Next;
@@ -435,41 +269,6 @@
 }
 
 /**
-**
-**  Remove everything in the given force
-**
-**  @param force  the force to erase
-*/
-global void AiEraseForce(int force)
-{
-       AiUnitType* aiut;
-       AiUnitType* next;
-       AiUnit* aiu;
-       AiUnit* next_u;
-
-       aiut = AiPlayer->Force[force].UnitTypes;
-       while (aiut) {
-               next = aiut->Next;
-               free(aiut);
-               aiut = next;
-       }
-       AiPlayer->Force[force].UnitTypes = 0;
-
-       aiu = AiPlayer->Force[force].Units;
-       while (aiu) {
-               // Decrease usage count
-               RefsDecrease(aiu->Unit);
-
-               next_u = aiu->Next;
-               free(aiu);
-               aiu = next_u;
-       }
-       AiPlayer->Force[force].Units = 0;
-
-       AiAssignFreeUnitsToForce();
-}
-
-/**
 **  Cleanup units in forces.
 */
 global void AiCleanForces(void)
@@ -479,48 +278,57 @@
        //
        // Release all killed units.
        //
-       for (force = 0; force < AI_MAX_FORCES; ++force) {
+       for (force = 0; force < AI_MAX_ATTACKING_FORCES; ++force) {
                AiCleanForce(force);
        }
 }
 
 /**
 **  Check if the units belongs to the force.
-**  If ok, update the completed flag
 **
 **  @param force  Force to be checked.
 **  @param type   Type to check.
 **
-**  @return       True if it fits & update completed flag, false otherwise.
+**  @return       True if it fits, false otherwise.
 */
 local int AiCheckBelongsToForce(int force, const UnitType* type)
 {
+       AiUnit* aiunit;
+       AiUnitType* aitype;
        int counter[UnitTypeMax + 1];
-       int missing;
-       int realtype;
+       int flag;
 
+       memset(counter, 0, sizeof(counter));
        //
        // Count units in force.
        //
-       AiForceCountUnits(force, counter);
+       aiunit = AiPlayer->Force[force].Units;
+       while (aiunit) {
+               // FIXME: Should I use equivalent unit types?
+               counter[aiunit->Unit->Type->Type]++;
+               aiunit = aiunit->Next;
+       }
 
        //
        // Look what should be in the force.
        //
-       missing = AiForceSubstractWant(force, counter);
-       AiPlayer->Force[force].Completed = (missing == 0);
-
-       realtype = UnitTypeEquivs[type->Type];
-
-       if (counter[realtype] < 0) {
-               // Ok we will put this unit in this force !
-               // Just one missing ?
-               if (counter[realtype] == -1 && missing == 1) {
-                       AiPlayer->Force[force].Completed = 1;
+       flag = 0;
+       AiPlayer->Force[force].Completed = 1;
+       aitype = AiPlayer->Force[force].UnitTypes;
+       while (aitype) {
+               if (aitype->Want > counter[aitype->Type->Type]) {
+                       if (type == aitype->Type) {
+                               if (aitype->Want - 1 > 
counter[aitype->Type->Type]) {
+                                       AiPlayer->Force[force].Completed = 0;
+                               }
+                               flag = 1;
+                       } else {
+                               AiPlayer->Force[force].Completed = 0;
+                       }
                }
-               return 1;
+               aitype = aitype->Next;
        }
-       return 0;
+       return flag;
 }
 
 /**
@@ -530,257 +338,32 @@
 */
 global void AiAssignToForce(Unit* unit)
 {
-       AiUnit* aiunit;
        int force;
 
        //
        // Check to which force it belongs
        //
        for (force = 0; force < AI_MAX_FORCES; ++force) {
-               // care of populate from scratch only.
-               if (AiPlayer->Force[force].PopulateMode != 
AiForcePopulateFromScratch) {
+               // No troops for attacking force
+               if (!AiPlayer->Force[force].Defending &&
+                               AiPlayer->Force[force].Attacking) {
                        continue;
                }
 
                if (AiCheckBelongsToForce(force, unit->Type)) {
+                       AiUnit* aiunit;
+
                        aiunit = malloc(sizeof (*aiunit));
                        aiunit->Next = AiPlayer->Force[force].Units;
                        AiPlayer->Force[force].Units = aiunit;
                        aiunit->Unit = unit;
                        RefsIncrease(unit);
-                       return;
-               }
-       }
-
-       // Add to the 0 force !
-       // ( we overflow the 0 force here, so completed does not need update )
-       aiunit = malloc(sizeof (*aiunit));
-       aiunit->Next = AiPlayer->Force[0].Units;
-       AiPlayer->Force[0].Units = aiunit;
-       aiunit->Unit = unit;
-       RefsIncrease(unit);
-}
-
-/**
-**  Try to complete a force, using all available units
-**
-**  @param force  the force to complete
-*/
-global void AiForceComplete(int force)
-{
-       int j;
-       int overflowonly;
-
-       for (j = 0; j < AI_MAX_FORCES; ++j) {
-               // Don't complete with self ...
-               if (j == force) {
-                       continue;
-               }
-
-               // Complete only with "reusable" forces.
-               if (!AiPlayer->Force[j].UnitsReusable) {
-                       continue;
-               }
-
-               // Honor "populate from attack"
-               if ((AiPlayer->Force[force].PopulateMode == 
AiForcePopulateFromAttack) &&
-                               (!AiPlayer->Force[j].Role == 
AiForceRoleAttack)) {
-                       // Use overflow from force 0...
-                       if (j == 0) {
-                               overflowonly = 1;
-                       } else {
-                               continue;
-                       }
-               } else {
-                       overflowonly = 0;
-               }
-
-               // Complete the force automatically...
-               if (!overflowonly) {
-                       AiForceTransfert(j, force);
-               } else {
-                       AiForceTransfertOverflow(j, force);
-               }
-
-               if (AiPlayer->Force[force].Completed) {
                        break;
                }
        }
 }
 
 /**
-**  Enrole a unit in the specific force.
-**  Does not take equivalence into account
-**
-**  @todo FIXME: currently iterate all units (slow)
-**        FIXME: should take units which are closer to the hotspot.
-**        FIXME: should ensure that units can move to the hotspot.
-**
-**  @param force  the force to put units on
-**  @param ut     the searched unittype
-**  @param count  the number of unit to add
-**
-**  @return       the number of unit still missing (or 0 if successful)
-*/
-global int AiEnroleSpecificUnitType(int force, UnitType* ut, int count)
-{
-       AiForce* dstForce;
-       int src_force;
-       AiUnit* aiUnit;
-       AiUnit** prev;
-
-       dstForce = AiPlayer->Force + force;
-       for (src_force = 0; src_force < AI_MAX_FORCES; src_force++) {
-               if (src_force == force) {
-                       continue;
-               }
-               // Only populate with reserve
-               if (!AiPlayer->Force[src_force].UnitsReusable) {
-                       continue;
-               }
-               // Don't populate attack force with defend reserve.
-               if ((AiPlayer->Force[src_force].Role == AiForceRoleDefend) &&
-                               (AiPlayer->Force[force].PopulateMode == 
AiForcePopulateFromAttack)) {
-                       continue;
-               }
-
-               aiUnit = AiPlayer->Force[src_force].Units;
-               prev = &AiPlayer->Force[src_force].Units;
-               while (aiUnit) {
-                       if (aiUnit->Unit->Type->Type == ut->Type) {
-                               *prev = aiUnit->Next;
-
-                               // Move to dstForce
-                               AiPlayer->Force[src_force].Completed = 0;
-                               aiUnit->Next = dstForce->Units;
-                               dstForce->Units = aiUnit;
-
-                               count--;
-                               if (!count) {
-                                       return 0;
-                               }
-                       }
-                       prev = &aiUnit->Next;
-                       aiUnit = aiUnit->Next;
-               }
-       }
-       return count;
-}
-
-/**
-**  Make sure that current force requirement are superior to actual assigned
-**  unit count
-**
-**  @param force  FIXME: docu
-*/
-local void AiFinalizeForce(int force)
-{
-       int i;
-       int type;
-       int unitcount[UnitTypeMax + 1];
-       AiUnitType *aitype;
-
-       AiForceCountUnits(force, unitcount);
-       aitype = AiPlayer->Force[force].UnitTypes;
-       while (aitype) {
-               type = UnitTypeEquivs[aitype->Type->Type];
-               if (unitcount[type] > aitype->Want) {
-                       aitype->Want = unitcount[type];
-                       unitcount[type] = 0;
-               }
-               aitype = aitype->Next;
-       }
-
-       for (i = 0; i <= UnitTypeMax; i++) {
-               if (unitcount[i] > 0) {
-                       aitype = (AiUnitType *) malloc(sizeof (AiUnitType));
-                       aitype->Want = unitcount[i];
-                       aitype->Type = UnitTypes[i];
-
-                       // Insert into force.
-                       aitype->Next = AiPlayer->Force[force].UnitTypes;
-                       AiPlayer->Force[force].UnitTypes = aitype;
-               }
-       }
-}
-
-/**
-**  Create a force full of available units, responding to the powers.
-**
-**  @param power   Land/Sea/Air power to match
-**  @param utypes  array of unittypes to use
-**  @param ucount  Size of the utypes array
-**
-**  @return        -1 if not possible, 0 if force ready.
-*/
-global int AiCreateSpecificForce(int* power, int* unittypes, int 
unittypescount)
-{
-       UnitType *ut;
-       int id;
-       int maxPower;
-       int forceUpdated;
-       int curpower[3];
-       int maxadd;
-       int lefttoadd;
-       int unittypeforce;
-       int equivalents[UnitTypeMax + 1];
-       int equivalentscount;
-       int equivalentid;
-
-       curpower[0] = power[0];
-       curpower[1] = power[1];
-       curpower[2] = power[2];
-       AiEraseForce(AiScript->OwnForce);
-
-       do {
-               forceUpdated = 0;
-               maxPower = (curpower[0] > curpower[1] ?
-                       (curpower[0] > curpower[2] ? 0 : 2) : (curpower[1] > 
curpower[2] ? 1 : 2));
-
-               for (id = 0; id < unittypescount; id++) {
-                       // Search in equivalents
-                       equivalentscount = 
AiFindAvailableUnitTypeEquiv(UnitTypes[unittypes[id]], equivalents);
-                       for (equivalentid = 0; equivalentid < equivalentscount; 
++equivalentid) {
-                               ut = UnitTypes[equivalents[equivalentid]];
-                               if (!(ut->CanTarget & (1 << maxPower))) {
-                                       continue;
-                               }
-
-                               unittypeforce = AiUnitTypeForce(ut);
-                               unittypeforce = (unittypeforce ? unittypeforce 
: 1);
-
-                               // Try to respond to the most important power 
...
-                               maxadd = 1 + curpower[maxPower] / unittypeforce;
-
-                               lefttoadd = 
AiEnroleSpecificUnitType(AiScript->OwnForce, ut, maxadd);
-
-                               // Nothing added, continue.
-                               if (lefttoadd == maxadd) {
-                                       continue;
-                               }
-
-                               // FIXME: don't always use the right unittype 
here...
-                               curpower[maxPower] -= (maxadd - lefttoadd) * 
unittypeforce;
-
-                               forceUpdated = 1;
-
-                               maxPower = (curpower[0] > curpower[1] ?
-                                       (curpower[0] > curpower[2] ? 0 : 2) :
-                                       (curpower[1] > curpower[2] ? 1 : 2));
-                               if (curpower[maxPower] <= 0) {
-                                       AiFinalizeForce(AiScript->OwnForce);
-                                       return 0;
-                               }
-                       }
-               }
-       } while (forceUpdated);
-       // Sth missing...
-       AiFinalizeForce(AiScript->OwnForce);
-       return -1;
-}
-
-
-/**
 **  Assign free units to force.
 */
 global void AiAssignFreeUnitsToForce(void)
@@ -800,7 +383,7 @@
        //
        // Remove all units already in forces.
        //
-       for (f = 0; f < AI_MAX_FORCES; ++f) {
+       for (f = 0; f < AI_MAX_ATTACKING_FORCES; ++f) {
                aiunit = AiPlayer->Force[f].Units;
                while (aiunit) {
                        unit = aiunit->Unit;
@@ -848,166 +431,138 @@
                        } else {
                                CommandMove(aiunit->Unit, x, y, FlushCommands);
                        }
-
                        aiunit = aiunit->Next;
                }
        }
 }
 
 /**
-**  Try to group units in a force. Units are grouped around the closest
-**  units of the hotspot.
+**  Attack opponent with force.
 **
-**  @param force  the force to send home.
+**  @param force  Force number to attack with.
 */
-global void AiGroupForceNear(int force, int targetX, int targetY)
+global void AiAttackWithForce(int force)
 {
-       const AiUnit *aiunit;
-       const AiUnit *groupunit;
-       int unitdst, groupdst;
-
-       // Step 1 : find the unit closest to the force hotspot
-       AiCleanForce(force);
-
-       groupdst = -1;
-
-       groupunit = 0;
-
-       aiunit = AiPlayer->Force[force].Units;
-
-       // Sanity : don't group force with only one unit !
-       if ((!aiunit) || (!aiunit->Next)) {
-               return;
-       }
+       const AiUnit* aiunit;
+       const Unit* enemy;
+       int x;
+       int y;
+       int f;
 
-       while (aiunit) {
-               unitdst = abs(aiunit->Unit->X - targetX) + abs(aiunit->Unit->Y 
- targetY);
-               if ((unitdst < groupdst) || (!groupunit)) {
-                       groupunit = aiunit;
-                       groupdst = unitdst;
+       // Move the force to a free position so it can be used for a new
+       // attacking party
+       if (force < AI_MAX_FORCES) {
+               AiUnitType* aiut;
+               AiUnitType* temp;
+               AiUnitType** aiut2;
+
+               f = AI_MAX_FORCES;
+               while (AiPlayer->Force[f].Attacking) {
+                       ++f;
+                       if (f == AI_MAX_ATTACKING_FORCES) {
+                               DebugLevel0Fn("No free attacking forces\n");
+                               f = force;
+                               break;
+                       }
                }
+               if (f != AI_MAX_ATTACKING_FORCES) {
+                       for (aiut = AiPlayer->Force[f].UnitTypes; aiut; aiut = 
temp) {
+                               temp = aiut->Next;
+                               free(aiut);
+                       }
 
-               aiunit = aiunit->Next;
-       }
-
-       AiPlayer->Force[force].Attacking = 1;
-
-       // Order units to attack near the "group" unit...
-       aiunit = AiPlayer->Force[force].Units;
-       while (aiunit) {
-               if (aiunit->Unit->Type->CanAttack) {
-                       CommandAttack(aiunit->Unit, groupunit->Unit->X, 
groupunit->Unit->Y, NULL,
-                               FlushCommands);
-               } else {
-                       CommandMove(aiunit->Unit, groupunit->Unit->X, 
groupunit->Unit->Y,
-                               FlushCommands);
+                       AiPlayer->Force[f] = AiPlayer->Force[force];
+                       memset(&AiPlayer->Force[force], 0, sizeof(AiForce));
+                       aiut = AiPlayer->Force[force].UnitTypes;
+                       aiut2 = &AiPlayer->Force[force].UnitTypes;
+                       while (aiut) {
+                               *aiut2 = malloc(sizeof(**aiut2));
+                               (*aiut2)->Next = NULL;
+                               (*aiut2)->Want = aiut->Want;
+                               (*aiut2)->Type = aiut->Type;
+                               aiut = aiut->Next;
+                               aiut2 = &(*aiut2)->Next;
+                       }
                }
-               aiunit = aiunit->Next;
-       }
-}
-
-/**
-**  Find the closest home batiment.
-**  ground is 0 : land, 1 : air, 2 : water ( as UnitType::UnitType )
-**
-**  @param ground  ground type ( land/air/water )
-**  @param x       X start position
-**  @param y       Y start position
-**  @param rsltx   X destination
-**  @param rslyx   Y destination
-**
-**  @todo  Find in the player unit's the closer to
-*/
-local void AiFindHome(int ground, int x, int y, int* rsltx, int* rslty)
-{
-       // Find in the player unit's the closer to
-       *rsltx = AiPlayer->Player->StartX;
-       *rslty = AiPlayer->Player->StartY;
-}
 
-/**
-**  Try to send this force home
-**
-**  @param force  the force to send home.
-*/
-global void AiSendForceHome(int force)
-{
-       const AiUnit* aiunit;
-       int i;
-       int type;
-       int x[3];
-       int y[3];
+               force = f;
+       }
 
        AiCleanForce(force);
-       aiunit = AiPlayer->Force[force].Units;
 
-       for (i = 0; i < 3; i++) {
-               x[i] = -1;
-               y[i] = -1;
-       }
-
-       while (aiunit) {
-               type = aiunit->Unit->Type->UnitType;
+       AiPlayer->Force[force].Attacking = 0;
+       if ((aiunit = AiPlayer->Force[force].Units)) {
+               AiPlayer->Force[force].Attacking = 1;
+               DebugLevel3Fn("FORCE %d started (AiAttackWithForce)\n" _C_ 
force);
 
-               if (x[type] == -1) {
-                       AiFindHome(type, aiunit->Unit->X, aiunit->Unit->Y, 
&x[type], &y[type]);
+               enemy = NoUnitP;
+               while (aiunit && !enemy) {  // Use a unit that can attack
+                       if (aiunit->Unit->Type->CanAttack) {
+                               enemy = AttackUnitsInDistance(aiunit->Unit, 
MaxMapWidth);
+                       }
+                       aiunit = aiunit->Next;
                }
 
-               CommandMove(aiunit->Unit, x[type], y[type], FlushCommands);
+               if (!enemy) {
+                       DebugLevel0Fn("Need to plan an attack with 
transporter\n");
+                       if (!AiPlayer->Force[force].State &&
+                                       !AiPlanAttack(&AiPlayer->Force[force])) 
{
+                               DebugLevel0Fn("Can't transport, look for 
walls\n");
+                               if (!AiFindWall(&AiPlayer->Force[force])) {
+                                       AiPlayer->Force[force].Attacking = 0;
+                               }
+                       }
+                       return;
+               }
+               AiPlayer->Force[force].State = 0;
+               x = enemy->X;
+               y = enemy->Y;
 
-               aiunit = aiunit->Next;
+               //
+               //  Send all units in the force to enemy.
+               //
+               aiunit = AiPlayer->Force[force].Units;
+               while (aiunit) {
+                       if (aiunit->Unit->Type->CanAttack) {
+                               CommandAttack(aiunit->Unit, x, y, NULL, 
FlushCommands);
+                       } else {
+                               CommandMove(aiunit->Unit, x, y, FlushCommands);
+                       }
+                       aiunit = aiunit->Next;
+               }
        }
 }
 
 /**
-**  Ai Force Action when unit/force requires assistance
+**     Force on attack ride. We attack until there is no unit or enemy left.
 **
-**  @param force     Force Number (FIXME: which?)
-**  @param attacker  attacking unit
-**  @param defender  defending unit
+**     @param force    Force pointer.
 */
-global void AiForceHelpMe(int force, const Unit* attacker, Unit* defender)
+local void AiForceAttacks(AiForce* force)
 {
-       AiForce* aiForce;
-       AiUnit* rescue;
-
-       aiForce = AiPlayer->Force + force;
-
-       // Don't handle special cases
-       if (aiForce->State > 0) {
-               return;
-       }
-
-       switch (aiForce->HelpMode) {
-               case AiForceDontHelp:
-                       // Don't react (easy)
-                       return;
+       const AiUnit* aiunit;
 
-               case AiForceHelpForce:
-                       // Send all idles units in the attacked force for help
-                       rescue = aiForce->Units;
-                       while (rescue) {
-                               // TODO : check that dead units does appear 
there
-                               if (UnitIdle(rescue->Unit)) {
-                                       // This unit attack !
-                                       if (rescue->Unit->Type->CanAttack) {
-                                               CommandAttack(rescue->Unit, 
attacker->X, attacker->Y, NULL,
-                                                       FlushCommands);
-                                       } else {
-                                               CommandMove(rescue->Unit, 
attacker->X, attacker->Y,
-                                                       FlushCommands);
-                                       }
-                                       // Now the force is attacking ( again )
-                                       aiForce->Attacking = 1;
-                               }
-                               rescue = rescue->Next;
+       if ((aiunit = force->Units)) {
+               while (aiunit) {
+                       // Still some action
+                       if (!UnitIdle(aiunit->Unit)) {
+                               break;
                        }
-                       break;
-
-               default:
-                       // the usual way : create a defense force, send it, ...
-                       AiFindDefendScript(attacker->X, attacker->Y);
-                       break;
+                       aiunit = aiunit->Next;
+               }
+               // Must mark the attack as terminated
+               if (!aiunit) {
+                       DebugLevel3Fn("FORCE stopped ( AiForceAttacks, 
unitactionstill )\n");
+                       DebugLevel3Fn("force target was %d %d\n" _C_ 
force->GoalX _C_ force->GoalY);
+                       DebugLevel3Fn("unit pos was %d %d\n" _C_ 
force->Units->Unit->X _C_ force->
+                       Units->Unit->Y);
+
+                       force->Attacking = 0;
+                       // AiAttackWithForce(force-AiPlayer->Force);
+               }
+       } else {
+               DebugLevel3Fn("FORCE stopped ( AiAttackWithForce, no unit )\n");
+               force->Attacking = 0;
        }
 }
 
@@ -1018,6 +573,38 @@
 */
 global void AiForceManager(void)
 {
+       int force;
+
+       //
+       //  Look if our defenders still have enemies in range.
+       //
+       for (force = 0; force < AI_MAX_ATTACKING_FORCES; ++force) {
+               if (AiPlayer->Force[force].Defending) {
+                       const AiUnit* aiunit;
+
+                       AiCleanForce(force);
+                       //
+                       //  Look if still enemies in attack range.
+                       //
+                       aiunit = AiPlayer->Force[force].Units;
+                       while (aiunit) {
+                               if (aiunit->Unit->Type->CanAttack &&
+                                               
AttackUnitsInReactRange(aiunit->Unit)) {
+                                       break;
+                               }
+                               aiunit = aiunit->Next;
+                       }
+                       if (!aiunit) {          // No enemies go home.
+                               DebugLevel0Fn("FIXME: not written, should send 
force home\n");
+                               AiPlayer->Force[force].Defending = 0;
+                               AiPlayer->Force[force].Attacking = 0;
+                       }
+               }
+               if (AiPlayer->Force[force].Attacking) {
+                       AiCleanForce(force);
+                       AiForceAttacks(&AiPlayer->Force[force]);
+               }
+       }
        AiAssignFreeUnitsToForce();
 }
 
Index: stratagus/src/ai/ai_local.h
diff -u stratagus/src/ai/ai_local.h:1.52 stratagus/src/ai/ai_local.h:1.53
--- stratagus/src/ai/ai_local.h:1.52    Tue Dec 23 11:20:43 2003
+++ stratagus/src/ai/ai_local.h Fri Jan  2 08:24:03 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai_local.h,v 1.52 2003/12/23 00:20:43 jsalmon3 Exp $
+//      $Id: ai_local.h,v 1.53 2004/01/01 21:24:03 jsalmon3 Exp $
 
 #ifndef __AI_LOCAL_H__
 #define __AI_LOCAL_H__
@@ -67,11 +67,7 @@
        unsigned char AllVisbile : 1;  /// Ai sees invisibile area
 #endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       SCM Script;   /// Main script (gc-protected!)
-#elif defined(USE_LUA)
        char* Script; /// Main script
-#endif
 };
 
 /**
@@ -119,36 +115,15 @@
 
 
 /**
-**  Ways to populate a force
-*/
-enum _ai_force_populate_mode_ {
-       AiForceDontPopulate,        /// Force won't receive any unit
-       AiForcePopulateFromScratch, /// Force unit's will be builded
-       AiForcePopulateFromAttack,  /// Force will receive units from idle 
attack force only - nothing builded
-       AiForcePopulateAny          /// Force will receive units from any idle 
force - nothing builded
-};
-
-/**
-**  How to react when an unit is attacked in a force
-*/
-enum _ai_force_help_mode_ {
-       AiForceDontHelp,  /// Don't react to attack on this force
-       AiForceHelpForce, /// Send idle units to defend
-       AiForceHelpFull   /// Create a defend force, send it, ...
-};
-
-/**
 **  Define an AI force.
 **
 **  A force is a group of units belonging together.
 */
 typedef struct _ai_force_ {
        char Completed;     /// Flag saying force is complete build
-       char Attacking;     /// Is this force attacking ( aka not idle )
+       char Defending;     /// Flag saying force is defending
+       char Attacking;     /// Flag saying force is attacking
        char Role;          /// Role of the force
-       char PopulateMode;  /// Which forces can be used to fill this force ?
-       char UnitsReusable; /// Indicate moving units of this force into others 
is allowed.
-       char HelpMode;      /// How to react to treat in this force ?
 
        AiUnitType* UnitTypes; /// Count and types of unit-type
        AiUnit*     Units;     /// Units in the force
@@ -179,77 +154,6 @@
        UnitType*     Type; /// unit-type
 };
 
-/**
-**  AI running script ( with state, ... )
-*/
-typedef struct _ai_running_script_ {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       SCM           Script;      /// Script executed
-#elif defined(USE_LUA)
-       char*         Script;      /// Script executed
-#endif
-       unsigned long SleepCycles; /// Cycles to sleep
-       char          Ident[10];   /// Debugging !
-       int           HotSpotX;    /// Hot spot ( for defense, attack, ... )
-       int           HotSpotY;
-       int           HotSpotRay;
-       int           OwnForce;    /// A force ID ( the n° of the script... )
-       int*          Gauges;      /// Gauges values ( initially 0 )
-
-       // Total number of resource gauges
-#define RESOURCE_COUNT  3
-       // Total number of forces gauges
-#define FORCE_COUNT            11
-
-#define GAUGE_NB (3 + (RESOURCE_COUNT * 2) + (FORCE_COUNT * 6))
-} AiRunningScript;
-
-/**
-**  Ai script action
-**
-**  Describe each different attack/defend scheme.
-**
-**  Linked list.
-*/
-typedef struct _ai_script_action_ {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       SCM Action;    /// Scheme description, in the form :
-                      /// '((name evaluate-lambda run-script) ... )
-#elif defined(USE_LUA)
-       char* Action;  /// Name of lua table
-       char* Script;  /// Name of lua script
-#endif
-
-       int Defensive; /// Is this action usable for defense
-       int Offensive; /// Is this action usable for attack
-
-       /// TODO : hotspot_kind : set if the hotspot should contain path from 
base
-} AiScriptAction;
-
-/**
-**  AiActionEvaluation typedef
-*/
-typedef struct _ai_action_evaluation_ AiActionEvaluation;
-
-/**
-**  Ai action evaluation
-**
-**  Each AiPlayer periodically evaluation an attack action.
-**
-**  If it is ready, the attack is fired. Else, it is keept for a while.
-**  From time to time, the best unfired try is fired.
-**
-*/
-struct _ai_action_evaluation_ {
-       AiScriptAction*     AiScriptAction; /// Action evaluated
-       unsigned long       GameCycle;      /// Gamecycle when this evaluation 
occured
-       int                 HotSpotX;       /// X position of the hotspot, or -1
-       int                 HotSpotY;       /// Y position of the hotspot, or -1
-       int                 HotSpotValue;   /// Value of the hotspot ( total 
points to get... )
-       int                 Value;          /// Result of the evaluation ( 
resources needed... )
-       AiActionEvaluation* Next;           /// Next in linked list
-};
-
 typedef struct _ai_exploration_request_ AiExplorationRequest;
 
 struct _ai_exploration_request_ {
@@ -274,22 +178,14 @@
        Player* Player; /// Engine player structure
        AiType* AiType; /// AI type of this player AI
        // controller
-#define AI_MAX_RUNNING_SCRIPTS 5 /// ( generic, attack, defend, ... )
-#define AI_MAIN_SCRIPT 0
-       AiRunningScript Scripts[AI_MAX_RUNNING_SCRIPTS]; /// All running scripts
-
-       // Ai "memory"
-#define AI_MEMORY_SIZE 30 /// Max number of keept evaluation ( => 30 sec )
-       AiActionEvaluation* FirstEvaluation; /// begining of linked list of 
evaluation
-       AiActionEvaluation* LastEvaluation;  /// end of linked list of 
evaluation
-       int                 EvaluationCount; /// size of linked list of 
evaluation
+       char*               Script;          /// Script executed
        int                 ScriptDebug;     /// Flag script debuging on/off
-       int                 AutoAttack;      /// Are attack started 
automatically ?
+       unsigned long       SleepCycles;     /// Cycles to sleep
 
        // forces
-#define AI_MAX_FORCES 10 /// How many forces are supported
-#define AI_GENERIC_FORCES (AI_MAX_FORCES-AI_MAX_RUNNING_SCRIPTS) /// How many 
forces are useable in the main script
-       AiForce Force[AI_MAX_FORCES]; /// Forces controlled by AI
+#define AI_MAX_FORCES 10                    /// How many forces are supported
+#define AI_MAX_ATTACKING_FORCES 30          /// Attacking forces
+       AiForce Force[AI_MAX_ATTACKING_FORCES]; /// Forces controlled by AI
 
        // resource manager
        int Reserve[MaxCosts]; /// Resources to keep in reserve
@@ -373,12 +269,8 @@
 extern AiType* AiTypes; /// List of all AI types
 extern AiHelper AiHelpers; /// AI helper variables
 
-#define MaxAiScriptActions 64 /// How many AiScriptActions are supported
-extern int AiScriptActionNum; /// Current number of AiScriptAction
-extern AiScriptAction AiScriptActions[MaxAiScriptActions]; /// All availables 
AI script actions
 extern int UnitTypeEquivs[UnitTypeMax + 1]; /// equivalence between unittypes
 extern PlayerAi* AiPlayer; /// Current AI player
-extern AiRunningScript* AiScript; /// Currently running script
 extern char** AiTypeWcNames; /// pud num to internal string mapping
 
 /*----------------------------------------------------------------------------
@@ -398,8 +290,6 @@
 extern void AiResourceManager(void);
        /// Ask the ai to explore around x,y
 extern void AiExplore(int x, int y, int exploreMask);
-       /// Count the number of builder unit available for the given unittype
-extern int AiCountUnitBuilders(UnitType* type);
        /// Make two unittypes be considered equals
 extern void AiNewUnitTypeEquiv(UnitType* a, UnitType* b);
        /// Remove any equivalence between unittypes
@@ -420,40 +310,16 @@
 //
        /// Cleanup units in force
 extern void AiCleanForces(void);
-       /// Cleanup units in the given force
-extern void AiCleanForce(int force);
-       /// Remove everything in the given force
-extern void AiEraseForce(int force);
        /// Assign a new unit to a force
 extern void AiAssignToForce(Unit* unit);
        /// Assign a free units to a force
 extern void AiAssignFreeUnitsToForce(void);
-       /// Complete a force with units form another
-extern void AiForceTransfert(int src, int dst);
-       /// Group a force on the nearest unit to target
-extern void AiGroupForceNear(int force, int targetx, int targety);
        /// Attack with force at position
 extern void AiAttackWithForceAt(int force, int x, int y);
        /// Attack with force
 extern void AiAttackWithForce(int force);
-       /// Send force home
-extern void AiSendForceHome(int force);
-       /// Evaluate the cost to build a force (time to build + resources)
-extern int AiEvaluateForceCost(int force, int total);
-       /// Complete a force from existing units.
-extern void AiForceComplete(int force);
-       /// Enrole one or more units of a type in a force
-extern int AiEnroleSpecificUnitType(int force, UnitType* ut, int count);
-       /// Create a force from existing units, ready to respond to the powers
-extern int AiCreateSpecificForce(int *power, int *unittypes, int 
unittypescount);
-       /// Force's unit is attacked.
-extern void AiForceHelpMe(int force, const Unit* attacker, Unit* defender);
        /// Periodic called force manager handler
 extern void AiForceManager(void);
-       /// Calculate the number of unit produced for each wanted unittype
-extern void AiForceCountUnits(int force, int* unittypeCount);
-       /// Substract the number of unit wanted for each unittype
-extern int AiForceSubstractWant(int force, int* unittypeCount);
 
 //
 // Plans
@@ -466,51 +332,10 @@
 extern void AiSendExplorers(void);
 
 //
-// Scripts
-//
-       /// Run a script ( for the current AiPlayer )
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern void AiRunScript(int script, SCM list, int hotSpotX, int hotSpotY, int 
hotSpotRay);
-#elif defined(USE_LUA)
-#endif
-       /// Find a script for defense.
-extern void AiFindDefendScript(int attackX, int attackY);
-       /// Check if attack is possible
-extern void AiPeriodicAttack(void);
-
-//
-// Gauges
-//
-       /// Compute gauges for the current RunningScript
-extern void AiComputeCurrentScriptGauges(void);
-       /// Output gauges values
-extern void AiDebugGauges(void);
-       /// Give the value of a specific gauge, for the current RunningScript
-extern int AiGetGaugeValue(int gauge);
-       /// Find a gauge given its identifier.
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern int AiFindGaugeId(SCM id);
-#elif defined(USE_LUA)
-extern int AiFindGaugeId(lua_State* l);
-#endif
-       /// return the force of the unittype.
-extern int AiUnitTypeForce(UnitType* unitType);
-
-//
 // Magic
 //
        /// Check for magic
 extern void AiCheckMagic(void);
-
-//
-// Ccl helpers
-//
-
-       /// Save/Load a PlayerAi structure ( see ccl_helpers.h for details )
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern void IOPlayerAiFullPtr(SCM form, void* binaryform, void* para);
-#elif defined(USE_LUA)
-#endif
 
 //@}
 
Index: stratagus/src/ai/ai_plan.c
diff -u stratagus/src/ai/ai_plan.c:1.27 stratagus/src/ai/ai_plan.c:1.28
--- stratagus/src/ai/ai_plan.c:1.27     Tue Dec 23 11:18:39 2003
+++ stratagus/src/ai/ai_plan.c  Fri Jan  2 08:24:03 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai_plan.c,v 1.27 2003/12/23 00:18:39 jsalmon3 Exp $
+//      $Id: ai_plan.c,v 1.28 2004/01/01 21:24:03 jsalmon3 Exp $
 
 //@{
 
@@ -237,7 +237,7 @@
        int ep;
        int i;
        int w;
-       enum { 
+       enum {
                OnWater,
                OnLand,
                OnIsle
Index: stratagus/src/ai/ai_resource.c
diff -u stratagus/src/ai/ai_resource.c:1.85 stratagus/src/ai/ai_resource.c:1.86
--- stratagus/src/ai/ai_resource.c:1.85 Mon Dec 15 08:08:07 2003
+++ stratagus/src/ai/ai_resource.c      Fri Jan  2 08:24:03 2004
@@ -10,7 +10,7 @@
 //
 /address@hidden ai_resource.c - AI resource manager. */
 //
-//      (c) Copyright 2000-2002 by Lutz Sammer and Antonis Chaniotis.
+//      (c) Copyright 2000-2004 by Lutz Sammer and Antonis Chaniotis.
 //
 //      This program is free software; you can redistribute it and/or modify
 //      it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai_resource.c,v 1.85 2003/12/14 21:08:07 wizzard Exp $
+//      $Id: ai_resource.c,v 1.86 2004/01/01 21:24:03 jsalmon3 Exp $
 
 //@{
 
Index: stratagus/src/ai/ccl_ai.c
diff -u stratagus/src/ai/ccl_ai.c:1.94 stratagus/src/ai/ccl_ai.c:1.95
--- stratagus/src/ai/ccl_ai.c:1.94      Tue Dec 23 11:15:56 2003
+++ stratagus/src/ai/ccl_ai.c   Fri Jan  2 08:24:03 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl_ai.c,v 1.94 2003/12/23 00:15:56 jsalmon3 Exp $
+//      $Id: ccl_ai.c,v 1.95 2004/01/01 21:24:03 jsalmon3 Exp $
 
 //@{
 
@@ -48,481 +48,6 @@
 #include "ccl_helpers.h"
 
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/*----------------------------------------------------------------------------
---  Forwards
-----------------------------------------------------------------------------*/
-/// Handle saving/loading a reference to an AiType.
-local void IOAiTypePtr(SCM from, void* binaryform, void* para);
-/// Handle saving/loading a reference to an AiScriptAction.
-local void IOAiScriptActionPtr(SCM scmfrom, void* binaryform, void* para);
-/// Handle saving/loading an array of int for ressources.
-local void IORessourceArray(SCM scmfrom, void* binaryform, void* para);
-/// Handle saving/loading a ressource mask
-local void IORessourceMask(SCM scmfrom, void* binaryform, void* para);
-
-/*----------------------------------------------------------------------------
---  Constants
-----------------------------------------------------------------------------*/
-
-/// Description of the AiActionEvaluation structure
-static IOStructDef AiActionEvaluationStructDef = {
-       "AiActionEvaluation",
-       sizeof(AiActionEvaluation),
-       -1,
-       {
-               {"`next", NULL, &((AiActionEvaluation*)0)->Next, NULL},
-               {"ai-script-action", &IOAiScriptActionPtr, 
&((AiActionEvaluation*)0)->AiScriptAction, NULL},
-               {"gamecycle", &IOInt, &((AiActionEvaluation*)0)->GameCycle, 
NULL},
-               {"hotspot-x", &IOInt, &((AiActionEvaluation*)0)->HotSpotX, 
NULL},
-               {"hotspot-y", &IOInt, &((AiActionEvaluation*)0)->HotSpotY, 
NULL},
-               {"hotspot-value", &IOInt, 
&((AiActionEvaluation*)0)->HotSpotValue, NULL},
-               {"value", &IOInt, &((AiActionEvaluation*)0)->Value, NULL},
-               {0, 0, 0, 0}
-       }
-};
-
-static IOStructDef AiExplorationRequestStructDef = {
-       "AiExplorationRequest",
-       sizeof(AiExplorationRequest),
-       -1,
-       {
-               {"`next", NULL, &((AiExplorationRequest*)0)->Next, NULL},
-               {"gamecycle", &IOInt, &((AiExplorationRequest*)0)->Mask, NULL},
-               {"map-x", &IOInt, &((AiExplorationRequest*)0)->X, NULL},
-               {"map-y", &IOInt, &((AiExplorationRequest*)0)->Y, NULL},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the AiRunningScript structure
-static IOStructDef AiRunningScriptStructDef = {
-       "AiRunningScript",
-       sizeof(AiRunningScript),
-       AI_MAX_RUNNING_SCRIPTS,
-       {
-               {"script", &IOCcl, &((AiRunningScript*)0)->Script, NULL},
-               {"sleep-cycles", &IOInt, &((AiRunningScript*)0)->SleepCycles, 
NULL},
-               {"ident", &IOStrBuffer, &((AiRunningScript*)0)->Ident, (void*) 
10},
-               {"hotspot-x", &IOInt, &((AiRunningScript*)0)->HotSpotX, NULL},
-               {"hotspot-y", &IOInt, &((AiRunningScript*)0)->HotSpotY, NULL},
-               {"hotspot-ray", &IOInt, &((AiRunningScript*)0)->HotSpotRay, 
NULL},
-               {"own-force", &IOInt, &((AiRunningScript*)0)->OwnForce, NULL},
-               {"gauges", &IOIntArrayPtr, &((AiRunningScript*)0)->Gauges, 
(void*) GAUGE_NB},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the role flags
-static IOFlagDef AiRoleFlag[] = {
-       {"attack", AiForceRoleAttack}, {"defend", AiForceRoleDefend}, {0, 0}
-};
-
-/// Description of the populate flags
-static IOFlagDef AiPopulateFlag[] = {
-       {"dont-populate", AiForceDontPopulate}, {"from-scratch", 
AiForcePopulateFromScratch},
-       {"from-attack", AiForcePopulateFromAttack}, {"any", 
AiForcePopulateAny}, {0, 0}
-};
-
-/// Description of the help flags
-static IOFlagDef AiHelpFlag[] = {
-       {"no-help", AiForceDontHelp}, {"force-help", AiForceHelpForce},
-       {"full-help", AiForceHelpFull}, {0, 0}
-};
-
-/// Description of the AiUnitType structure
-static IOStructDef AiUnitTypeStructDef = {
-       "AiUnitType",
-       sizeof(AiUnitType),
-       -1,
-       {
-               {"'next", 0, &((AiUnitType*)0)->Next, 0},
-               {"type", &IOUnitTypePtr, &((AiUnitType*)0)->Type, 0},
-               {"want", &IOInt, &((AiUnitType*)0)->Want, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the AiUnit structure
-static IOStructDef AiUnitStructDef = {
-       "AiUnit",
-       sizeof(AiUnit),
-       -1,
-       {
-               {"'next", NULL, &((AiUnit*)0)->Next, 0},
-               {"unit", &IOUnitPtr, &((AiUnit*)0)->Unit, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the AiForce structure
-static IOStructDef AiForceStructDef = {
-       "AiForce",
-       sizeof(AiForce),
-       AI_MAX_FORCES,
-       {
-               {"completed", &IOCharBool, &((AiForce*)0)->Completed, 0},
-               {"attacking", &IOCharBool, &((AiForce*)0)->Attacking, 0},
-               {"role", &IOCharFlag, &((AiForce*)0)->Role, &AiRoleFlag},
-               {"populate-mode", &IOCharFlag, &((AiForce*)0)->PopulateMode, 
&AiPopulateFlag},
-               {"units-reusable", &IOCharBool, &((AiForce*)0)->UnitsReusable, 
0},
-               {"help-mode", &IOCharFlag, &((AiForce*)0)->HelpMode, 
&AiHelpFlag},
-               {"unit-wants", &IOLinkedList, &((AiForce*)0)->UnitTypes, 
&AiUnitTypeStructDef},
-               {"unit-presents", &IOLinkedList, &((AiForce*)0)->Units, 
&AiUnitStructDef},
-               {"attack-state", &IOInt, &((AiForce*)0)->State, 0},
-               {"attack-goal-x", &IOInt, &((AiForce*)0)->GoalX, 0},
-               {"attack-goal-y", &IOInt, &((AiForce*)0)->GoalY, 0},
-               {"must-transport", &IOBool, &((AiForce*)0)->MustTransport, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the AiBuildQueue structure/linked list
-static IOStructDef AiBuildQueueStructDef = {
-       "AiBuildQueue",
-       sizeof(AiBuildQueue),
-       -1,
-       {
-               {"`next", 0, &((AiBuildQueue*)0)->Next, 0},
-               {"want", &IOInt, &((AiBuildQueue*)0)->Want, 0},
-               {"made", &IOInt, &((AiBuildQueue*)0)->Made, 0},
-               {"type", &IOUnitTypePtr, &((AiBuildQueue*)0)->Type, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the AiUnitTypeTable table in PlayerAi
-static IOStructDef AiUnitTypeTableStructDef = {
-       "AiUnitTypeTable",
-       sizeof(AiUnitTypeTable),
-       -1,
-       {
-               {"unittype", &IOUnitTypePtr, &((AiUnitTypeTable*)0)->Table, 0},
-               {"count", &IOInt, &((AiUnitTypeTable*)0)->Count, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-
-/// Description of the UnitTypeRequests table in PlayerAi
-static IOStructDef UnitTypeRequestsTableDef = {
-       "UnitTypeRequests",
-       sizeof(AiUnitTypeTable),
-       -1,
-       {
-               {"`ptr", 0, &((PlayerAi*)0)->UnitTypeRequests, 0},
-               {"`count", 0, &((PlayerAi*)0)->UnitTypeRequestsCount, 0},
-               {"`items", &IOStruct, 0, &AiUnitTypeTableStructDef},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the UpgradeToRequests table in PlayerAi
-static IOStructDef UpgradeToRequestsTableDef = {
-       "UpgradeToRequests",
-       sizeof(UnitType*),
-       -1,
-       {
-               {"`ptr", 0, &((PlayerAi*)0)->UpgradeToRequests, 0},
-               {"`count", 0, &((PlayerAi*)0)->UpgradeToRequestsCount, 0},
-               {"`items", &IOUnitTypePtr, 0, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the ResearchRequests table in PlayerAi
-static IOStructDef ResearchRequestsTableDef = {
-       "ResearchRequests",
-       sizeof(Upgrade*),
-       -1,
-       {
-               {"`ptr", 0, &((PlayerAi*)0)->ResearchRequests, 0},
-               {"`count", 0, &((PlayerAi*)0)->ResearchRequestsCount, 0},
-               {"`items", &IOUpgradePtr, 0, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the PlayerAi structure
-static IOStructDef PlayerAiStructDef = {
-       "PlayerAi",
-       sizeof(PlayerAi),
-       -1,
-       {
-               {"player", &IOPlayerPtr, &((PlayerAi*)0)->Player, 0},
-               {"ai-type", &IOAiTypePtr, &((PlayerAi*)0)->AiType, 0},
-               {"scripts", &IOStructArray, &((PlayerAi*)0)->Scripts, 
&AiRunningScriptStructDef},
-               {"past-evaluations", &IOLinkedList, 
&((PlayerAi*)0)->FirstEvaluation, &AiActionEvaluationStructDef},
-               {"debug", &IOBool, &((PlayerAi*)0)->ScriptDebug, 0},
-               {"auto-attack", &IOBool, &((PlayerAi*)0)->AutoAttack, 0},
-               {"forces", &IOStructArray, &((PlayerAi*)0)->Force, 
&AiForceStructDef},
-               {"reserve", &IORessourceArray, &((PlayerAi*)0)->Reserve, 0},
-               {"used", &IORessourceArray, &((PlayerAi*)0)->Used, 0},
-               {"needed", &IORessourceArray, &((PlayerAi*)0)->Needed, 0},
-               {"collect", &IORessourceArray, &((PlayerAi*)0)->Collect, 0},
-               {"neededmask", &IORessourceMask, &((PlayerAi*)0)->Reserve, 0},
-               {"need-supply", &IOBool, &((PlayerAi*)0)->NeedSupply, 0},
-               {"exploration-requests", &IOLinkedList, 
&((PlayerAi*)0)->FirstExplorationRequest, &AiExplorationRequestStructDef},
-               {"last-exploration", &IOInt, 
&((PlayerAi*)0)->LastExplorationGameCycle, 0},
-               {"unit-type-requests", &IOTable, 0, &UnitTypeRequestsTableDef},
-               {"upgrade-to-requests", &IOTable, 0, 
&UpgradeToRequestsTableDef},
-               {"research-requests", &IOTable, 0, &ResearchRequestsTableDef},
-               {"unit-type-builded", &IOLinkedList, 
&((PlayerAi*)0)->UnitTypeBuilded, &AiBuildQueueStructDef},
-               {"last-repair-building", &IOInt, 
&((PlayerAi*)0)->LastRepairBuilding, 0},
-               {"tried-repair-worker", &IOIntArray, 
&((PlayerAi*)0)->TriedRepairWorkers, (void*)UnitMax},
-               {0, 0, 0, 0}
-       }
-};
-
-/// Description of the PlayerAi structure
-static IOStructDef AiTypeStructDef = {
-       "AiType",
-       sizeof(AiType),
-       -1,
-       {
-               {"name", &IOString, &((AiType*)0)->Name, 0},
-               {"race", &IOString, &((AiType*)0)->Race, 0},
-               {"class", &IOString, &((AiType*)0)->Class, 0},
-               {"script", &IOCcl, &((AiType*)0)->Script, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-static IOStructDef AiScriptActionStructDef = {
-       "AiScriptAction",
-       sizeof(AiScriptAction),
-       -1,
-       {
-               {"action", &IOCcl, &((AiScriptAction*)0)->Action, 0},
-               {"defensive", &IOBool, &((AiScriptAction*)0)->Defensive, 0},
-               {"offensive", &IOBool, &((AiScriptAction*)0)->Offensive, 0},
-               {0, 0, 0, 0}
-       }
-};
-
-
-/*----------------------------------------------------------------------------
--- Functions
-----------------------------------------------------------------------------*/
-
-/**
-**  Handle saving/loading a reference to an AiType ( AiType* ).
-**  The null case is handled.
-**
-**  @param scmform     When loading, the scm data to load
-**  @param binaryform  Pointer to the unit'ref ( AiType** )
-**  @param para        unused
-*/
-local void IOAiTypePtr(SCM from, void* binaryform, void* para)
-{
-       char buffer[512];
-       char* str;
-       AiType* cur;
-
-       if (IOHandleNullPtr(from, binaryform)) {
-               return;
-       }
-       if (IOLoadingMode) {
-               str = gh_scm2newstr(from, 0);
-               cur = AiTypes;
-               while (cur) {
-                       snprintf(buffer, 512, "%s-%s-%s", cur->Name, cur->Race, 
cur->Class);
-                       if (!strcmp(str, buffer)) {
-                               *((AiType**)binaryform) = cur;
-                               return;
-                       }
-                       cur = cur->Next;
-               }
-               errl("unknown aitype ", from);
-       } else {
-               cur = *((AiType**)binaryform);
-
-               snprintf(buffer, 512, "%s-%s-%s", cur->Name, cur->Race, 
cur->Class);
-               CLprintf(IOOutFile, " \"%s\"", buffer);
-       }
-}
-
-
-/**
-**  Handle saving/loading a reference to an AiScriptAction.
-**  The null case is handled.
-**
-**  @param scmform     When loading, the scm data to load
-**  @param binaryform  Pointer to the unit'ref ( AiScriptAction** )
-**  @param para        unused
-*/
-local void IOAiScriptActionPtr(SCM scmfrom, void* binaryform, void* para)
-{
-       int slot;
-       AiScriptAction* a;
-       if (IOHandleNullPtr(scmfrom, binaryform)) {
-               return;
-       }
-       if (IOLoadingMode) {
-               slot = gh_scm2int(scmfrom);
-               *((AiScriptAction**)binaryform) = AiScriptActions + slot;
-       } else {
-               a = *((AiScriptAction**)binaryform);
-               CLprintf(IOOutFile, " %d", a - AiScriptActions);
-       }
-}
-
-/**
-** Handle loading an array of int for each ressource ( int[MAX_COSTS] )
-**
-**  @param scmfrom     FIXME: docu
-**  @param binaryform  FIXME: docu
-**  @param para        FIXME: docu
-*/
-local void IORessourceArray(SCM scmfrom, void* binaryform, void* para)
-{
-       IOIntArray(scmfrom, binaryform, (void*)MaxCosts);
-}
-
-/// Handle loading a mask for each ressource ( int[MAX_COSTS] )
-local void IORessourceMask(SCM scmfrom, void* binaryform, void* para)
-{
-       int tmp[MaxCosts];
-       int mask;
-       int i;
-
-       if (IOLoadingMode) {
-               IOIntArray(scmfrom, tmp, (void*)MaxCosts);
-
-               mask = 0;
-               for (i = 0; i < MaxCosts; ++i) {
-                       if (tmp[i]) {
-                               mask |= (1 << i);
-                       }
-               }
-
-               *(int*)binaryform = mask;
-       } else {
-               mask = *(int*)binaryform;
-               for (i = 0; i < MaxCosts; ++i) {
-                       if (mask & (1 << i)) {
-                               tmp[i] = 1;
-                       } else {
-                               tmp[i] = 0;
-                       }
-               }
-
-               IOIntArray(scmfrom, tmp, (void*)MaxCosts);
-       }
-}
-
-/**
-**  Handle saving/loading a full PlayerAi structure.
-**  The structure is allocated on the heap, filled from ccl, then completed.
-**
-**  @param scmform     When loading, the scm data to load
-**  @param binaryform  Pointer to the PlayerAi'ref ( PlayerAi** )
-**  @param para        unused
-*/
-global void IOPlayerAiFullPtr(SCM form, void* binaryform, void* para)
-{
-       AiActionEvaluation* aa;
-       PlayerAi** playerAi = (PlayerAi**)binaryform;
-
-       IOStructPtr(form, binaryform, &PlayerAiStructDef);
-       if (IOLoadingMode && (*playerAi)) {
-               // Finalize the playerAi struct !
-               // => last evaluation, evaluation count
-               aa = (*playerAi)->FirstEvaluation;
-               while (aa) {
-                       (*playerAi)->LastEvaluation = aa;
-                       (*playerAi)->EvaluationCount++;
-                       aa = aa->Next;
-               }
-       }
-}
-/**
-**  FIXME: docu
-**
-**  @param scmform     When loading, the scm data to load
-**  @param binaryform  Pointer to the PlayerAi'ref ( PlayerAi** )
-**  @param para        unused
-*/
-global void IOAiTypeFullPtr(SCM form, void* binaryform, void* para)
-{
-       AiType** aiType = (AiType**)binaryform;
-       IOStructPtr(form, binaryform, &AiTypeStructDef);
-       if (IOLoadingMode && (*aiType)) {
-               // Append the ai_type...
-               (*aiType)->Next = AiTypes;
-               AiTypes = (*aiType);
-       }
-}
-
-/**
-**  FIXME: docu
-**
-**  @param scmform     When loading, the scm data to load
-**  @param binaryform  Pointer to the PlayerAi'ref ( PlayerAi** )
-**  @param para        unused
-*/
-global void IOAiScriptActionFull(SCM form, void* binaryform, void* para)
-{
-       /*AiScriptAction* asa = (AiScriptAction*)binaryform; */
-       IOStruct(form, binaryform, &AiScriptActionStructDef);
-}
-
-
-#define INCOMPLETE_SIOD 1
-
-#ifdef INCOMPLETE_SIOD
-
-/**
-**  FIXME: docu
-**
-**  @param a  FIXME: docu
-**  @param b  FIXME: docu
-**
-**  @return   FIXME: docu
-*/
-local SCM CclQuotient(SCM a, SCM b)
-{
-       int va, vb;
-       va = gh_scm2int(a);
-       vb = gh_scm2int(b);
-       if (vb == 0) {
-               errl("CclQuotient division by zero", b);
-       }
-       return gh_int2scm(va / vb);
-}
-
-/**
-**  FIXME: docu
-**
-**  @param x  FIXME: docu
-**
-**  @return   FIXME: docu
-*/
-local SCM CclOutput(SCM x)
-{
-       if (gh_null_p(x)) {
-               printf(" '()");
-               return SCM_BOOL_T;
-       }
-       if (gh_list_p(x)) {
-               printf(" (");
-               while (!gh_null_p(x)) {
-                       CclOutput(gh_car(x));
-                       x = gh_cdr(x);
-               }
-               printf(" )");
-               return SCM_BOOL_T;
-       }
-       printf(" ");
-       gh_display(x);
-       return x;
-}
-
-#endif
-#elif defined(USE_LUA)
-#endif
-
-
 /**
 **  Setup AI helper table.
 **
@@ -604,148 +129,6 @@
 **
 **  @todo  FIXME: the first unit could be a list see ../doc/ccl/ai.html
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineAiHelper(SCM list)
-{
-       SCM sub_list;
-       SCM value;
-       int what;
-       char* str;
-       UnitType* base;
-       UnitType* type;
-       Upgrade* upgrade;
-       int cost;
-
-#ifdef DEBUG
-       type = NULL;
-       upgrade = NULL;
-       cost = 0;
-#endif
-       while (!gh_null_p(list)) {
-               sub_list = gh_car(list);
-               list = gh_cdr(list);
-
-               //
-               // Type build,train,research/upgrade.
-               //
-               value = gh_car(sub_list);
-               sub_list = gh_cdr(sub_list);
-               if (gh_eq_p(value, gh_symbol2scm("build"))) {
-                       what = 0;
-               } else if (gh_eq_p(value, gh_symbol2scm("train"))) {
-                       what = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("upgrade"))) {
-                       what = 2;
-               } else if (gh_eq_p(value, gh_symbol2scm("research"))) {
-                       what = 3;
-               } else if (gh_eq_p(value, gh_symbol2scm("unit-limit"))) {
-                       what = 4;
-               } else if (gh_eq_p(value, gh_symbol2scm("unit-equiv"))) {
-                       what = 5;
-               } else if (gh_eq_p(value, gh_symbol2scm("repair"))) {
-                       what = 6;
-               } else {
-                       fprintf(stderr, "unknown tag\n");
-                       continue;
-               }
-
-               //
-               // Get the base unit type, which could handle the action.
-               //
-               value = gh_car(sub_list);
-               sub_list = gh_cdr(sub_list);
-
-               // FIXME: support value as list!
-               str = gh_scm2newstr(value, NULL);
-               base = UnitTypeByIdent(str);
-               if (!base) {
-                       fprintf(stderr, "unknown unittype %s\n", str);
-                       free(str);
-                       continue;
-               }
-               DebugLevel3Fn("%s\n" _C_ base->Name);
-               free(str);
-
-               //
-               // Get the unit types, which could be produced
-               //
-               while (!gh_null_p(sub_list)) {
-                       value = gh_car(sub_list);
-                       sub_list = gh_cdr(sub_list);
-                       str = gh_scm2newstr(value, NULL);
-                       if (what == 3) {
-                               upgrade = UpgradeByIdent(str);
-                               if (!upgrade) {
-                                       fprintf(stderr, "unknown upgrade %s\n", 
str);
-                                       free(str);
-                                       continue;
-                               }
-                               DebugLevel3Fn("> %s\n" _C_ upgrade->Ident);
-                       } else if (what == 4) {
-                               if (!strcmp("food", str)) {
-                                       cost = 0;
-                               } else {
-                                       fprintf(stderr, "unknown limit %s\n", 
str);
-                                       free(str);
-                                       continue;
-                               }
-                               DebugLevel3Fn("> %s\n" _C_ str);
-                       } else {
-                               type = UnitTypeByIdent(str);
-                               if (!type) {
-                                       fprintf(stderr, "unknown unittype 
%s\n", str);
-                                       free(str);
-                                       continue;
-                               }
-                               DebugLevel3Fn("> %s\n" _C_ type->Name);
-                       }
-                       free(str);
-
-                       switch (what) {
-                               case 0: // build
-                                       
AiHelperSetupTable(&AiHelpers.BuildCount, &AiHelpers.Build,
-                                               type->Type);
-                                       AiHelperInsert(AiHelpers.Build + 
type->Type, base);
-                                       break;
-                               case 1: // train
-                                       
AiHelperSetupTable(&AiHelpers.TrainCount, &AiHelpers.Train,
-                                               type->Type);
-                                       AiHelperInsert(AiHelpers.Train + 
type->Type, base);
-                                       break;
-                               case 2: // upgrade
-                                       
AiHelperSetupTable(&AiHelpers.UpgradeCount, &AiHelpers.Upgrade,
-                                               type->Type);
-                                       AiHelperInsert(AiHelpers.Upgrade + 
type->Type, base);
-                                       break;
-                               case 3: // research
-                                       
AiHelperSetupTable(&AiHelpers.ResearchCount, &AiHelpers.Research,
-                                               upgrade - Upgrades);
-                                       AiHelperInsert(AiHelpers.Research + 
(upgrade - Upgrades), base);
-                                       break;
-                               case 4: // unit-limit
-                                       
AiHelperSetupTable(&AiHelpers.UnitLimitCount, &AiHelpers.UnitLimit,
-                                               cost);
-                                       AiHelperInsert(AiHelpers.UnitLimit + 
cost, base);
-                                       break;
-                               case 5: // equivalence
-                                       
AiHelperSetupTable(&AiHelpers.EquivCount, &AiHelpers.Equiv,
-                                               base->Type);
-                                       AiHelperInsert(AiHelpers.Equiv + 
base->Type, type);
-
-                                       AiNewUnitTypeEquiv(base, type);
-                                       break;
-                               case 6: // repair
-                                       
AiHelperSetupTable(&AiHelpers.RepairCount, &AiHelpers.Repair,
-                                               type->Type);
-                                       AiHelperInsert(AiHelpers.Repair + 
type->Type, base);
-                                       break;
-                       }
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 /**
 **  FIXME: docu
 **
@@ -898,217 +281,36 @@
 
        return 0;
 }
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  FIXME: docu
-**
-**  @param type        FIXME: docu
-**  @param definition  FIXME: docu
-**
-**  @return            FIXME: docu
-*/
-local SCM CclDefineAiAction(SCM type, SCM definition)
-{
-       AiScriptAction* aiScriptAction;
-
-       aiScriptAction = AiScriptActions + AiScriptActionNum;
-       ++AiScriptActionNum;
-
-       memset(aiScriptAction, 0, sizeof(AiScriptAction));
-
-       aiScriptAction->Action = definition;
-       CclGcProtect(&aiScriptAction->Action);
-
-       while (!gh_null_p(type)) {
-               if (gh_eq_p(gh_car(type), gh_symbol2scm("defense"))) {
-                       aiScriptAction->Defensive = 1;
-               } else if (gh_eq_p(gh_car(type), gh_symbol2scm("attack"))) {
-                       aiScriptAction->Offensive = 1;
-               } else {
-                       errl("Unsupported ai action type", gh_car(type));
-               }
-               type = gh_cdr(type);
-       }
 
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 /**
-**  FIXME: docu
+**  Define an AI engine.
 **
 **  @param l  FIXME: docu
 **
 **  @return   FIXME: docu
 */
-local int CclDefineAiAction(lua_State* l)
+local int CclDefineAi(lua_State* l)
 {
-       AiScriptAction* aiScriptAction;
        const char* value;
-       int args;
-       int j;
+       AiType* aitype;
+#ifdef DEBUG
+       const AiType* ait;
+#endif
 
-       if (lua_gettop(l) != 2 || !lua_istable(l, 1) || !lua_istable(l, 2)) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       aiScriptAction = AiScriptActions + AiScriptActionNum;
-       ++AiScriptActionNum;
+    if (lua_gettop(l) != 4 || !lua_isfunction(l, 4)) {
+       lua_pushstring(l, "incorrect argument");
+       lua_error(l);
+    }
 
-       memset(aiScriptAction, 0, sizeof(AiScriptAction));
+       aitype = malloc(sizeof(AiType));
+       aitype->Next = AiTypes;
+       AiTypes = aitype;
 
-       aiScriptAction->Action = malloc(20);
-       sprintf(aiScriptAction->Action, "_ai_action_%d_", AiScriptActionNum - 
1);
-       lua_pushstring(l, aiScriptAction->Action);
-       lua_pushvalue(l, 2);
-       lua_settable(l, LUA_GLOBALSINDEX);
-
-       lua_pushstring(l, "_ai_scripts_");
-       lua_gettable(l, LUA_GLOBALSINDEX);
-       if (lua_isnil(l, -1)) {
-               lua_pop(l, 1);
-               lua_pushstring(l, "_ai_scripts_");
-               lua_newtable(l);
-               lua_settable(l, LUA_GLOBALSINDEX);
-               lua_pushstring(l, "_ai_scripts_");
-               lua_gettable(l, LUA_GLOBALSINDEX);
-       }
-       lua_pushstring(l, "Script");
-       lua_rawget(l, 2);
-       if (!lua_istable(l, -1)) {
-               lua_error(l);
-       }
-       aiScriptAction->Script = malloc(20);
-       sprintf(aiScriptAction->Script, "_ai_script_%d_", AiScriptActionNum - 
1);
-       lua_pushstring(l, aiScriptAction->Script);
-       lua_rawgeti(l, -2, 3);
-       lua_rawset(l, -4);
-       lua_pop(l, 2);
-
-       args = luaL_getn(l, 1);
-       for (j = 0; j < args; ++j) {
-               lua_rawgeti(l, 1, j + 1);
-               value = LuaToString(l, -1);
-               lua_pop(l, 1);
-               if (!strcmp(value, "defense")) {
-                       aiScriptAction->Defensive = 1;
-               } else if (!strcmp(value, "attack")) {
-                       aiScriptAction->Offensive = 1;
-               } else {
-                       lua_pushfstring(l, "Unsupported ai action type: %s", 
value);
-                       lua_error(l);
-               }
-       }
-
-       return 0;
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Define an AI engine.
-**
-**  @param list  FIXME: docu
-**
-**  @return      FIXME: docu
-*/
-local SCM CclDefineAi(SCM list)
-{
-       SCM value;
-       char* str;
-       AiType* aitype;
-#ifdef DEBUG
-       const AiType* ait;
-#endif
-
-       aitype = malloc(sizeof(AiType));
-       aitype->Next = AiTypes;
-       AiTypes = aitype;
-
-       //
-       // AI Name
-       //
-       value = gh_car(list);
-       list = gh_cdr(list);
-       str = gh_scm2newstr(value, NULL);
-       DebugLevel3Fn("%s\n" _C_ str);
-       aitype->Name = str;
-
-#ifdef DEBUG
-       for (ait = AiTypes->Next; ait; ait = ait->Next) {
-               if (!strcmp(aitype->Name, ait->Name)) {
-                       DebugLevel0Fn("Warning two or more AI's with the same 
name '%s'\n" _C_ ait->
-                               Name);
-               }
-       }
-#endif
-
-       //
-       // AI Race
-       //
-       value = gh_car(list);
-       list = gh_cdr(list);
-       str = gh_scm2newstr(value, NULL);
-       DebugLevel3Fn("%s\n" _C_ str);
-       if (*str != '*') {
-               aitype->Race = str;
-       } else {
-               aitype->Race = NULL;
-               free(str);
-       }
-
-       //
-       // AI Class
-       //
-       value = gh_car(list);
-       list = gh_cdr(list);
-       str = gh_scm2newstr(value, NULL);
-       DebugLevel3Fn("%s\n" _C_ str);
-       aitype->Class = str;
-
-       //
-       // AI Script
-       //
-       value = gh_car(list);
-       list = gh_cdr(list);
-       aitype->Script = value;
-
-       // Protect the scheme script against GC garbage-collect.
-       CclGcProtect(&aitype->Script);
-
-       return list;
-}
-#elif defined(USE_LUA)
-/**
-**  Define an AI engine.
-**
-**  @param l  FIXME: docu
-**
-**  @return   FIXME: docu
-*/
-local int CclDefineAi(lua_State* l)
-{
-       const char* value;
-       AiType* aitype;
-#ifdef DEBUG
-       const AiType* ait;
-#endif
-
-    if (lua_gettop(l) != 4 || !lua_isfunction(l, 4)) {
-       lua_pushstring(l, "incorrect argument");
-       lua_error(l);
-    }
-
-       aitype = malloc(sizeof(AiType));
-       aitype->Next = AiTypes;
-       AiTypes = aitype;
-
-       //
-       // AI Name
-       //
-       aitype->Name = strdup(LuaToString(l, 1));
-       DebugLevel3Fn("%s\n" _C_ aitype->Name);
+       //
+       // AI Name
+       //
+       aitype->Name = strdup(LuaToString(l, 1));
+       DebugLevel3Fn("%s\n" _C_ aitype->Name);
 
 #ifdef DEBUG
        for (ait = AiTypes->Next; ait; ait = ait->Next) {
@@ -1161,19 +363,13 @@
 
        return 0;
 }
-#endif
 
 /*----------------------------------------------------------------------------
 --  AI script functions
 ----------------------------------------------------------------------------*/
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       /// Get unit-type.
-extern UnitType* CclGetUnitType(SCM ptr);
-#elif defined(USE_LUA)
        /// Get unit-type.
 extern UnitType* CclGetUnitType(lua_State* l);
-#endif
 
 /**
 **  Append unit-type to request table.
@@ -1280,15 +476,6 @@
 
 //----------------------------------------------------------------------------
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Get the race of the current AI player.
-*/
-local SCM CclAiGetRace(void)
-{
-       return gh_symbol2scm(AiPlayer->Player->RaceName);
-}
-#elif defined(USE_LUA)
 /**
 **  Get the race of the current AI player.
 **
@@ -1303,17 +490,7 @@
        lua_pushstring(l, AiPlayer->Player->RaceName);
        return 1;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Get the number of cycles to sleep.
-*/
-local SCM CclAiGetSleepCycles(void)
-{
-       return gh_int2scm(AiSleepCycles);
-}
-#elif defined(USE_LUA)
 /**
 **  Get the number of cycles to sleep.
 **
@@ -1330,26 +507,9 @@
        lua_pushnumber(l, AiSleepCycles);
        return 1;
 }
-#endif
 
 //----------------------------------------------------------------------------
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Set debuging flag of AI script.
-**
-**  @param flag  FIXME: docu
-*/
-local SCM CclAiDebug(SCM flag)
-{
-       if (gh_eq_p(flag, SCM_BOOL_F)) {
-               AiPlayer->ScriptDebug = 0;
-       } else {
-               AiPlayer->ScriptDebug = 1;
-       }
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 /**
 **  Set debugging flag of AI script
 **
@@ -1371,54 +531,7 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Activate AI debugging for the given player(s)
-**  Player can be a number for a specific player
-**    "self" for current human player (ai me)
-**    "none" to disable
-**
-**  @param list  The list of player to activate
-**
-**  @return      FIXME: docu
-*/
-local SCM CclAiDebugPlayer(SCM list)
-{
-       SCM item;
-       int playerid;
-
-       while (!gh_null_p(list)) {
-               item = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(item, gh_symbol2scm("none"))) {
-                       for (playerid = 0; playerid < NumPlayers; ++playerid) {
-                               if (!Players[playerid].AiEnabled || 
!Players[playerid].Ai) {
-                                       continue;
-                               }
-                               ((PlayerAi*)Players[playerid].Ai)->ScriptDebug 
= 0;
-                       }
-               } else {
-                       if (gh_eq_p(item, gh_symbol2scm("self"))) {
-                               if (!ThisPlayer) {
-                                       continue;
-                               }
-                               playerid = ThisPlayer->Player;
-                       } else {
-                               playerid = gh_scm2int(item);
-                       }
 
-                       if (!Players[playerid].AiEnabled || 
!Players[playerid].Ai) {
-                               continue;
-                       }
-                       ((PlayerAi*)Players[playerid].Ai)->ScriptDebug = 1;
-               }
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 /**
 **  Activate AI debugging for the given player(s)
 **  Player can be a number for a specific player
@@ -1469,21 +582,7 @@
        }
        return 0;
 }
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Need an unit.
-**
-**  @param value  Unit-type as string/symbol/object.
-*/
-local SCM CclAiNeed(SCM value)
-{
-       InsertUnitTypeRequests(CclGetUnitType(value), 1);
 
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 /**
 **  Need an unit.
 **
@@ -1502,33 +601,7 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Set the number of units.
-**
-**  @param value  Unit-type as string/symbol/object.
-**  @param count  Number of unit-types requested.
-**
-**  @todo         FIXME: count==0 should remove the request.
-*/
-local SCM CclAiSet(SCM value, SCM count)
-{
-       AiUnitTypeTable* autt;
-       UnitType* type;
 
-       type = CclGetUnitType(value);
-       if ((autt = FindInUnitTypeRequests(type))) {
-               autt->Count = gh_scm2int(count);
-               // FIXME: 0 should remove it.
-       } else {
-               InsertUnitTypeRequests(type, gh_scm2int(count));
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 /**
 **  Set the number of units.
 **
@@ -1558,73 +631,7 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Wait for an unit.
-**
-**  @param value  Unit-type as string/symbol/object.
-**
-**  @return       FIXME: docu
-*/
-local SCM CclAiWait(SCM value)
-{
-       const AiUnitTypeTable* autt;
-       const UnitType* type;
-       const int* unit_types_count;
-       int j;
-       int n;
-
-       type = CclGetUnitType(value);
-       unit_types_count = AiPlayer->Player->UnitTypesCount;
-       if (!(autt = FindInUnitTypeRequests(type))) {
-               //
-               // Look if we have this unit-type.
-               //
-               if (unit_types_count[type->Type]) {
-                       return SCM_BOOL_F;
-               }
-
-               //
-               // Look if we have equivalent unit-types.
-               //
-               if (type->Type < AiHelpers.EquivCount && 
AiHelpers.Equiv[type->Type]) {
-                       DebugLevel3Fn("Equivalence for %s\n" _C_ type->Ident);
-                       for (j = 0; j < AiHelpers.Equiv[type->Type]->Count; 
++j) {
-                               if 
(unit_types_count[AiHelpers.Equiv[type->Type]->Table[j]->Type]) {
-                                       return SCM_BOOL_F;
-                               }
-                       }
-               }
-               //
-               // Look if we have an upgrade-to request.
-               //
-               if (FindInUpgradeToRequests(type)) {
-                       return SCM_BOOL_T;
-               }
-               DebugLevel0Fn("Broken? waiting on %s which wasn't requested.\n" 
_C_ type->Ident);
-               return SCM_BOOL_F;
-       }
-       //
-       // Add equivalent units
-       //
-       n = unit_types_count[type->Type];
-       if (type->Type < AiHelpers.EquivCount && AiHelpers.Equiv[type->Type]) {
-               for (j = 0; j < AiHelpers.Equiv[type->Type]->Count; ++j) {
-                       n += 
unit_types_count[AiHelpers.Equiv[type->Type]->Table[j]->Type];
-               }
-       }
-       // units available?
-       DebugLevel3Fn("%d,%d\n" _C_ n _C_ autt->Count);
-
-       if (n >= autt->Count) {
-               return SCM_BOOL_F;
-       }
 
-       return SCM_BOOL_T;
-}
-#elif defined(USE_LUA)
 /**
 **  Wait for an unit.
 **
@@ -1698,416 +705,13 @@
        lua_pushboolean(l, 1);
        return 1;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Give the number of the script specific force.
-**
-**  @return  FIXME: docu
-*/
-local SCM CclAiOwnForce(void)
-{
-       return gh_int2scm(AiScript->OwnForce);
-}
-#elif defined(USE_LUA)
 /**
-**  Give the number of the script specific force.
-**
-**  @param l  Lua State
+**  Define a force, a groups of units.
 **
-**  @return   Number of return values
+**  @param list  Pairs of unit-types and counts.
 */
-local int CclAiOwnForce(lua_State* l)
-{
-       if (lua_gettop(l) != 0) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       lua_pushnumber(l, AiScript->OwnForce);
-       return 1;
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/**
-**  Free a force ( requirements and current units )
-**
-**  @param s_force  Force to free.
-**
-**  @return         FIXME: docu
-*/
-local SCM CclAiClearForce(SCM s_force)
-{
-       int force;
-
-       force = gh_scm2int(s_force);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", s_force);
-       }
-
-       AiEraseForce(force);
-       return SCM_BOOL_F;
-
-}
-#elif defined(USE_LUA)
-/**
-**  Free a force ( requirements and current units )
-**
-**  @param l  Lua State.
-**
-**  @return   Number of return values
-*/
-local int CclAiClearForce(lua_State* l)
-{
-       int force;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range: %d", force);
-               lua_error(l);
-       }
-
-       AiEraseForce(force);
-       lua_pushboolean(l, 0);
-       return 1;
-
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiGetForce(SCM list)
-{
-       int force;
-       SCM rslt;
-       AiUnitType* aiut;
-
-       force = gh_scm2int(list);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", list);
-       }
-       rslt = SCM_UNSPECIFIED;
-       aiut = AiPlayer->Force[force].UnitTypes;
-       while (aiut) {
-               rslt =
-                       cons(gh_symbol2scm(aiut->Type->Ident), 
cons(gh_int2scm(aiut->Want), rslt));
-               aiut = aiut->Next;
-       }
-       CclOutput(rslt);
-       return rslt;
-}
-#elif defined(USE_LUA)
-local int CclAiGetForce(lua_State* l)
-{
-       int force;
-       AiUnitType* aiut;
-       int i;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range: %d", force);
-               lua_error(l);
-       }
-       lua_newtable(l);
-       i = 0;
-       aiut = AiPlayer->Force[force].UnitTypes;
-       while (aiut) {
-               lua_pushstring(l, aiut->Type->Ident);
-               lua_rawseti(l, -1, i + 1);
-               ++i;
-               lua_pushnumber(l, aiut->Want);
-               lua_rawseti(l, -1, i + 1);
-               ++i;
-               aiut = aiut->Next;
-       }
-#if 0
-       CclOutput(rslt);
-#endif
-       return 1;
-}
-#endif
-
-/**
-**  Return true if a force has no unit, fase otherwise.
-**
-**
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiForceEmpty(SCM list)
-{
-       int force;
-
-       force = gh_scm2int(list);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", list);
-       }
-
-       if (AiPlayer->Force[force].Units) {
-               return SCM_BOOL_F;
-       } else {
-               return SCM_BOOL_T;
-       }
-}
-#elif defined(USE_LUA)
-local int CclAiForceEmpty(lua_State* l)
-{
-       int force;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range: %d", force);
-               lua_error(l);
-       }
-
-       if (AiPlayer->Force[force].Units) {
-               lua_pushboolean(l, 0);
-               return 1;
-       } else {
-               lua_pushboolean(l, 1);
-               return 1;
-       }
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiAdHocForce(SCM requirement, SCM scm_unittypes)
-{
-       int want[3];
-       int* unittypes;
-       int unittypecount;
-       UnitType* unittype;
-       char* str;
-       int i;
-       int rslt;
-
-       for (i = 0; i < 3; ++i) {
-               want[i] = gh_scm2int(gh_car(requirement));
-               requirement = gh_cdr(requirement);
-       }
-
-       unittypecount = gh_length(scm_unittypes);
-       if (unittypecount) {
-               unittypes = (int*)malloc(sizeof(int) * unittypecount);
-
-               for (i = 0; i < unittypecount; ++i) {
-                       str = gh_scm2newstr(gh_car(scm_unittypes), NULL);
-                       scm_unittypes = gh_cdr(scm_unittypes);
-
-                       unittype = UnitTypeByIdent(str);
-                       if (!unittype) {
-                               fprintf(stderr, "unknown unittype %s\n", str);
-                               free(str);
-                               --i;
-                               --unittypecount;
-                               continue;
-                       }
-                       free(str);
-
-                       unittypes[i] = unittype->Type;
-               }
-       } else {
-               unittypes = 0;
-       }
-       rslt = AiCreateSpecificForce(want, unittypes, unittypecount);
-       if (unittypes) {
-               free(unittypes);
-       }
-
-       if (rslt != -1) {
-               return SCM_BOOL_T;
-       } else {
-               return SCM_BOOL_F;
-       }
-}
-#elif defined(USE_LUA)
-local int CclAiAdHocForce(lua_State* l)
-{
-       int want[3];
-       int* unittypes;
-       int unittypecount;
-       UnitType* unittype;
-       const char* str;
-       int i;
-       int rslt;
-
-       if (lua_gettop(l) != 2 || !lua_istable(l, 1) || luaL_getn(l, 1) != 3) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       for (i = 0; i < 3; ++i) {
-               lua_rawgeti(l, 1, i + 1);
-               want[i] = LuaToNumber(l, -1);
-               lua_pop(l, 1);
-       }
-
-       unittypecount = luaL_getn(l, 2);
-       if (unittypecount) {
-               unittypes = (int*)malloc(sizeof(int) * unittypecount);
-
-               for (i = 0; i < unittypecount; ++i) {
-                       lua_rawgeti(l, 2, i + 1);
-                       str = LuaToString(l, -1);
-                       lua_pop(l, 1);
-
-                       unittype = UnitTypeByIdent(str);
-                       if (!unittype) {
-                               lua_pushfstring(l, "unknown unittype: %s", str);
-                               lua_error(l);
-                       }
-
-                       unittypes[i] = unittype->Type;
-               }
-       } else {
-               unittypes = 0;
-       }
-       rslt = AiCreateSpecificForce(want, unittypes, unittypecount);
-       if (unittypes) {
-               free(unittypes);
-       }
-
-       if (rslt != -1) {
-               lua_pushboolean(l, 1);
-               return 1;
-       } else {
-               lua_pushboolean(l, 0);
-               return 1;
-       }
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiForceActive(SCM list)
-{
-       int force;
-       AiUnit* unit;
-
-       force = gh_scm2int(list);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", list);
-       }
-
-       unit = AiPlayer->Force[force].Units;
-       while (unit) {
-               if (!UnitIdle(unit->Unit)) {
-                       return SCM_BOOL_T;
-               }
-               unit = unit->Next;
-       }
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiForceActive(lua_State* l)
-{
-       int force;
-       AiUnit* unit;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range: %d", force);
-               lua_error(l);
-       }
-
-       unit = AiPlayer->Force[force].Units;
-       while (unit) {
-               if (!UnitIdle(unit->Unit)) {
-                       lua_pushboolean(l, 1);
-                       return 1;
-               }
-               unit = unit->Next;
-       }
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-/**
-**  Define a force, a groups of units.
-**  If force already exists, list is interpreted as a minimum...
-**
-**  @param list  Pairs of unit-types and counts.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiForce(SCM list)
-{
-       AiUnitType** prev;
-       AiUnitType* aiut;
-       UnitType* type;
-       int count;
-       int force;
-
-       force = gh_scm2int(gh_car(list));
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", gh_car(list));
-       }
-       list = gh_cdr(list);
-
-       while (!gh_null_p(list)) {
-               type = CclGetUnitType(gh_car(list));
-               list = gh_cdr(list);
-               count = gh_scm2int(gh_car(list));
-               list = gh_cdr(list);
-
-               if (!type) { // bulletproof
-                       continue;
-               }
-               if (!count) { // Don't care
-                       continue;
-               }
-
-               // Use the equivalent unittype.
-               type = UnitTypes[UnitTypeEquivs[type->Type]];
-
-               //
-               // Look if already in force.
-               //
-               for (prev = &AiPlayer->Force[force].UnitTypes; (aiut = *prev);
-                               prev = &aiut->Next) {
-                       if (UnitTypeEquivs[aiut->Type->Type] == type->Type) { 
// found
-                               if (aiut->Want < count) {
-                                       aiut->Want = count;
-                               }
-
-                               if (!aiut->Want) {
-                                       *prev = aiut->Next;
-                                       free(aiut);
-                               }
-                               break;
-                       }
-               }
-
-               //
-               // New type append it.
-               //
-               if (!aiut) {
-                       *prev = aiut = malloc(sizeof(*aiut));
-                       aiut->Next = NULL;
-                       aiut->Want = count;
-                       aiut->Type = type;
-               }
-       }
-
-       AiAssignFreeUnitsToForce();
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiForce(lua_State* l)
+local int CclAiForce(lua_State* l)
 {
        AiUnitType** prev;
        AiUnitType* aiut;
@@ -2117,446 +721,105 @@
        int args;
        int j;
 
-       if (lua_gettop(l) != 2 || !lua_istable(l, 2)) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range: %d", force);
-               lua_error(l);
-       }
-
-       args = luaL_getn(l, 2);
-       for (j = 0; j < args; ++j) {
-               lua_rawgeti(l, 2, j + 1);
-               type = CclGetUnitType(l);
-               lua_pop(l, 1);
-               ++j;
-               lua_rawgeti(l, 2, j + 1);
-               count = LuaToNumber(l, -1);
-               lua_pop(l, 1);
-
-               if (!type) { // bulletproof
-                       continue;
-               }
-               if (!count) { // Don't care
-                       continue;
-               }
-
-               // Use the equivalent unittype.
-               type = UnitTypes[UnitTypeEquivs[type->Type]];
-
-               //
-               // Look if already in force.
-               //
-               for (prev = &AiPlayer->Force[force].UnitTypes; (aiut = *prev);
-                               prev = &aiut->Next) {
-                       if (UnitTypeEquivs[aiut->Type->Type] == type->Type) { 
// found
-                               if (aiut->Want < count) {
-                                       aiut->Want = count;
-                               }
-
-                               if (!aiut->Want) {
-                                       *prev = aiut->Next;
-                                       free(aiut);
-                               }
-                               break;
-                       }
-               }
-
-               //
-               // New type append it.
-               //
-               if (!aiut) {
-                       *prev = aiut = malloc(sizeof(*aiut));
-                       aiut->Next = NULL;
-                       aiut->Want = count;
-                       aiut->Type = type;
-               }
-       }
-
-       AiAssignFreeUnitsToForce();
-
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiForceTransfer(SCM sourceForce, SCM destForce)
-{
-       int src;
-       int dst;
-
-       src = gh_scm2int(sourceForce);
-       dst = gh_scm2int(destForce);
-       AiForceTransfert(src, dst);
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiForceTransfer(lua_State* l)
-{
-       int src;
-       int dst;
-
-       if (lua_gettop(l) != 2) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       src = LuaToNumber(l, 1);
-       dst = LuaToNumber(l, 2);
-       AiForceTransfert(src, dst);
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-/**
-**  Wrapper of AiForceComplete.
-**  Complete a force with existing units.
-**
-**  @param destForce  the force to complete
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiForceComplete(SCM destForce)
-{
-       int dst;
-
-       dst = gh_scm2int(destForce);
-       AiForceComplete(dst);
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiForceComplete(lua_State* l)
-{
-       int dst;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       dst = LuaToNumber(l, 1);
-       AiForceComplete(dst);
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-/**
-**  Define the role of a force.
-**
-**  @param value  Force number.
-**  @param flag   Which role of the force.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiForceRole(SCM value, SCM flag)
-{
-       int force;
-
-       force = gh_scm2int(value);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", value);
-       }
-       if (gh_eq_p(flag, gh_symbol2scm("attack"))) {
-               AiPlayer->Force[force].Role = AiForceRoleAttack;
-       } else if (gh_eq_p(flag, gh_symbol2scm("defend"))) {
-               AiPlayer->Force[force].Role = AiForceRoleDefend;
-       } else {
-               errl("Unknown force role", flag);
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiForceRole(lua_State* l)
-{
-       int force;
-       const char* flag;
-
-       if (lua_gettop(l) != 2) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range", force);
-               lua_error(l);
-       }
-       flag = LuaToString(l, 2);
-       if (!strcmp(flag, "attack")) {
-               AiPlayer->Force[force].Role = AiForceRoleAttack;
-       } else if (!strcmp(flag, "defend")) {
-               AiPlayer->Force[force].Role = AiForceRoleDefend;
-       } else {
-               lua_pushfstring(l, "Unknown force role", flag);
-       }
-
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-/**
-**  Return wether a force is defending or not.
-**
-**  @param value  the force
-**
-**  @return       true if the force is defending, false otherwise
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiIsForceDefending(SCM value)
-{
-       int force;
-
-       force = gh_scm2int(value);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", value);
-       }
-
-       if (AiPlayer->Force[force].Role == AiForceRoleDefend) {
-               return SCM_BOOL_T;
-       }
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiIsForceDefending(lua_State* l)
-{
-       int force;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range: %d", force);
-               lua_error(l);
-       }
-
-       if (AiPlayer->Force[force].Role == AiForceRoleDefend) {
-               lua_pushboolean(l, 1);
-               return 1;
-       }
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-/**
-**  Check if the hotspot can be reached.
-**  The parameter describe which element we are travelling in.
-**
-**  @param way  air, ground or sea
-**  @return     true if the hotspot is reachable
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiCanReachHotSpot(SCM way)
-{
-#ifdef MAP_REGIONS
-       ZoneSet targets = {0};
-       ZoneSet sources = {0};
-       ZoneSet transportable = {0};
-       int i;
-       Unit* unit;
-       int transporterplace;
-       UnitType* transporter;
-       AiUnit* aiunit;
-
-       if ((AiScript->HotSpotX == -1) || (AiScript->HotSpotY == -1) ||
-                       (AiScript->HotSpotRay <= 0)) {
-               return SCM_BOOL_T;
-       }
-
-       ZoneSetClear(&sources);
-       transporter = 0;
-       transporterplace = 0;
-       for (i = 0; i < AiPlayer->Player->TotalNumUnits; ++i) {
-               unit = AiPlayer->Player->Units[i];
-
-               if (unit->Orders[0].Action == UnitActionDie) {
-                       continue;
-               }
-
-               if (unit->Removed) {
-                       continue;
-               }
-
-               if ((unit->X == -1) || (unit->Y == -1)) {
-                       continue;
-               }
-
-               if (unit->Type->UnitType == UnitTypeNaval && 
unit->Type->Transporter) {
-                       ZoneSetAddUnitZones(&sources, unit);
-                       if ((!transporter) || (transporter->MaxOnBoard < 
unit->Type->MaxOnBoard)) {
-                               transporter = unit->Type;
-                       }
-                       transporterplace += unit->Type->MaxOnBoard;
-               }
-       }
-       ZoneSetClear(&transportable);
-       // Add land connected to transporter
-       ZoneSetAddConnected(&transportable, &sources);
-       // Add water as well
-       ZoneSetAddSet(&transportable, &sources);
-
-
-       aiunit = AiPlayer->Force[AiScript->OwnForce].Units;
-
-       while (aiunit) {
-               switch(aiunit->Unit->Type->UnitType) {
-                       case UnitTypeFly:
-                                       break;
-                       case UnitTypeNaval:
-                               if (!PlaceReachable(aiunit->Unit, 
AiScript->HotSpotX, AiScript->HotSpotY,
-                                               1, 1, 0, 
aiunit->Unit->Type->_AttackRange)) {
-                                       return SCM_BOOL_F;
-                                       }
-                               break;
-                       case UnitTypeLand:
-
-                                       ZoneSetClear(&sources);
-                               ZoneSetAddUnitZones(&sources,aiunit->Unit);
-
-                               ZoneSetClear(&targets);
-                               ZoneSetAddGoalZones(&targets, aiunit->Unit, 
AiScript->HotSpotX - 4, AiScript->HotSpotY - 4,
-                                       9, 9, 0, 0);
-
-                               if (!ZoneSetHasIntersect(&targets, &sources) &&
-                                               (!ZoneSetHasIntersect(&targets, 
&transportable) ||
-                                                       
!ZoneSetHasIntersect(&sources, &transportable))) {
-                                        return SCM_BOOL_F;
-                               }
-                               break;
-               }
-               aiunit = aiunit->Next;
-       }
-
-       return SCM_BOOL_T;
-#else
-       return SCM_BOOL_F;
-#endif
-}
-#elif defined(USE_LUA)
-local int CclAiCanReachHotSpot(lua_State* l)
-{
-#ifdef MAP_REGIONS
-       ZoneSet targets = {0};
-       ZoneSet sources = {0};
-       ZoneSet transportable = {0};
-       int i;
-       Unit* unit;
-       int transporterplace;
-       UnitType* transporter;
-       AiUnit* aiunit;
-
-       if (lua_gettop(l) != 1) {
+       if (lua_gettop(l) != 2 || !lua_istable(l, 2)) {
                lua_pushstring(l, "incorrect argument");
                lua_error(l);
        }
-       if ((AiScript->HotSpotX == -1) || (AiScript->HotSpotY == -1) ||
-                       (AiScript->HotSpotRay <= 0)) {
-               lua_pushboolean(l, 1);
-               return 1;
+       force = LuaToNumber(l, 1);
+       if (force < 0 || force >= AI_MAX_FORCES) {
+               lua_pushfstring(l, "Force out of range: %d", force);
+               lua_error(l);
        }
 
-       ZoneSetClear(&sources);
-       transporter = 0;
-       transporterplace = 0;
-       for (i = 0; i < AiPlayer->Player->TotalNumUnits; ++i) {
-               unit = AiPlayer->Player->Units[i];
-
-               if (unit->Orders[0].Action == UnitActionDie) {
-                       continue;
-               }
+       args = luaL_getn(l, 2);
+       for (j = 0; j < args; ++j) {
+               lua_rawgeti(l, 2, j + 1);
+               type = CclGetUnitType(l);
+               lua_pop(l, 1);
+               ++j;
+               lua_rawgeti(l, 2, j + 1);
+               count = LuaToNumber(l, -1);
+               lua_pop(l, 1);
 
-               if (unit->Removed) {
+               if (!type) { // bulletproof
                        continue;
                }
 
-               if ((unit->X == -1) || (unit->Y == -1)) {
-                       continue;
-               }
+               // Use the equivalent unittype.
+               type = UnitTypes[UnitTypeEquivs[type->Type]];
 
-               if (unit->Type->UnitType == UnitTypeNaval && 
unit->Type->Transporter) {
-                       ZoneSetAddUnitZones(&sources, unit);
-                       if ((!transporter) || (transporter->MaxOnBoard < 
unit->Type->MaxOnBoard)) {
-                               transporter = unit->Type;
+               //
+               // Look if already in force.
+               //
+               for (prev = &AiPlayer->Force[force].UnitTypes; (aiut = *prev);
+                               prev = &aiut->Next) {
+                       if (UnitTypeEquivs[aiut->Type->Type] == type->Type) { 
// found
+                               if (count) {
+                                       aiut->Want = count;
+                               } else {
+                                       *prev = aiut->Next;
+                                       free(aiut);
+                               }
+                               break;
                        }
-                       transporterplace += unit->Type->MaxOnBoard;
                }
-       }
-       ZoneSetClear(&transportable);
-       // Add land connected to transporter
-       ZoneSetAddConnected(&transportable, &sources);
-       // Add water as well
-       ZoneSetAddSet(&transportable, &sources);
-
-
-       aiunit = AiPlayer->Force[AiScript->OwnForce].Units;
 
-       while (aiunit) {
-               switch(aiunit->Unit->Type->UnitType) {
-                       case UnitTypeFly:
-                                       break;
-                       case UnitTypeNaval:
-                               if (!PlaceReachable(aiunit->Unit, 
AiScript->HotSpotX, AiScript->HotSpotY,
-                                               1, 1, 0, 
aiunit->Unit->Type->_AttackRange)) {
-                                       lua_pushboolean(l, 0);
-                                       return 1;
-                                       }
-                               break;
-                       case UnitTypeLand:
-
-                                       ZoneSetClear(&sources);
-                               ZoneSetAddUnitZones(&sources,aiunit->Unit);
-
-                               ZoneSetClear(&targets);
-                               ZoneSetAddGoalZones(&targets, aiunit->Unit, 
AiScript->HotSpotX - 4,
-                                       AiScript->HotSpotY - 4, 9, 9, 0, 0);
-
-                               if (!ZoneSetHasIntersect(&targets, &sources) &&
-                                               (!ZoneSetHasIntersect(&targets, 
&transportable) ||
-                                                       
!ZoneSetHasIntersect(&sources, &transportable))) {
-                                       lua_pushboolean(l, 0);
-                                       return 1;
-                               }
-                               break;
+               //
+               // New type append it.
+               //
+               if (!aiut) {
+                       *prev = aiut = malloc(sizeof(*aiut));
+                       aiut->Next = NULL;
+                       aiut->Want = count;
+                       aiut->Type = type;
                }
-               aiunit = aiunit->Next;
        }
 
-       lua_pushboolean(l, 1);
-       return 1;
-#else
+       AiAssignFreeUnitsToForce();
+
        lua_pushboolean(l, 0);
        return 1;
-#endif
 }
-#endif
-
 
 /**
-**  Check if a force ready.
+**  Define the role of a force.
 **
 **  @param value  Force number.
-**  @return       #t if ready, #f otherwise.
+**  @param flag   Which role of the force.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiCheckForce(SCM value)
+local int CclAiForceRole(lua_State* l)
 {
        int force;
+       const char* flag;
 
-       force = gh_scm2int(value);
+       if (lua_gettop(l) != 2) {
+               lua_pushstring(l, "incorrect argument");
+               lua_error(l);
+       }
+       force = LuaToNumber(l, 1);
        if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", value);
+               lua_pushfstring(l, "Force out of range", force);
+               lua_error(l);
        }
-       if (AiPlayer->Force[force].Completed) {
-               return SCM_BOOL_T;
+       flag = LuaToString(l, 2);
+       if (!strcmp(flag, "attack")) {
+               AiPlayer->Force[force].Role = AiForceRoleAttack;
+       } else if (!strcmp(flag, "defend")) {
+               AiPlayer->Force[force].Role = AiForceRoleDefend;
+       } else {
+               lua_pushfstring(l, "Unknown force role", flag);
        }
-       return SCM_BOOL_F;
+
+       lua_pushboolean(l, 0);
+       return 1;
 }
-#elif defined(USE_LUA)
+
+/**
+**  Check if a force ready.
+**
+**  @param value  Force number.
+**  @return       #t if ready, #f otherwise.
+*/
 local int CclAiCheckForce(lua_State* l)
 {
        int force;
@@ -2576,77 +839,12 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
-
-/**
-**  Evaluate the ressources needed to complete a force.
-**
-**  @param s_force the force
-**
-**  @return -1 if it is not possible ( upgrade missing )
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiEvaluateForceCost(SCM s_force)
-{
-       return gh_int2scm(AiEvaluateForceCost(gh_scm2int(s_force), 0));
-}
-#elif defined(USE_LUA)
-local int CclAiEvaluateForceCost(lua_State* l)
-{
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       lua_pushnumber(l, AiEvaluateForceCost(LuaToNumber(l, 1), 0));
-       return 1;
-}
-#endif
-
-// Just hang...
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiIdle(void)
-{
-       return SCM_BOOL_T;
-}
-#elif defined(USE_LUA)
-local int CclAiIdle(lua_State* l)
-{
-       if (lua_gettop(l) != 0) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       lua_pushboolean(l, 1);
-       return 1;
-}
-#endif
 
 /**
 **  Wait for a force ready.
 **
 **  @param value  Force number.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiWaitForce(SCM value)
-{
-       int force;
-
-       force = gh_scm2int(value);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", value);
-       }
-       if (AiPlayer->Force[force].Completed) {
-               return SCM_BOOL_F;
-       }
-       DebugLevel3Fn("Wait force %d\n" _C_ force);
-#if 0
-       // Debuging
-       AiCleanForces();
-       DebugCheck(AiPlayer->Force[force].Completed);
-#endif
-
-       return SCM_BOOL_T;
-}
-#elif defined(USE_LUA)
 local int CclAiWaitForce(lua_State* l)
 {
        int force;
@@ -2674,105 +872,13 @@
        lua_pushboolean(l, 1);
        return 1;
 }
-#endif
 
 /**
-**  Attack with force, on the current script hotspot.
+**  Attack with force.
 **
 **  @param value  Force number.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiHotSpotAttackWithForce(SCM value)
-{
-       int force;
-
-       force = gh_scm2int(value);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", value);
-       }
-
-       AiAttackWithForceAt(force, AiScript->HotSpotX, AiScript->HotSpotY);
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiHotSpotAttackWithForce(lua_State* l)
-{
-       int force;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range: %d", force);
-               lua_error(l);
-       }
-
-       AiAttackWithForceAt(force, AiScript->HotSpotX, AiScript->HotSpotY);
-
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-/**
-**  FIXME: docu
-**
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiGroupForce(SCM value)
-{
-       int force;
-
-       force = gh_scm2int(value);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", value);
-       }
-
-       AiGroupForceNear(force, AiScript->HotSpotX, AiScript->HotSpotY);
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiGroupForce(lua_State* l)
-{
-       int force;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       force = LuaToNumber(l, 1);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               lua_pushfstring(l, "Force out of range: %d", force);
-               lua_error(l);
-       }
-
-       AiGroupForceNear(force, AiScript->HotSpotX, AiScript->HotSpotY);
-
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiForceHome(SCM value)
-{
-       int force;
-
-       force = gh_scm2int(value);
-       if (force < 0 || force >= AI_MAX_FORCES) {
-               errl("Force out of range", value);
-       }
-
-       AiSendForceHome(force);
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiForceHome(lua_State* l)
+local int CclAiAttackWithForce(lua_State* l)
 {
        int force;
 
@@ -2786,90 +892,17 @@
                lua_error(l);
        }
 
-       AiSendForceHome(force);
+       AiAttackWithForce(force);
 
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
-
-/**
-**  Wait for a force (like CclAiWaitForce), limited in time.
-**
-**  @param s_force  Force number.
-**  @param s_wait   Maximum number of cycles to delay.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiTimedWaitForce(SCM s_force, SCM s_wait)
-{
-       SCM result;
-
-       // return true after n call or when force is ready
-       if (AiScript->SleepCycles) {
-               if (AiScript->SleepCycles < GameCycle) {
-                       AiScript->SleepCycles = 0;
-                       return SCM_BOOL_F;
-               }
-       } else {
-               AiScript->SleepCycles = GameCycle + gh_scm2int(s_wait);
-       }
-       result = CclAiWaitForce(s_force);
-       if (result == SCM_BOOL_F) {
-               AiScript->SleepCycles = 0;
-       }
-       return result;
-}
-#elif defined(USE_LUA)
-local int CclAiTimedWaitForce(lua_State* l)
-{
-       if (lua_gettop(l) != 2) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       // return true after n call or when force is ready
-       if (AiScript->SleepCycles) {
-               if (AiScript->SleepCycles < GameCycle) {
-                       AiScript->SleepCycles = 0;
-                       lua_pushboolean(l, 0);
-                       return 1;
-               }
-       } else {
-               AiScript->SleepCycles = GameCycle + LuaToNumber(l, 2);
-       }
-#if 0
-       result = CclAiWaitForce(s_force);
-       if (result == SCM_BOOL_F) {
-               AiScript->SleepCycles = 0;
-       }
-#endif
-       return 1;
-}
-#endif
 
 /**
 **  Sleep n cycles.
 **
 **  @param value  Number of cycles to delay.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiSleep(SCM value)
-{
-       int i;
-
-       DebugLevel3Fn("%lu %d\n" _C_ GameCycle _C_ AiPlayer->SleepCycles);
-       if (AiScript->SleepCycles) {
-               if (AiScript->SleepCycles < GameCycle) {
-                       AiScript->SleepCycles = 0;
-                       return SCM_BOOL_F;
-               }
-       } else {
-               i = gh_scm2int(value);
-               AiScript->SleepCycles = GameCycle + i;
-       }
-
-       return SCM_BOOL_T;
-}
-#elif defined(USE_LUA)
 local int CclAiSleep(lua_State* l)
 {
        int i;
@@ -2879,46 +912,26 @@
                lua_error(l);
        }
        DebugLevel3Fn("%lu %d\n" _C_ GameCycle _C_ AiPlayer->SleepCycles);
-       if (AiScript->SleepCycles) {
-               if (AiScript->SleepCycles < GameCycle) {
-                       AiScript->SleepCycles = 0;
+       if (AiPlayer->SleepCycles) {
+               if (AiPlayer->SleepCycles < GameCycle) {
+                       AiPlayer->SleepCycles = 0;
                        lua_pushboolean(l, 0);
                        return 1;
                }
        } else {
                i = LuaToNumber(l, 1);
-               AiScript->SleepCycles = GameCycle + i;
+               AiPlayer->SleepCycles = GameCycle + i;
        }
 
        lua_pushboolean(l, 1);
        return 1;
 }
-#endif
 
 /**
 **  Research an upgrade.
 **
 **  @param value  Upgrade as string/symbol/object.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiResearch(SCM value)
-{
-       const char* str;
-       Upgrade* upgrade;
-
-       // Be kind allow also strings or symbols
-       if ((str = try_get_c_string(value))) {
-               upgrade = UpgradeByIdent(str);
-       } else {
-               errl("Upgrade needed", value);
-               return SCM_BOOL_F;
-       }
-
-       InsertResearchRequests(upgrade);
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclAiResearch(lua_State* l)
 {
        const char* str;
@@ -2941,24 +954,12 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Upgrade an unit to an new unit-type.
 **
 **  @param value  Unit-type as string/symbol/object.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiUpgradeTo(SCM value)
-{
-       UnitType* type;
-
-       type = CclGetUnitType(value);
-       InsertUpgradeToRequests(type);
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclAiUpgradeTo(lua_State* l)
 {
        UnitType* type;
@@ -2973,208 +974,12 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiSetHotSpotRay(SCM value)
-{
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiSetHotSpotRay(lua_State* l)
-{
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiComputeGauges(void)
-{
-       AiComputeCurrentScriptGauges();
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiComputeGauges(lua_State* l)
-{
-       if (lua_gettop(l) != 0) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       AiComputeCurrentScriptGauges();
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiDebugGauges(void)
-{
-       AiDebugGauges();
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiDebugGauges(lua_State* l)
-{
-       if (lua_gettop(l) != 0) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       AiDebugGauges();
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiGetGauge(SCM value)
-{
-       int gauge;
-
-       if (gh_exact_p(value)) {
-               gauge = gh_scm2int(value);
-       } else {
-               gauge = AiFindGaugeId(value);
-               if (gauge == -1) {
-                       errl("invalid gauge name", value);
-               }
-       }
-       return gh_int2scm(AiGetGaugeValue(gauge));
-}
-#elif defined(USE_LUA)
-local int CclAiGetGauge(lua_State* l)
-{
-       int gauge;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       if (lua_isnumber(l, 1)) {
-               gauge = LuaToNumber(l, 1);
-       } else {
-               gauge = AiFindGaugeId(l);
-               if (gauge == -1) {
-                       lua_pushfstring(l, "invalid gauge name: %s", 
LuaToString(l, 1));
-                       lua_error(l);
-               }
-       }
-       lua_pushnumber(l, AiGetGaugeValue(gauge));
-       return 1;
-}
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiGetUnitTypeForce(SCM value)
-{
-       UnitType* unitType;
-
-       unitType = CclGetUnitType(value);
-
-       return gh_int2scm(AiUnitTypeForce(unitType));
-}
-#elif defined(USE_LUA)
-local int CclAiGetUnitTypeForce(lua_State* l)
-{
-       UnitType* unitType;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       unitType = CclGetUnitType(l);
-
-       lua_pushnumber(l, AiUnitTypeForce(unitType));
-       return 1;
-}
-#endif
-
-/**
-**  Simple restart the AI.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiRestart(void)
-{
-       int i;
-
-       CclGcProtectedAssign(&AiPlayer->Scripts[0].Script, 
AiPlayer->AiType->Script);
-       AiPlayer->Scripts[0].SleepCycles = 0;
-       snprintf(AiPlayer->Scripts[0].Ident, 10, "Main AI");
-       for (i = 1; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
-               CclGcProtectedAssign(&AiPlayer->Scripts[i].Script, NIL);
-               AiPlayer->Scripts[i].SleepCycles = 0;
-               snprintf(AiPlayer->Scripts[i].Ident, 10, "Empty");
-       }
-       return SCM_BOOL_T;
-}
-#elif defined(USE_LUA)
-#endif
-
-/**
-**  Start an AI script at the given id.
-**
-**  @param script      The Id of the script to run ( main, defend, ... )
-**  @param list        The script execution
-**  @param hotSpotX    position of the hotspot (X)
-**  @param hotSpotY    position of the hotspot (Y)
-**  @param hotSpotRay  ray of the hotspot
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global void AiRunScript(int script, SCM list, int hotSpotX, int hotSpotY, int 
hotSpotRay)
-{
-       CclGcProtectedAssign(&AiPlayer->Scripts[script].Script, list);
-       AiPlayer->Scripts[script].SleepCycles = 0;
-       snprintf(AiPlayer->Scripts[script].Ident, 10, "AiRunScript");
-       AiPlayer->Scripts[script].HotSpotX = hotSpotX;
-       AiPlayer->Scripts[script].HotSpotY = hotSpotY;
-       AiPlayer->Scripts[script].HotSpotRay = hotSpotRay;
-       // FIXME : Compute gauges here ?
-}
-#elif defined(USE_LUA)
-#endif
-
-/**
-**  Change the current script
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiSwitchTo(SCM value)
-{
-       CclGcProtectedAssign(&AiScript->Script, value);
-       AiScript->SleepCycles = 0;
-       return SCM_BOOL_T;
-}
-#elif defined(USE_LUA)
-#endif
-
-/**
-**  Execute new main script
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiScript(SCM value)
-{
-       CclGcProtectedAssign(&AiPlayer->Scripts[0].Script, value);
-       AiPlayer->Scripts[0].SleepCycles = 0;
-       snprintf(AiPlayer->Scripts[0].Ident, 10, "MainScript");
-       return SCM_BOOL_T;
-}
-#elif defined(USE_LUA)
-#endif
 
 /**
 **  Return the player of the running AI.
 **
 **  @return  Player number of the AI.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiPlayer(void)
-{
-       return gh_int2scm(AiPlayer->Player->Player);
-}
-#elif defined(USE_LUA)
 local int CclAiPlayer(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -3184,7 +989,6 @@
        lua_pushnumber(l, AiPlayer->Player->Player);
        return 1;
 }
-#endif
 
 /**
 **  Set AI player resource reserve.
@@ -3192,22 +996,6 @@
 **  @param vec  Resources vector
 **  @return     Old resource vector
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiSetReserve(SCM vec)
-{
-       int i;
-       SCM old;
-
-       old = cons_array(gh_int2scm(MaxCosts), 0);
-       for (i = 0; i < MaxCosts; ++i) {
-               aset1(old, gh_int2scm(i), gh_int2scm(AiPlayer->Reserve[i]));
-       }
-       for (i = 0; i < MaxCosts; ++i) {
-               AiPlayer->Reserve[i] = gh_scm2int(gh_vector_ref(vec, 
gh_int2scm(i)));
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclAiSetReserve(lua_State* l)
 {
        int i;
@@ -3228,7 +1016,6 @@
        }
        return 1;
 }
-#endif
 
 /**
 **  Set AI player resource collect percent.
@@ -3236,22 +1023,6 @@
 **  @param vec  Resources vector
 **  @return     Old resource vector
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiSetCollect(SCM vec)
-{
-       int i;
-       SCM old;
-
-       old = cons_array(gh_int2scm(MaxCosts), 0);
-       for (i = 0; i < MaxCosts; ++i) {
-               aset1(old, gh_int2scm(i), gh_int2scm(AiPlayer->Collect[i]));
-       }
-       for (i = 0; i < MaxCosts; ++i) {
-               AiPlayer->Collect[i] = gh_scm2int(gh_vector_ref(vec, 
gh_int2scm(i)));
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclAiSetCollect(lua_State* l)
 {
        int i;
@@ -3272,106 +1043,10 @@
        }
        return 1;
 }
-#endif
-
-/**
-**  Set the autoattack flag of the current AiPlayer
-**
-**  @param val  new value of the autoattack flag
-**
-**  @return     SCM_BOOL_F
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiSetAutoAttack(SCM val)
-{
-       AiPlayer->AutoAttack = gh_scm2bool(val);
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
-local int CclAiSetAutoAttack(lua_State* l)
-{
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       AiPlayer->AutoAttack = LuaToBoolean(l, 1);
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
 
 /**
 **  Dump some AI debug informations.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAiDump(void)
-{
-       int i;
-       int n;
-       const AiUnitType* aut;
-       const AiBuildQueue* queue;
-
-       //
-       // Script
-       //
-       printf("------\n");
-       for (i = 0; i < MaxCosts; ++i) {
-               printf("%s(%4d) ", DefaultResourceNames[i], 
AiPlayer->Player->Resources[i]);
-       }
-       printf("\n");
-       printf("%d:", AiPlayer->Player->Player);
-       for (i = 0; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
-               gh_display(gh_car(AiPlayer->Scripts[i].Script));
-       }
-       gh_newline();
-
-       //
-       // Requests
-       //
-       n = AiPlayer->UnitTypeRequestsCount;
-       printf("UnitTypeRequests(%d):\n", n);
-       for (i = 0; i < n; ++i) {
-               printf("%s ", AiPlayer->UnitTypeRequests[i].Table[0]->Ident);
-       }
-       printf("\n");
-       n = AiPlayer->UpgradeToRequestsCount;
-       printf("UpgradeToRequests(%d):\n", n);
-       for (i = 0; i < n; ++i) {
-               printf("%s ", AiPlayer->UpgradeToRequests[i]->Ident);
-       }
-       printf("\n");
-       n = AiPlayer->ResearchRequestsCount;
-       printf("ResearchRequests(%d):\n", n);
-       for (i = 0; i < n; ++i) {
-               printf("%s ", AiPlayer->ResearchRequests[i]->Ident);
-       }
-       printf("\n");
-
-       //
-       // Building queue
-       //
-       printf("Building queue:\n");
-       for (queue = AiPlayer->UnitTypeBuilded; queue; queue = queue->Next) {
-               printf("%s(%d/%d) ", queue->Type->Ident, queue->Made, 
queue->Want);
-       }
-       printf("\n");
-
-       //
-       // PrintForce
-       //
-       for (i = 0; i < AI_MAX_FORCES; ++i) {
-               printf("Force(%d%s%s):\n", i,
-                       AiPlayer->Force[i].Completed ? ",complete" : ",recruit",
-                       AiPlayer->Force[i].Attacking ? ",attack" : "");
-               for (aut = AiPlayer->Force[i].UnitTypes; aut; aut = aut->Next) {
-                       printf("%s(%d) ", aut->Type->Ident, aut->Want);
-               }
-               printf("\n");
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclAiDump(lua_State* l)
 {
        int i;
@@ -3392,13 +1067,8 @@
        }
        printf("\n");
        printf("%d:", AiPlayer->Player->Player);
-       for (i = 0; i < AI_MAX_RUNNING_SCRIPTS; ++i) {
 #if 0
-               gh_display(gh_car(AiPlayer->Scripts[i].Script));
-       }
-       gh_newline();
-#else
-       }
+       gh_display(gh_car(AiPlayer->Script));
 #endif
        //
        // Requests
@@ -3447,39 +1117,12 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Define AI mapping from original number to internal symbol
 **
 **  @param list  List of all names.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineAiWcNames(SCM list)
-{
-       int i;
-       char** cp;
-
-       if ((cp = AiTypeWcNames)) { // Free all old names
-               while (*cp) {
-                       free(*cp++);
-               }
-               free(AiTypeWcNames);
-       }
-       //
-       // Get new table.
-       //
-       i = gh_length(list);
-       AiTypeWcNames = cp = malloc((i + 1) * sizeof(char*));
-       while (i--) {
-               *cp++ = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-       }
-       *cp = NULL;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineAiWcNames(lua_State* l)
 {
        int i;
@@ -3510,7 +1153,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Get the default resource number
@@ -3536,20 +1178,9 @@
 /**
 **  Define an AI player.
 **
-**  Format of the list is :
-**    ( <player_id>
-**      <value> <list>
-**      [ <value> <list> [ ... ] ]
-**    )
-**
-**  <value> can be :
-**    ai-type => the name of the ai
-**    script  => ???
-**    script-debug => ???
-**
 **  @param list  List of the AI Player.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
+#if 0
 local SCM CclDefineAiPlayer(SCM list)
 {
 #if 0
@@ -3570,7 +1201,11 @@
 
        return SCM_UNSPECIFIED;
 }
-#elif defined(USE_LUA)
+#else
+local int CclDefineAiPlayer(lua_State* l)
+{
+       return 0;
+}
 #endif
 
 /**
@@ -3578,89 +1213,12 @@
 */
 global void AiCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       // FIXME: Need to save memory here.
-       // Loading all into memory isn't necessary.
-
-       gh_new_procedureN("define-ai-helper", CclDefineAiHelper);
-       gh_new_procedureN("define-ai", CclDefineAi);
-
-#ifdef INCOMPLETE_SIOD
-       gh_new_procedure2_0("quotient", CclQuotient);
-       gh_new_procedure1_0("output", CclOutput);
-#endif
-       gh_new_procedure2_0("define-ai-action", CclDefineAiAction);
-
-       gh_new_procedure0_0("ai:get-race", CclAiGetRace);
-       gh_new_procedure0_0("ai:get-sleep-cycles", CclAiGetSleepCycles);
-
-       gh_new_procedure1_0("ai:debug", CclAiDebug);
-       gh_new_procedureN("ai:debug-player", CclAiDebugPlayer);
-       gh_new_procedure1_0("ai:need", CclAiNeed);
-       gh_new_procedure2_0("ai:set", CclAiSet);
-       gh_new_procedure1_0("ai:wait", CclAiWait);
-
-       gh_new_procedure0_0("ai:own-force", CclAiOwnForce);
-
-       gh_new_procedure1_0("ai:get-force", CclAiGetForce);
-
-
-       gh_new_procedureN("ai:force", CclAiForce);
-
-       gh_new_procedure2_0("ai:adhoc-force", CclAiAdHocForce);
-
-       gh_new_procedure1_0("ai:force-empty", CclAiForceEmpty);
-       gh_new_procedure1_0("ai:force-active", CclAiForceActive);
-       gh_new_procedure1_0("ai:force-list", CclAiForce);
-       gh_new_procedure2_0("ai:force-transfer", CclAiForceTransfer);
-       gh_new_procedure1_0("ai:force-complete", CclAiForceComplete);
-       gh_new_procedure2_0("ai:force-role", CclAiForceRole);
-       gh_new_procedure1_0("ai:is-force-defending", CclAiIsForceDefending);
-       gh_new_procedure1_0("ai:check-force", CclAiCheckForce);
-       gh_new_procedure1_0("ai:group-force", CclAiGroupForce);
-       gh_new_procedure1_0("ai:wait-force", CclAiWaitForce);
-       gh_new_procedure1_0("ai:clear-force", CclAiClearForce);
-       gh_new_procedure1_0("ai:evaluate-force-cost", CclAiEvaluateForceCost);
-
-       gh_new_procedure1_0("ai:can-reach-hotspot", CclAiCanReachHotSpot);
-
-       gh_new_procedure1_0("ai:set-hotspot-ray", CclAiSetHotSpotRay);
-       gh_new_procedure0_0("ai:compute-gauges", CclAiComputeGauges);
-       gh_new_procedure0_0("ai:debug-gauges", CclAiDebugGauges);
-       gh_new_procedure1_0("ai:get-gauge", CclAiGetGauge);
-       gh_new_procedure1_0("ai:get-unittype-force", CclAiGetUnitTypeForce);
-
-       gh_new_procedure0_0("ai:idle", CclAiIdle);
-       gh_new_procedure2_0("ai:timed-wait-force", CclAiTimedWaitForce);
-       gh_new_procedure1_0("ai:hotspot-attack-with-force", 
CclAiHotSpotAttackWithForce);
-       gh_new_procedure1_0("ai:force-go-home", CclAiForceHome);
-       gh_new_procedure1_0("ai:sleep", CclAiSleep);
-       gh_new_procedure1_0("ai:research", CclAiResearch);
-       gh_new_procedure1_0("ai:upgrade-to", CclAiUpgradeTo);
-       gh_new_procedure1_0("ai:script", CclAiScript);
-       gh_new_procedure1_0("ai:goto", CclAiSwitchTo);
-
-       gh_new_procedure0_0("ai:restart", CclAiRestart);
-
-       gh_new_procedure0_0("ai:player", CclAiPlayer);
-       gh_new_procedure1_0("ai:set-reserve!", CclAiSetReserve);
-       gh_new_procedure1_0("ai:set-collect!", CclAiSetCollect);
-       gh_new_procedure1_0("ai:set-auto-attack", CclAiSetAutoAttack);
-
-       gh_new_procedure0_0("ai:dump", CclAiDump);
-
-       gh_new_procedureN("define-ai-wc-names", CclDefineAiWcNames);
-
-       gh_new_procedureN("define-ai-player", CclDefineAiPlayer);
-#elif defined(USE_LUA)
        // FIXME: Need to save memory here.
        // Loading all into memory isn't necessary.
 
        lua_register(Lua, "DefineAiHelper", CclDefineAiHelper);
        lua_register(Lua, "DefineAi", CclDefineAi);
 
-       lua_register(Lua, "DefineAiAction", CclDefineAiAction);
-
        lua_register(Lua, "AiGetRace", CclAiGetRace);
        lua_register(Lua, "AiGetSleepCycles", CclAiGetSleepCycles);
 
@@ -3670,63 +1228,26 @@
        lua_register(Lua, "AiSet", CclAiSet);
        lua_register(Lua, "AiWait", CclAiWait);
 
-       lua_register(Lua, "AiOwnForce", CclAiOwnForce);
-
-       lua_register(Lua, "AiGetForce", CclAiGetForce);
-
-
        lua_register(Lua, "AiForce", CclAiForce);
 
-       lua_register(Lua, "AiAdHocForce", CclAiAdHocForce);
-
-       lua_register(Lua, "AiForceEmpty", CclAiForceEmpty);
-       lua_register(Lua, "AiForceActive", CclAiForceActive);
-       lua_register(Lua, "AiForceList", CclAiForce);
-       lua_register(Lua, "AiForceTransfer", CclAiForceTransfer);
-       lua_register(Lua, "AiForceComplete", CclAiForceComplete);
        lua_register(Lua, "AiForceRole", CclAiForceRole);
-       lua_register(Lua, "AiIsForceDefending", CclAiIsForceDefending);
        lua_register(Lua, "AiCheckForce", CclAiCheckForce);
-       lua_register(Lua, "AiGroupForce", CclAiGroupForce);
        lua_register(Lua, "AiWaitForce", CclAiWaitForce);
-       lua_register(Lua, "AiClearForce", CclAiClearForce);
-       lua_register(Lua, "AiEvaluateForceCost", CclAiEvaluateForceCost);
-
-       lua_register(Lua, "AiCanReachHotSpot", CclAiCanReachHotSpot);
 
-       lua_register(Lua, "AiSetHotSpotRay", CclAiSetHotSpotRay);
-       lua_register(Lua, "AiComputeGauges", CclAiComputeGauges);
-       lua_register(Lua, "AiDebugGauges", CclAiDebugGauges);
-       lua_register(Lua, "AiGetGauge", CclAiGetGauge);
-       lua_register(Lua, "AiGetUnitTypeForce", CclAiGetUnitTypeForce);
-
-       lua_register(Lua, "AiIdle", CclAiIdle);
-       lua_register(Lua, "AiTimedWaitForce", CclAiTimedWaitForce);
-       lua_register(Lua, "AiHotspotAttackWithForce", 
CclAiHotSpotAttackWithForce);
-       lua_register(Lua, "AiForceGoHome", CclAiForceHome);
+       lua_register(Lua, "AiAttackWithForce", CclAiAttackWithForce);
        lua_register(Lua, "AiSleep", CclAiSleep);
        lua_register(Lua, "AiResearch", CclAiResearch);
        lua_register(Lua, "AiUpgradeTo", CclAiUpgradeTo);
-#if 0
-       lua_register(Lua, "AiScript", CclAiScript);
-       lua_register(Lua, "AiGoto", CclAiSwitchTo);
-
-       lua_register(Lua, "AiRestart", CclAiRestart);
-#endif
 
        lua_register(Lua, "AiPlayer", CclAiPlayer);
        lua_register(Lua, "AiSetReserve", CclAiSetReserve);
        lua_register(Lua, "AiSetCollect", CclAiSetCollect);
-       lua_register(Lua, "AiSetAutoAttack", CclAiSetAutoAttack);
 
        lua_register(Lua, "AiDump", CclAiDump);
 
        lua_register(Lua, "DefineAiWcNames", CclDefineAiWcNames);
 
-#if 0
        lua_register(Lua, "DefineAiPlayer", CclDefineAiPlayer);
-#endif
-#endif
 }
 
 
Index: stratagus/src/editor/ccl_editor.c
diff -u stratagus/src/editor/ccl_editor.c:1.16 
stratagus/src/editor/ccl_editor.c:1.17
--- stratagus/src/editor/ccl_editor.c:1.16      Sat Dec 20 19:17:19 2003
+++ stratagus/src/editor/ccl_editor.c   Fri Jan  2 08:24:05 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl_editor.c,v 1.16 2003/12/20 08:17:19 wizzard Exp $
+//      $Id: ccl_editor.c,v 1.17 2004/01/01 21:24:05 jsalmon3 Exp $
 
 //@{
 
@@ -62,34 +62,6 @@
 **
 **  @param list  List of all names.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineEditorUnitTypes(SCM list)
-{
-       int i;
-       char** cp;
-
-       if ((cp = EditorUnitTypes)) { // Free all old names
-               while (*cp) {
-                       free(*cp++);
-               }
-               free(EditorUnitTypes);
-       }
-
-       //
-       // Get new table.
-       //
-       i = gh_length(list);
-       EditorUnitTypes = cp = malloc((i + 1) * sizeof(char*));
-       MaxUnitIndex = i;
-       while (i--) {
-               *cp++ = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-       }
-       *cp = NULL;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineEditorUnitTypes(lua_State* l)
 {
        char** cp;
@@ -116,19 +88,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Set the editor's select icon
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetEditorSelectIcon(SCM icon)
-{
-       free(EditorSelectIcon);
-       EditorSelectIcon = gh_scm2newstr(icon, NULL);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetEditorSelectIcon(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -139,19 +102,10 @@
        EditorSelectIcon = strdup(LuaToString(l, 1));
        return 0;
 }
-#endif
 
 /**
 **  Set the editor's units icon
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetEditorUnitsIcon(SCM icon)
-{
-       free(EditorUnitsIcon);
-       EditorUnitsIcon = gh_scm2newstr(icon, NULL);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetEditorUnitsIcon(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -162,22 +116,15 @@
        EditorUnitsIcon = strdup(LuaToString(l, 1));
        return 0;
 }
-#endif
 
 /**
 **  Register CCL features for the editor.
 */
 global void EditorCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       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
 }
 
 //@}
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.152 
stratagus/src/editor/editloop.c:1.153
--- stratagus/src/editor/editloop.c:1.152       Sat Dec 20 20:03:29 2003
+++ stratagus/src/editor/editloop.c     Fri Jan  2 08:24:05 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: editloop.c,v 1.152 2003/12/20 09:03:29 wizzard Exp $
+//      $Id: editloop.c,v 1.153 2004/01/01 21:24:05 jsalmon3 Exp $
 
 //@{
 
@@ -1839,9 +1839,6 @@
        int i;
        int n;
        char* file;
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       char* s;
-#endif
        char buf[PATH_MAX];
        CLFile* clf;
        int scm;
@@ -1855,15 +1852,7 @@
        if ((clf = CLopen(file, CL_OPEN_READ))) {
                CLclose(clf);
                ShowLoadProgress("Script %s", file);
-#if defined(USE_GUILE) || defined(USE_SIOD)
-               if ((s = strrchr(file, '.')) && s[1] == 'C') {
-                       fast_load(gh_str02scm(file), NIL);
-               } else {
-                       vload(file, 0, 1);
-               }
-#elif defined(USE_LUA)
                LuaLoadFile(file);
-#endif
                CclGarbageCollect(0); // Cleanup memory after load
        }
 
Index: stratagus/src/game/campaign.c
diff -u stratagus/src/game/campaign.c:1.40 stratagus/src/game/campaign.c:1.41
--- stratagus/src/game/campaign.c:1.40  Sun Dec 21 21:51:30 2003
+++ stratagus/src/game/campaign.c       Fri Jan  2 08:24:06 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: campaign.c,v 1.40 2003/12/21 10:51:30 wizzard Exp $
+//      $Id: campaign.c,v 1.41 2004/01/01 21:24:06 jsalmon3 Exp $
 
 //@{
 
@@ -153,11 +153,7 @@
        if (!CurrentCampaign->Chapters) {
                char buf[1024];
                filename = LibraryFileName(CurrentCampaign->File, buf);
-#if defined(USE_GUILE) || defined(USE_SIOD)
-               vload(filename, 0, 1);
-#elif defined(USE_LUA)
                LuaLoadFile(filename);
-#endif
        }
 
        GameIntro.Objectives[0] = strdup(DefaultObjective);
@@ -181,83 +177,6 @@
 **  @param chapter  Chapter.
 **  @param list     List describing show-picture.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void ParseShowPicture(CampaignChapter* chapter, SCM list)
-{
-       SCM value;
-       SCM sublist;
-
-       chapter->Type = ChapterShowPicture;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("image"))) {
-                       chapter->Data.Picture.Image = 
gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("fade-in"))) {
-                       chapter->Data.Picture.FadeIn = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("fade-out"))) {
-                       chapter->Data.Picture.FadeOut = 
gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("display-time"))) {
-                       chapter->Data.Picture.DisplayTime = 
gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                       ChapterPictureText** text;
-
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-
-                       text = &chapter->Data.Picture.Text;
-                       while (*text) {
-                               text = &((*text)->Next);
-                       }
-                       *text = calloc(sizeof(ChapterPictureText), 1);
-
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               if (gh_eq_p(value, gh_symbol2scm("font"))) {
-                                       (*text)->Font = 
CclFontByIdentifier(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, gh_symbol2scm("x"))) {
-                                       (*text)->X = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, gh_symbol2scm("y"))) {
-                                       (*text)->Y = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("width"))) {
-                                       (*text)->Width = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("height"))) {
-                                       (*text)->Height = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("align"))) {
-                                       char* str;
-                                       str = gh_scm2newstr(gh_car(sublist), 0);
-                                       if (!strcmp(str, "left")) {
-                                               (*text)->Align = 
PictureTextAlignLeft;
-                                       } else if (!strcmp(str, "center")) {
-                                               (*text)->Align = 
PictureTextAlignCenter;
-                                       } else {
-                                               errl("Invalid chapter picture 
text align value",
-                                                       gh_car(sublist));
-                                       }
-                                       free(str);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("text"))) {
-                                       (*text)->Text = 
gh_scm2newstr(gh_car(sublist), 0);
-                                       sublist = gh_cdr(sublist);
-                               }
-                       }
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void ParseShowPicture(lua_State* l, CampaignChapter* chapter)
 {
        const char* value;
@@ -360,7 +279,6 @@
                }
        }
 }
-#endif
 
 /**
 **  Free campaign chapters.
@@ -404,114 +322,6 @@
 **
 **  @note FIXME: play-video, defeat, draw are missing.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineCampaign(SCM list)
-{
-       char* ident;
-       SCM value;
-       SCM sublist;
-       Campaign* campaign;
-       CampaignChapter* chapter;
-       CampaignChapter** tail;
-       int i;
-
-       //
-       //              Campaign name
-       //
-       ident = gh_scm2newstr(gh_car(list), NULL);
-       list = gh_cdr(list);
-       campaign = NULL;
-
-       if (Campaigns) {
-               for (i = 0; i < NumCampaigns; ++i) {
-                       if (!strcmp(Campaigns[i].Ident, ident)) {
-                               if (!strcmp(ident, "current") && 
Campaigns[i].Chapters) {
-                                       FreeChapters(&Campaigns[i].Chapters);
-                               } else if (Campaigns[i].Chapters) {
-                                       // Redefining campaigns causes problems 
if a campaign is
-                                       // playing.
-                                       return SCM_UNSPECIFIED;
-                               }
-                               campaign = Campaigns + i;
-                               free(campaign->Ident);
-                               free(campaign->Name);
-                               free(campaign->File);
-                               break;
-                       }
-               }
-               if (i == NumCampaigns) {
-                       Campaigns = realloc(Campaigns, sizeof(Campaign) * 
(NumCampaigns + 1));
-                       campaign = Campaigns + NumCampaigns;
-                       ++NumCampaigns;
-               }
-       } else {
-               campaign = Campaigns = malloc(sizeof(Campaign));
-               ++NumCampaigns;
-       }
-
-       memset(campaign, 0, sizeof(Campaign));
-       campaign->Ident = ident;
-       campaign->Players = 1;
-       tail = &campaign->Chapters;
-
-       //
-       //  Parse the list: (still everything could be changed!)
-       //
-       while (!gh_null_p(list)) {
-
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("name"))) {
-                       campaign->Name = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("file"))) {
-                       campaign->File = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("players"))) {
-                       campaign->Players = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("campaign"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       //
-                       // Parse the list
-                       //
-                       while (!gh_null_p(sublist)) {
-
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               chapter = calloc(sizeof(CampaignChapter), 1);
-                               chapter->Next = *tail;
-                               *tail = chapter;
-                               tail = &chapter->Next;
-
-                               if (gh_eq_p(value, 
gh_symbol2scm("show-picture"))) {
-                                       ParseShowPicture(chapter, 
gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("play-movie"))) {
-                                       DebugLevel0Fn("FIXME: not supported\n");
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("play-level"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       chapter->Type = ChapterPlayLevel;
-                                       chapter->Data.Level.Name = 
gh_scm2newstr(value, NULL);
-                               } else {
-                                       // FIXME: this leaves a half 
initialized campaign
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else {
-                       // FIXME: this leaves a half initialized campaign
-                       errl("Unsupported tag", value);
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineCampaign(lua_State* l)
 {
        char* ident;
@@ -624,38 +434,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Set the current campaign chapter
 **
 **  @param num  Number of current chapter in current campaign.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetCurrentChapter(SCM num)
-{
-       int i;
-
-       for (i = 0; i < NumCampaigns; ++i) {
-               if (!strcmp(Campaigns[i].Ident, "current")) {
-                       CurrentCampaign = Campaigns + i;
-                       break;
-               }
-       }
-       if (!CurrentCampaign) {
-               return SCM_UNSPECIFIED;
-       }
-
-       i = gh_scm2int(num);
-       CurrentChapter = CurrentCampaign->Chapters;
-       while (i && CurrentChapter) {
-               --i;
-               CurrentChapter = CurrentChapter->Next;
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetCurrentChapter(lua_State* l)
 {
        int i;
@@ -684,83 +468,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Set the briefing.
 **
 **  @param list  List describing the briefing.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclBriefing(SCM list)
-{
-       SCM value;
-       int voice;
-       int objective;
-
-       voice = objective = 0;
-       //
-       // Parse the list: (still everything could be changed!)
-       //
-       while (!gh_null_p(list)) {
-
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("type"))) {
-                       if (!gh_eq_p(gh_car(list), gh_symbol2scm("wc2")) &&
-                                       !gh_eq_p(gh_car(list), 
gh_symbol2scm("sc")) ) {
-                               // FIXME: this leaves a half initialized 
briefing
-                               errl("Unsupported briefing type", value);
-                       }
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("title"))) {
-                       if (GameIntro.Title) {
-                               free(GameIntro.Title);
-                       }
-                       GameIntro.Title = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("background"))) {
-                       if (GameIntro.Background) {
-                               free(GameIntro.Background);
-                       }
-                       GameIntro.Background = gh_scm2newstr(gh_car(list), 
NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                       if (GameIntro.TextFile) {
-                               free(GameIntro.TextFile);
-                       }
-                       GameIntro.TextFile = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("voice"))) {
-                       if (voice == MAX_BRIEFING_VOICES) {
-                               errl("too many voices", value);
-                       }
-                       if (GameIntro.VoiceFile[voice]) {
-                               free(GameIntro.VoiceFile[voice]);
-                       }
-                       GameIntro.VoiceFile[voice] = 
gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-                       ++voice;
-               } else if (gh_eq_p(value, gh_symbol2scm("objective"))) {
-                       if (objective == MAX_OBJECTIVES) {
-                          errl("too many objectives", value);
-                       }
-                       if (GameIntro.Objectives[objective]) {
-                               free(GameIntro.Objectives[objective]);
-                       }
-                       GameIntro.Objectives[objective] = 
gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-                       ++objective;
-               } else {
-                       // FIXME: this leaves a half initialized briefing
-                       errl("Unsupported tag", value);
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclBriefing(lua_State* l)
 {
        const char* value;
@@ -827,22 +540,15 @@
 
        return 0;
 }
-#endif
 
 /**
 ** Register CCL features for campaigns.
 */
 global void CampaignCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-campaign", CclDefineCampaign);
-       gh_new_procedure1_0("set-current-chapter!", CclSetCurrentChapter);
-       gh_new_procedureN("briefing", CclBriefing);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineCampaign", CclDefineCampaign);
        lua_register(Lua, "SetCurrentChapter", CclSetCurrentChapter);
        lua_register(Lua, "Briefing", CclBriefing);
-#endif
 }
 
 /**
@@ -855,7 +561,7 @@
        int i;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: campaign $Id: campaign.c,v 1.40 2003/12/21 
10:51:30 wizzard Exp $\n\n");
+       CLprintf(file, ";;; MODULE: campaign $Id: campaign.c,v 1.41 2004/01/01 
21:24:06 jsalmon3 Exp $\n\n");
        if (!CurrentCampaign) {
                return;
        }
Index: stratagus/src/game/game.c
diff -u stratagus/src/game/game.c:1.119 stratagus/src/game/game.c:1.120
--- stratagus/src/game/game.c:1.119     Sun Dec 21 21:51:30 2003
+++ stratagus/src/game/game.c   Fri Jan  2 08:24:06 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: game.c,v 1.119 2003/12/21 10:51:30 wizzard Exp $
+//      $Id: game.c,v 1.120 2004/01/01 21:24:06 jsalmon3 Exp $
 
 //@{
 
@@ -98,11 +98,7 @@
        }
        InitPlayers();
        LcmPreventRecurse = 1;
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_load((char*)filename);
-#elif defined(USE_LUA)
        LuaLoadFile(filename);
-#endif
        LcmPreventRecurse = 0;
 
 #if 0
Index: stratagus/src/game/intro.c
diff -u stratagus/src/game/intro.c:1.117 stratagus/src/game/intro.c:1.118
--- stratagus/src/game/intro.c:1.117    Sun Dec 21 21:51:30 2003
+++ stratagus/src/game/intro.c  Fri Jan  2 08:24:06 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: intro.c,v 1.117 2003/12/21 10:51:30 wizzard Exp $
+//      $Id: intro.c,v 1.118 2004/01/01 21:24:06 jsalmon3 Exp $
 
 //@{
 
@@ -1445,50 +1445,6 @@
 **
 **  @todo  'comment and 'title are only parsed, but not used.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclCredits(SCM list)
-{
-       SCM value;
-       const char* n;
-       int nlen;
-       int len;
-
-       if (GameCredits.Background) {
-               free(GameCredits.Background);
-       }
-       GameCredits.Background = NULL;
-       if (GameCredits.Names) {
-               free(GameCredits.Names);
-               GameCredits.Names = (char*)malloc(1);
-               GameCredits.Names[0] = '\0';
-       }
-       len = 0;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("background"))) {
-                       GameCredits.Background = gh_scm2newstr(gh_car(list), 
NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("name")) ||
-                               gh_eq_p(value, gh_symbol2scm("title")) ||
-                               gh_eq_p(value, gh_symbol2scm("comment"))) {
-                       n = get_c_string(gh_car(list));
-                       nlen = strlen(n);
-                       GameCredits.Names = (char*)realloc(GameCredits.Names, 
len + nlen + 2);
-                       if (len != 0) {
-                               GameCredits.Names[len++] = '\n';
-                       }
-                       strcpy(GameCredits.Names + len, n);
-                       len += nlen;
-                       list = gh_cdr(list);
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclCredits(lua_State* l)
 {
        const char* value;
@@ -1531,7 +1487,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Register CCL features for credits.
@@ -1540,11 +1495,7 @@
 {
        GameCredits.Background = NULL;
        GameCredits.Names = NULL;
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("credits", CclCredits);
-#elif defined(USE_LUA)
        lua_register(Lua, "Credits", CclCredits);
-#endif
 }
 
 /**
@@ -1554,55 +1505,6 @@
 **  specifying where in the list it should be added.  If no number is
 **  given it is added at the end.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAddObjective(SCM list)
-{
-       int i;
-       const char* obj;
-
-       obj = get_c_string(gh_car(list));
-
-       list = gh_cdr(list);
-       if (!gh_null_p(list)) {
-               // Optional location number given
-               int num;
-
-               num = gh_scm2int(gh_car(list));
-               if (num < 0) {
-                       num = 0;
-               }
-
-               i = 0;
-               while (i != MAX_OBJECTIVES && GameIntro.Objectives[i]) {
-                       ++i;
-               }
-               if (i == MAX_OBJECTIVES) {
-                       fprintf(stderr, "Too many objectives: %s\n", obj);
-                       ExitFatal(-1);
-               }
-               if (num > i) {
-                       num = i;
-               }
-               for (; i > num; --i) {
-                       GameIntro.Objectives[i] = GameIntro.Objectives[i - 1];
-               }
-               GameIntro.Objectives[num] = strdup(obj);
-       } else {
-               // Add objective to the end of the list
-               i = 0;
-               while (i != MAX_OBJECTIVES && GameIntro.Objectives[i]) {
-                       ++i;
-               }
-               if (i == MAX_OBJECTIVES) {
-                       fprintf(stderr, "Too many objectives: %s\n", obj);
-                       ExitFatal(-1);
-               }
-               GameIntro.Objectives[i] = strdup(obj);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclAddObjective(lua_State* l)
 {
        int i;
@@ -1660,38 +1562,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Parse the remove objective ccl function
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclRemoveObjective(SCM objective)
-{
-       int num;
-
-       num = gh_scm2int(objective);
-       if (num < 0 || num >= MAX_OBJECTIVES) {
-               fprintf(stderr, "remove-objective: Invalid number: %d\n", num);
-               ExitFatal(-1);
-       }
-       if (!GameIntro.Objectives[num]) {
-               fprintf(stderr, "remove-objective: No objective at location: 
%d\n", num);
-               ExitFatal(-1);
-       }
-
-       free(GameIntro.Objectives[num]);
-
-       if (num == MAX_OBJECTIVES - 1) {
-               GameIntro.Objectives[num] = NULL;
-       }
-       for (; num < MAX_OBJECTIVES - 1 && GameIntro.Objectives[num]; ++num) {
-               GameIntro.Objectives[num] = GameIntro.Objectives[num + 1];
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclRemoveObjective(lua_State* l)
 {
        int num;
@@ -1722,32 +1596,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Set the objectives
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetObjectives(SCM list)
-{
-       int i;
-
-       // Clean old objectives
-       for (i = 0; i < MAX_OBJECTIVES && GameIntro.Objectives[i]; ++i) {
-               free(GameIntro.Objectives[i]);
-               GameIntro.Objectives[i] = NULL;
-       }
-
-       i = 0;
-       while (!gh_null_p(list)) {
-               GameIntro.Objectives[i] = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-               ++i;
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetObjectives(lua_State* l)
 {
        int i;
@@ -1767,59 +1619,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Parse the define-ranks ccl function
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineRanks(SCM list)
-{
-       PlayerRanks* rank;
-       const char* race;
-       int i;
-       int len;
-
-       rank = NULL;
-       race = get_c_string(gh_car(list));
-       for (i = 0; i < PlayerRaces.Count; ++i) {
-               if (!strcmp(PlayerRaces.Name[i], race)) {
-                       rank = &Ranks[i];
-                       break;
-               }
-       }
-       if (i == PlayerRaces.Count) {
-               fprintf(stderr, "define-ranks: Invalid race name: %s\n", race);
-               ExitFatal(-1);
-       }
-
-       if (rank->Ranks) {
-               for (i = 0; rank->Ranks[i]; ++i) {
-                       free(rank->Ranks[i]);
-               }
-               free(rank->Ranks);
-               free(rank->Scores);
-       }
-
-       list = gh_car(gh_cdr(list));
-       len = gh_length(list) / 2;
-
-       rank->Ranks = (char**)malloc((len + 1) * sizeof(char*));
-       rank->Ranks[len] = NULL;
-       rank->Scores = (int*)malloc(len * sizeof(int));
-
-       i = 0;
-       while (!gh_null_p(list)) {
-               rank->Scores[i] = gh_scm2int(gh_car(list));
-               list = gh_cdr(list);
-               rank->Ranks[i] = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-               ++i;
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineRanks(lua_State* l)
 {
        PlayerRanks* rank;
@@ -1875,24 +1678,16 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Register CCL functions for objectives
 */
 global void ObjectivesCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("add-objective", CclAddObjective);
-       gh_new_procedure1_0("remove-objective", CclRemoveObjective);
-       gh_new_procedureN("set-objectives!", CclSetObjectives);
-       gh_new_procedureN("define-ranks", CclDefineRanks);
-#elif defined(USE_LUA)
        lua_register(Lua, "AddObjective", CclAddObjective);
        lua_register(Lua, "RemoveObjective", CclRemoveObjective);
        lua_register(Lua, "SetObjectives", CclSetObjectives);
        lua_register(Lua, "DefineRanks", CclDefineRanks);
-#endif
 }
 
 /**
Index: stratagus/src/game/loadgame.c
diff -u stratagus/src/game/loadgame.c:1.75 stratagus/src/game/loadgame.c:1.76
--- stratagus/src/game/loadgame.c:1.75  Sun Dec 21 21:51:31 2003
+++ stratagus/src/game/loadgame.c       Fri Jan  2 08:24:06 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: loadgame.c,v 1.75 2003/12/21 10:51:31 wizzard Exp $
+//      $Id: loadgame.c,v 1.76 2004/01/01 21:24:06 jsalmon3 Exp $
 
 //@{
 
@@ -76,10 +76,6 @@
 */
 global void CleanModules(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       SCM var;
-#endif
-
        EndReplayLog();
        CleanMessages();
 
@@ -117,14 +113,6 @@
        MapSplitterClean();
 #endif
        FreeAStar();
-
-       //
-       // Free our protected objects, AI scripts, unit-type properties.
-       //
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       var = gh_symbol2scm("*ccl-protect*");
-       setvar(var, NIL, NIL);
-#endif
 }
 
 /**
@@ -239,28 +227,16 @@
 */
 global void LoadGame(char* filename)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       int old_siod_verbose_level;
-#endif
        unsigned long game_cycle;
 
        CleanModules();
        // log will be enabled if found in the save game
        CommandLogDisabled = 1;
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       old_siod_verbose_level = siod_verbose_level;
-       siod_verbose_level = 4;
        CclGarbageCollect(0);
-       siod_verbose_level = old_siod_verbose_level;
-#endif
        InitVisionTable();
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_load(filename);
-       CclGarbageCollect(0);
-#elif defined(USE_LUA)
        LuaLoadFile(filename);
-#endif
+       CclGarbageCollect(0);
 
        game_cycle = GameCycle;
 
Index: stratagus/src/game/trigger.c
diff -u stratagus/src/game/trigger.c:1.52 stratagus/src/game/trigger.c:1.53
--- stratagus/src/game/trigger.c:1.52   Sun Dec 21 21:51:31 2003
+++ stratagus/src/game/trigger.c        Fri Jan  2 08:24:07 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: trigger.c,v 1.52 2003/12/21 10:51:31 wizzard Exp $
+//      $Id: trigger.c,v 1.53 2004/01/01 21:24:07 jsalmon3 Exp $
 
 //@{
 
@@ -52,11 +52,7 @@
 ----------------------------------------------------------------------------*/
 
        /// Get unit-type.
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern UnitType* CclGetUnitType(SCM ptr);
-#elif defined(USE_LUA)
 extern UnitType* CclGetUnitType(lua_State* l);
-#endif
 
 #define MAX_SWITCH 256 /// Maximum number of switches
 
@@ -66,15 +62,9 @@
 
 global Timer GameTimer; /// The game timer
 local unsigned long WaitFrame; /// Frame to wait for
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM Trigger;      /// Current trigger
-local SCM WaitScript;   /// Script to run after wait is over
-local SCM WaitTrigger;  /// Old Trigger value during wait
-#elif defined(USE_LUA)
 local int Trigger;
 local int WaitScript;
 local int WaitTrigger;
-#endif
 local unsigned char Switch[MAX_SWITCH]; /// Switches
 
 /*----------------------------------------------------------------------------
@@ -88,28 +78,6 @@
 **
 **  @return  The player number, -1 matches any.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global int TriggerGetPlayer(SCM player)
-{
-       int ret;
-
-       if (gh_exact_p(player)) {
-               ret = gh_scm2int(player);
-               if (ret < 0 || ret > PlayerMax) {
-                       errl("bad player", player);
-               }
-               return ret;
-       }
-       if (gh_eq_p(player, gh_symbol2scm("any"))) {
-               return -1;
-       } else if (gh_eq_p(player, gh_symbol2scm("this"))) {
-               return ThisPlayer->Player;
-       }
-       errl("bad player", player);
-
-       return 0;
-}
-#elif defined(USE_LUA)
 global int TriggerGetPlayer(lua_State* l)
 {
        const char* player;
@@ -134,7 +102,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Get the unit-type.
@@ -143,22 +110,6 @@
 **
 **  @return      The unit-type pointer.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global const UnitType* TriggerGetUnitType(SCM unit)
-{
-       if (gh_eq_p(unit, gh_symbol2scm("any"))) {
-               return ANY_UNIT;
-       } else if (gh_eq_p(unit, gh_symbol2scm("all"))) {
-               return ALL_UNITS;
-       } else if (gh_eq_p(unit, gh_symbol2scm("units"))) {
-               return ALL_FOODUNITS;
-       } else if (gh_eq_p(unit, gh_symbol2scm("buildings"))) {
-               return ALL_BUILDINGS;
-       }
-
-       return CclGetUnitType(unit);
-}
-#elif defined(USE_LUA)
 global const UnitType* TriggerGetUnitType(lua_State* l)
 {
        const char* unit;
@@ -176,7 +127,6 @@
 
        return CclGetUnitType(l);
 }
-#endif
 
 /*--------------------------------------------------------------------------
 --  Conditions
@@ -242,73 +192,6 @@
 /**
 **  Player has the quantity of unit-type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfUnit(SCM player, SCM operation, SCM quantity, SCM unit)
-{
-       int plynr;
-       int q;
-       int pn;
-       const UnitType* unittype;
-       const char* op;
-       CompareFunction compare;
-
-       plynr = TriggerGetPlayer(player);
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
-       unittype = TriggerGetUnitType(unit);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               errl("Illegal comparison operation in if-unit", operation);
-       }
-
-       if (plynr == -1) {
-               plynr = 0;
-               pn = PlayerMax;
-       } else {
-               pn = plynr + 1;
-       }
-
-       if (unittype == ANY_UNIT) {
-               for (; plynr < pn; ++plynr) {
-                       int j;
-
-                       for (j = 0; j < NumUnitTypes; ++j) {
-                               if (compare(Players[plynr].UnitTypesCount[j], 
q)) {
-                                       return SCM_BOOL_T;
-                               }
-                       }
-               }
-       } else if (unittype == ALL_UNITS) {
-               for (; plynr < pn; ++plynr) {
-                       if (compare(Players[plynr].TotalNumUnits, q)) {
-                               return SCM_BOOL_T;
-                       }
-               }
-       } else if (unittype == ALL_FOODUNITS) {
-               for (; plynr < pn; ++plynr) {
-                       if (compare(Players[plynr].TotalNumUnits - 
Players[plynr].NumBuildings, q)) {
-                               return SCM_BOOL_T;
-                       }
-               }
-       } else if (unittype == ALL_BUILDINGS) {
-               for (; plynr < pn; ++plynr) {
-                       if (compare(Players[plynr].NumBuildings, q)) {
-                               return SCM_BOOL_T;
-                       }
-               }
-       } else {
-               for (; plynr < pn; ++plynr) {
-                       DebugLevel3Fn("Player%d, %d == %s\n" _C_ plynr _C_ q 
_C_ unittype->Ident);
-                       if 
(compare(Players[plynr].UnitTypesCount[unittype->Type], q)) {
-                               return SCM_BOOL_T;
-                       }
-               }
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfUnit(lua_State* l)
 {
        int plynr;
@@ -388,86 +271,12 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Player has the quantity of unit-type at a location.
 **
 **  (if-unit-at {player} {op} {quantity} {unit} {location} {location})
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfUnitAt(SCM list)
-{
-       int plynr;
-       int q;
-       int x1;
-       int y1;
-       int x2;
-       int y2;
-       const UnitType* unittype;
-       CompareFunction compare;
-       Unit* table[UnitMax];
-       Unit* unit;
-       int an;
-       int j;
-       int s;
-
-       plynr = TriggerGetPlayer(gh_car(list));
-       list = gh_cdr(list);
-       compare = GetCompareFunction(get_c_string(gh_car(list)));
-       if (!compare) {
-               errl("Illegal comparison operator in if-unit-at", gh_car(list));
-       }
-       list = gh_cdr(list);
-       q = gh_scm2int(gh_car(list));
-       list = gh_cdr(list);
-       unittype = TriggerGetUnitType(gh_car(list));
-       list = gh_cdr(list);
-       x1 = gh_scm2int(gh_car(gh_car(list)));
-       y1 = gh_scm2int(gh_car(gh_cdr(gh_car(list))));
-       list = gh_cdr(list);
-       x2 = gh_scm2int(gh_car(gh_car(list)));
-       y2 = gh_scm2int(gh_car(gh_cdr(gh_car(list))));
-       list = gh_cdr(list);
-
-       //
-       // Get all unit types in location.
-       //
-#ifdef UNIT_ON_MAP
-       // FIXME: could be done faster?
-#endif
-       // FIXME: I hope SelectUnits checks bounds?
-       // FIXME: Yes, but caller should check.
-       // NOTE: +1 right,bottom isn't inclusive :(
-       an = SelectUnits(x1, y1, x2 + 1, y2 + 1, table);
-       //
-       // Count the requested units
-       //
-       for (j = s = 0; j < an; ++j) {
-               unit = table[j];
-               //
-               // Check unit type
-               //
-               // FIXME: ALL_UNITS
-               if (unittype == ANY_UNIT ||
-                               (unittype == ALL_FOODUNITS && 
!unit->Type->Building) ||
-                               (unittype == ALL_BUILDINGS && 
unit->Type->Building) ||
-                               (unittype == unit->Type)) {
-                       //
-                       // Check the player
-                       //
-                       if (plynr == -1 || plynr == unit->Player->Player) {
-                               ++s;
-                       }
-               }
-       }
-       if (compare(s, q)) {
-               return SCM_BOOL_T;
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfUnitAt(lua_State* l)
 {
        int plynr;
@@ -563,101 +372,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Player has the quantity of unit-type near to unit-type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfNearUnit(SCM player, SCM operation, SCM quantity, SCM unit,
-       SCM nearunit)
-{
-       int plynr;
-       int q;
-       int n;
-       int i;
-       const UnitType* unittype;
-       const UnitType* ut2;
-       const char* op;
-       Unit* table[UnitMax];
-       CompareFunction compare;
-
-       plynr = TriggerGetPlayer(player);
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
-       unittype = TriggerGetUnitType(unit);
-       ut2 = CclGetUnitType(nearunit);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               errl("Illegal comparison operation in if-near-unit", operation);
-       }
-
-       //
-       // Get all unit types 'near'.
-       //
-       n = FindUnitsByType(ut2, table);
-       DebugLevel3Fn("%s: %d\n" _C_ ut2->Ident _C_ n);
-       for (i = 0; i < n; ++i) {
-               Unit* unit;
-               Unit* around[UnitMax];
-               int an;
-               int j;
-               int s;
-
-               unit = table[i];
-
-#ifdef UNIT_ON_MAP
-               // FIXME: could be done faster?
-#endif
-               // FIXME: I hope SelectUnits checks bounds?
-               // FIXME: Yes, but caller should check.
-               // NOTE: +1 right,bottom isn't inclusive :(
-               if (unit->Type->UnitType == UnitTypeLand) {
-                       an = SelectUnits(unit->X - 1, unit->Y - 1,
-                               unit->X + unit->Type->TileWidth + 1,
-                               unit->Y + unit->Type->TileHeight + 1, around);
-               } else {
-                       an = SelectUnits(unit->X - 2, unit->Y - 2,
-                               unit->X + unit->Type->TileWidth + 2,
-                               unit->Y + unit->Type->TileHeight + 2, around);
-               }
-               DebugLevel3Fn("Units around %d: %d\n" _C_ UnitNumber(unit) _C_ 
an);
-               //
-               // Count the requested units
-               //
-               for (j = s = 0; j < an; ++j) {
-                       unit = around[j];
-                       //
-                       // Check unit type
-                       //
-                       // FIXME: ALL_UNITS
-                       if (unittype == ANY_UNIT ||
-                                       (unittype == ALL_FOODUNITS && 
!unit->Type->Building) ||
-                                       (unittype == ALL_BUILDINGS && 
unit->Type->Building) ||
-                                       (unittype == unit->Type)) {
-                               //
-                               // Check the player
-                               //
-                               if (plynr == -1 || plynr == 
unit->Player->Player) {
-                                       ++s;
-                               }
-                       }
-               }
-               // Check if we counted the unit near itself
-               if (unittype == ANY_UNIT ||
-                               (unittype == ALL_FOODUNITS && ut2->Building) ||
-                               (unittype == ALL_BUILDINGS && ut2->Building)) {
-                       --s;
-               }
-               if (compare(s, q)) {
-                       return SCM_BOOL_T;
-               }
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfNearUnit(lua_State* l)
 {
        int plynr;
@@ -757,103 +475,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 ** Player has the quantity of rescued unit-type near to unit-type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfRescuedNearUnit(SCM player, SCM operation, SCM quantity, SCM 
unit,
-       SCM nearunit)
-{
-       int plynr;
-       int q;
-       int n;
-       int i;
-       const UnitType* unittype;
-       const UnitType* ut2;
-       const char* op;
-       Unit* table[UnitMax];
-       CompareFunction compare;
-
-       plynr = TriggerGetPlayer(player);
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
-       unittype = TriggerGetUnitType(unit);
-       ut2 = CclGetUnitType(nearunit);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               errl("Illegal comparison operation in if-rescued-near-unit", 
operation);
-       }
-
-       //
-       // Get all unit types 'near'.
-       //
-       n = FindUnitsByType(ut2, table);
-       DebugLevel3Fn("%s: %d\n" _C_ ut2->Ident _C_ n);
-       for (i = 0; i < n; ++i) {
-               Unit* unit;
-               Unit* around[UnitMax];
-               int an;
-               int j;
-               int s;
-
-               unit = table[i];
-
-#ifdef UNIT_ON_MAP
-               // FIXME: could be done faster?
-#endif
-               // FIXME: I hope SelectUnits checks bounds?
-               // FIXME: Yes, but caller should check.
-               // NOTE: +1 right,bottom isn't inclusive :(
-               if (unit->Type->UnitType == UnitTypeLand) {
-                       an = SelectUnits(unit->X - 1, unit->Y - 1,
-                               unit->X + unit->Type->TileWidth + 1,
-                               unit->Y + unit->Type->TileHeight + 1, around);
-               } else {
-                       an = SelectUnits(unit->X - 2, unit->Y - 2,
-                               unit->X + unit->Type->TileWidth + 2,
-                               unit->Y + unit->Type->TileHeight + 2, around);
-               }
-               DebugLevel3Fn("Units around %d: %d\n" _C_ UnitNumber(unit) _C_ 
an);
-               //
-               // Count the requested units
-               //
-               for (j = s = 0; j < an; ++j) {
-                       unit = around[j];
-                       if (unit->RescuedFrom) { // only rescued units
-                               //
-                               // Check unit type
-                               //
-                               // FIXME: ALL_UNITS
-                               if (unittype == ANY_UNIT ||
-                                               (unittype == ALL_FOODUNITS && 
!unit->Type->Building) ||
-                                               (unittype == ALL_BUILDINGS && 
unit->Type->Building) ||
-                                               (unittype == unit->Type)) {
-                                       //
-                                       // Check the player
-                                       //
-                                       if (plynr == -1 || plynr == 
unit->Player->Player) {
-                                               ++s;
-                                       }
-                               }
-                       }
-               }
-               // Check if we counted the unit near itself
-               if (unittype == ANY_UNIT ||
-                               (unittype == ALL_FOODUNITS && ut2->Building) ||
-                               (unittype == ALL_BUILDINGS && ut2->Building)) {
-                       --s;
-               }
-               if (compare(s, q)) {
-                       return SCM_BOOL_T;
-               }
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfRescuedNearUnit(lua_State* l)
 {
        int plynr;
@@ -955,60 +580,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Player has n opponents left.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfOpponents(SCM player, SCM operation, SCM quantity)
-{
-       int plynr;
-       int q;
-       int pn;
-       int n;
-       const char* op;
-       CompareFunction compare;
-
-       plynr = TriggerGetPlayer(player);
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               errl("Illegal comparison operation in if-opponents", operation);
-       }
-
-       if (plynr == -1) {
-               plynr = 0;
-               pn = PlayerMax;
-       } else {
-               pn = plynr + 1;
-       }
-
-       //
-       // Check the player opponents
-       //
-       for (n = 0; plynr < pn; ++plynr) {
-               int i;
-
-               for (i = 0; i < PlayerMax; ++i) {
-                       //
-                       // This player is our enemy and has units left.
-                       //
-                       if ((Players[i].Enemy & (1 << plynr)) && 
Players[i].TotalNumUnits) {
-                               ++n;
-                       }
-               }
-               DebugLevel3Fn("Opponents of %d = %d\n" _C_ plynr _C_ n);
-               if (compare(n, q)) {
-                       return SCM_BOOL_T;
-               }
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfOpponents(lua_State* l)
 {
        int plynr;
@@ -1066,77 +641,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Player has the quantity of resource.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfResource(SCM player, SCM operation, SCM quantity, SCM resource)
-{
-       int plynr;
-       int q;
-       int pn;
-       const char* res;
-       const char* op;
-       CompareFunction compare;
-       int i;
-
-       plynr = TriggerGetPlayer(player);
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
-       res = get_c_string(resource);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               errl("Illegal comparison operation in if-resource", operation);
-       }
-
-       if (plynr == -1) {
-               plynr = 0;
-               pn = PlayerMax;
-       } else {
-               pn = plynr + 1;
-       }
-
-       for (i = 0; i < MaxCosts; ++i) {
-               if (!strcmp(res, DefaultResourceNames[i])) {
-                       for (; plynr < pn; ++plynr) {
-                               if (compare(Players[plynr].Resources[i], q)) {
-                                       return SCM_BOOL_T;
-                               }
-                       }
-                       return SCM_BOOL_F;
-               }
-       }
-       if (!strcmp(res, "all")) {
-               int j;
-               int sum;
-
-               sum = 0;
-               for (; plynr < pn; ++plynr) {
-                       for (j = 1; j < MaxCosts; ++j) {
-                               sum += Players[plynr].Resources[j];
-                       }
-               }
-               if (compare(sum, q)) {
-                       return SCM_BOOL_T;
-               }
-       } else if (!strcmp(res, "any")) {
-               int j;
-
-               for (; plynr < pn; ++plynr) {
-                       for (j = 1; j < MaxCosts; ++j) {
-                               if (compare(Players[plynr].Resources[j], q)) {
-                                       return SCM_BOOL_T;
-                               }
-                       }
-               }
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfResource(lua_State* l)
 {
        int plynr;
@@ -1214,46 +722,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Player has quantity kills
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfKills(SCM player, SCM operation, SCM quantity)
-{
-       int plynr;
-       int q;
-       int pn;
-       int n;
-       const char* op;
-       CompareFunction compare;
-
-       plynr = TriggerGetPlayer(player);
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               errl("Illegal comparison operation in if-kills", operation);
-       }
-
-       if (plynr == -1) {
-               plynr = 0;
-               pn = PlayerMax;
-       } else {
-               pn = plynr + 1;
-       }
-
-       for (n = 0; plynr < pn; ++plynr) {
-               if (compare(Players[plynr].TotalKills, q)) {
-                       return SCM_BOOL_T;
-               }
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfKills(lua_State* l)
 {
        int plynr;
@@ -1263,62 +735,21 @@
        const char* op;
        CompareFunction compare;
 
-       if (lua_gettop(l) != 3) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-
-       lua_pushvalue(l, 1);
-       plynr = TriggerGetPlayer(l);
-       lua_pop(l, 1);
-       op = LuaToString(l, 2);
-       q = LuaToNumber(l, 3);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               lua_pushfstring(l, "Illegal comparison operation in if-kills: 
%s", op);
-               lua_error(l);
-       }
-
-       if (plynr == -1) {
-               plynr = 0;
-               pn = PlayerMax;
-       } else {
-               pn = plynr + 1;
-       }
-
-       for (n = 0; plynr < pn; ++plynr) {
-               if (compare(Players[plynr].TotalKills, q)) {
-                       lua_pushboolean(l, 1);
-                       return 1;
-               }
-       }
-
-       lua_pushboolean(l, 0);
-       return 1;
-}
-#endif
-
-/**
-**  Player has a certain score
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfScore(SCM player, SCM operation, SCM quantity)
-{
-       int plynr;
-       int q;
-       int pn;
-       int n;
-       const char* op;
-       CompareFunction compare;
-
-       plynr = TriggerGetPlayer(player);
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
+       if (lua_gettop(l) != 3) {
+               lua_pushstring(l, "incorrect argument");
+               lua_error(l);
+       }
+
+       lua_pushvalue(l, 1);
+       plynr = TriggerGetPlayer(l);
+       lua_pop(l, 1);
+       op = LuaToString(l, 2);
+       q = LuaToNumber(l, 3);
 
        compare = GetCompareFunction(op);
        if (!compare) {
-               errl("Illegal comparison operation in if-score", operation);
+               lua_pushfstring(l, "Illegal comparison operation in if-kills: 
%s", op);
+               lua_error(l);
        }
 
        if (plynr == -1) {
@@ -1329,14 +760,19 @@
        }
 
        for (n = 0; plynr < pn; ++plynr) {
-               if (compare(Players[plynr].Score, q)) {
-                       return SCM_BOOL_T;
+               if (compare(Players[plynr].TotalKills, q)) {
+                       lua_pushboolean(l, 1);
+                       return 1;
                }
        }
 
-       return SCM_BOOL_F;
+       lua_pushboolean(l, 0);
+       return 1;
 }
-#elif defined(USE_LUA)
+
+/**
+**  Player has a certain score
+*/
 local int CclIfScore(lua_State* l)
 {
        int plynr;
@@ -1380,33 +816,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Number of game cycles elapsed
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfElapsed(SCM operation, SCM quantity)
-{
-       int q;
-       const char* op;
-       CompareFunction compare;
-
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               errl("Illegal comparison operation in if-elapsed", operation);
-       }
-
-       if (compare(GameCycle, q)) {
-               return SCM_BOOL_T;
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfElapsed(lua_State* l)
 {
        int q;
@@ -1435,37 +848,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Check the timer value
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfTimer(SCM operation, SCM quantity)
-{
-       int q;
-       const char* op;
-       CompareFunction compare;
-
-       if (!GameTimer.Init) {
-               return SCM_BOOL_F;
-       }
-
-       op = get_c_string(operation);
-       q = gh_scm2int(quantity);
-
-       compare = GetCompareFunction(op);
-       if (!compare) {
-               errl("Illegal comparison operation in if-timer", operation);
-       }
-
-       if (compare(GameTimer.Cycles, q)) {
-               return SCM_BOOL_T;
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfTimer(lua_State* l)
 {
        int q;
@@ -1499,37 +885,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **  Check the switch value
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclIfSwitch(SCM number, SCM set)
-{
-       int i;
-       unsigned char s;
-
-       i = gh_scm2int(number);
-       if (i < 0 || i >= MAX_SWITCH) {
-               errl("Invalid switch number", number);
-       }
-
-       if (gh_boolean_p(set)) {
-               s = gh_scm2bool(set);
-       } else {
-               s = gh_scm2int(set);
-               if (s) {
-                       s = 1;
-               }
-       }
-
-       if (Switch[i] == s) {
-               return SCM_BOOL_T;
-       }
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclIfSwitch(lua_State* l)
 {
        int i;
@@ -1562,7 +921,6 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /*---------------------------------------------------------------------------
 --             Actions
@@ -1570,15 +928,6 @@
 /**
 **  Action condition player wins.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclActionVictory(void)
-{
-       GameResult = GameVictory;
-       GamePaused = 1;
-       GameRunning = 0;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclActionVictory(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1591,20 +940,10 @@
        GameRunning = 0;
        return 0;
 }
-#endif
 
 /**
 **  Action condition player lose.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclActionDefeat(void)
-{
-       GameResult = GameDefeat;
-       GamePaused = 1;
-       GameRunning = 0;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclActionDefeat(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1617,20 +956,10 @@
        GameRunning = 0;
        return 0;
 }
-#endif
 
 /**
 **  Action condition player draw.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclActionDraw(void)
-{
-       GameResult = GameDraw;
-       GamePaused = 1;
-       GameRunning = 0;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclActionDraw(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1643,22 +972,10 @@
        GameRunning = 0;
        return 0;
 }
-#endif
 
 /**
 **  Action set timer
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclActionSetTimer(SCM cycles, SCM increasing)
-{
-       GameTimer.Cycles = gh_scm2int(cycles);
-       GameTimer.Increasing = gh_scm2int(increasing);
-       GameTimer.Init = 1;
-       GameTimer.LastUpdate = GameCycle;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclActionSetTimer(lua_State* l)
 {
        if (lua_gettop(l) != 2) {
@@ -1673,19 +990,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Action start timer
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclActionStartTimer(void)
-{
-       GameTimer.Running = 1;
-       GameTimer.Init = 1;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclActionStartTimer(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1697,18 +1005,10 @@
        GameTimer.Init = 1;
        return 0;
 }
-#endif
 
 /**
 **  Action stop timer
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclActionStopTimer(void)
-{
-       GameTimer.Running = 0;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclActionStopTimer(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1719,19 +1019,10 @@
        GameTimer.Running = 0;
        return 0;
 }
-#endif
 
 /**
 **  Action wait
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclActionWait(SCM ms)
-{
-       WaitFrame = FrameCounter +
-               (FRAMES_PER_SECOND * VideoSyncSpeed / 100 * gh_scm2int(ms) + 
999) / 1000;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclActionWait(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1743,35 +1034,10 @@
                (FRAMES_PER_SECOND * VideoSyncSpeed / 100 * (int)LuaToNumber(l, 
1) + 999) / 1000;
        return 0;
 }
-#endif
 
 /**
 **  Action stop timer
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclActionSetSwitch(SCM number, SCM set)
-{
-       int i;
-       unsigned char s;
-
-       i = gh_scm2int(number);
-       if (i < 0 || i >= MAX_SWITCH) {
-               errl("Invalid switch number", number);
-       }
-
-       if (gh_boolean_p(set)) {
-               s = gh_scm2bool(set);
-       } else {
-               s = gh_scm2int(set);
-               if (s) {
-                       s = 1;
-               }
-       }
-
-       Switch[i] = s;
-       return set;
-}
-#elif defined(USE_LUA)
 local int CclActionSetSwitch(lua_State* l)
 {
        int i;
@@ -1801,37 +1067,10 @@
        lua_pushvalue(l, 2);
        return 1;
 }
-#endif
 
 /**
 **  Add a trigger.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAddTrigger(SCM condition, SCM action)
-{
-       SCM var;
-
-       //
-       // Make a list of all triggers.
-       // A trigger is a pair of condition and action
-       //
-       var = gh_symbol2scm("*triggers*");
-
-       if (gh_null_p(symbol_value(var, NIL))) {
-               puts("Trigger not set, defining trigger");
-               setvar(var, cons(cons(condition, action), NIL), NIL);
-       } else {
-               // Search for the last element in the list
-               var = symbol_value(var, NIL);
-               while(!gh_null_p(gh_cdr(var))) {
-                       var = gh_cdr(var);
-               }
-               gh_set_cdr_x(var, cons(cons(condition, action), NIL));
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclAddTrigger(lua_State* l)
 {
        int i;
@@ -1884,7 +1123,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Set the current trigger number
@@ -1928,29 +1166,6 @@
 **
 **  @return        1 if the trigger should be removed
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local int TriggerExecuteAction(SCM script)
-{
-       SCM value;
-
-       value = NULL;
-
-       while (!gh_null_p(script)) {
-               value = gh_eval(gh_car(script), NIL);
-               script = gh_cdr(script);
-               if (WaitFrame > FrameCounter) {
-                       CclGcProtectedAssign(&WaitScript, script);
-                       return 0;
-               }
-       }
-
-       // If action returns false remove it
-       if (gh_null_p(value)) {
-               return 1;
-       }
-       return 0;
-}
-#elif defined(USE_LUA)
 local int TriggerExecuteAction(int script)
 {
        int ret;
@@ -1981,26 +1196,12 @@
        // If action returns false remove it
        return !ret;
 }
-#endif
 
 /**
 **  Remove a trigger
 **
 **  @param trig  Current trigger
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void TriggerRemoveTrigger(SCM trig)
-{
-       if (!gh_null_p(Trigger)) {
-               gh_set_car_x(trig, gh_car(Trigger));
-               gh_set_cdr_x(trig, gh_cdr(Trigger));
-       } else {
-               gh_set_car_x(trig, NIL);
-               gh_set_cdr_x(trig, NIL);
-       }
-       CclGcProtectedAssign(&Trigger, trig);
-}
-#elif defined(USE_LUA)
 local void TriggerRemoveTrigger(int trig)
 {
        lua_pushnil(Lua);
@@ -2008,62 +1209,12 @@
        lua_pushnil(Lua);
        lua_rawseti(Lua, -2, trig + 1);
 }
-#endif
 
 /**
 **  Check trigger each game cycle.
 */
 global void TriggersEachCycle(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       SCM pair;
-       SCM trig;
-       SCM value;
-       SCM script;
-
-       if (!Trigger) {
-               CclGcProtectedAssign(&Trigger, 
symbol_value(gh_symbol2scm("*triggers*"), NIL));
-       }
-       trig = Trigger;
-
-       if (WaitFrame > FrameCounter) {
-               return;
-       }
-       if (WaitFrame && WaitFrame <= FrameCounter) {
-               WaitFrame = 0;
-               if (TriggerExecuteAction(WaitScript)) {
-                       TriggerRemoveTrigger(WaitTrigger);
-               }
-               return;
-       }
-
-       if (GamePaused) {
-               return;
-       }
-
-       if (!gh_null_p(trig)) { // Next trigger
-               pair = gh_car(trig);
-               CclGcProtectedAssign(&Trigger, gh_cdr(trig));
-               CclGcProtectedAssign(&WaitTrigger, trig);
-               // Pair is condition action
-               if (!gh_null_p(pair)) {
-                       script = gh_car(pair);
-                       value = NULL;
-                       while (!gh_null_p(script)) {
-                               value = gh_eval(gh_car(script), NIL);
-                               script = gh_cdr(script);
-                       }
-                       // If condition is true execute action
-                       if (value != SCM_BOOL_F) {
-                               if (TriggerExecuteAction(gh_cdr(pair))) {
-                                       TriggerRemoveTrigger(trig);
-                               }
-                       }
-               }
-       } else {
-               CclGcProtectedAssign(&Trigger, NULL);
-       }
-#elif defined(USE_LUA)
        int triggers;
 
        lua_pushstring(Lua, "_triggers_");
@@ -2118,7 +1269,6 @@
                lua_settop(Lua, 1);
        }
        lua_pop(Lua, 1);
-#endif
 }
 
 /**
@@ -2126,43 +1276,8 @@
 */
 global void TriggerCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       Trigger = NIL;
-       WaitScript = NIL;
-       WaitTrigger  = NIL;
-       CclGcProtect(&Trigger);
-       CclGcProtect(&WaitScript);
-       CclGcProtect(&WaitTrigger);
-       gh_new_procedure2_0("add-trigger", CclAddTrigger);
-       gh_new_procedure1_0("set-trigger-number!", CclSetTriggerNumber);
-       // Conditions
-       gh_new_procedure4_0("if-unit", CclIfUnit);
-       gh_new_procedureN("if-unit-at", CclIfUnitAt);
-       gh_new_procedure5_0("if-near-unit", CclIfNearUnit);
-       gh_new_procedure5_0("if-rescued-near-unit", CclIfRescuedNearUnit);
-       gh_new_procedure3_0("if-opponents", CclIfOpponents);
-       gh_new_procedure4_0("if-resource", CclIfResource);
-       gh_new_procedure3_0("if-kills", CclIfKills);
-       gh_new_procedure3_0("if-score", CclIfScore);
-       gh_new_procedure2_0("if-elapsed", CclIfElapsed);
-       gh_new_procedure2_0("if-timer", CclIfTimer);
-       gh_new_procedure2_0("if-switch", CclIfSwitch);
-       // Actions
-       gh_new_procedure0_0("action-victory", CclActionVictory);
-       gh_new_procedure0_0("action-defeat", CclActionDefeat);
-       gh_new_procedure0_0("action-draw", CclActionDraw);
-       gh_new_procedure2_0("action-set-timer", CclActionSetTimer);
-       gh_new_procedure0_0("action-start-timer", CclActionStartTimer);
-       gh_new_procedure0_0("action-stop-timer", CclActionStopTimer);
-       gh_new_procedure1_0("action-wait", CclActionWait);
-       gh_new_procedure2_0("action-set-switch", CclActionSetSwitch);
-
-       gh_define("*triggers*", NIL);
-#elif defined(USE_LUA)
        lua_register(Lua, "AddTrigger", CclAddTrigger);
-#if 0
-       lua_register(Lua, "SetTriggerNumber!", CclSetTriggerNumber);
-#endif
+//     lua_register(Lua, "SetTriggerNumber!", CclSetTriggerNumber);
        // Conditions
        lua_register(Lua, "IfUnit", CclIfUnit);
        lua_register(Lua, "IfUnitAt", CclIfUnitAt);
@@ -2184,104 +1299,7 @@
        lua_register(Lua, "ActionStopTimer", CclActionStopTimer);
        lua_register(Lua, "ActionWait", CclActionWait);
        lua_register(Lua, "ActionSetSwitch", CclActionSetSwitch);
-#endif
-}
-
-/**
-**  Print a trigger from a LISP object.
-**  This is a modified version of lprin1g that prints
-**  (lambda) instead of #&lt;CLOSURE&gt;
-**
-**  @param exp  Expression
-**  @param f    File to print to
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void PrintTrigger(SCM exp, CLFile* f)
-{
-#ifdef USE_GUILE
-#else
-       SCM tmp;
-       long n;
-#if 0
-       struct user_type_hooks *p;
-#endif
-       extern char* subr_kind_str(long);
-
-       STACK_CHECK(&exp);
-       INTERRUPT_CHECK();
-       switch TYPE(exp) {
-       case tc_nil:
-               CLprintf(f, "()");
-               break;
-       case tc_cons:
-               CLprintf(f, "(");
-               PrintTrigger(car(exp), f);
-               for (tmp = cdr(exp); CONSP(tmp); tmp = cdr(tmp)) {
-                       CLprintf(f, " ");
-                       PrintTrigger(car(tmp), f);
-               }
-               if (NNULLP(tmp)) {
-                       CLprintf(f, " . ");
-                       PrintTrigger(tmp, f);
-               }
-               CLprintf(f, ")");
-               break;
-       case tc_flonum:
-               n = (long)FLONM(exp);
-               if (((double)n) == FLONM(exp)) {
-                       sprintf(tkbuffer, "%ld", n);
-               } else {
-                       sprintf(tkbuffer, "%g", FLONM(exp));
-               }
-               CLprintf(f, tkbuffer);
-               break;
-       case tc_symbol:
-               CLprintf(f, PNAME(exp));
-               break;
-       case tc_subr_0:
-       case tc_subr_1:
-       case tc_subr_2:
-       case tc_subr_2n:
-       case tc_subr_3:
-       case tc_subr_4:
-       case tc_subr_5:
-       case tc_lsubr:
-       case tc_fsubr:
-       case tc_msubr:
-               sprintf(tkbuffer, "#<%s ", subr_kind_str(TYPE(exp)));
-               CLprintf(f, tkbuffer);
-               CLprintf(f, (*exp).storage_as.subr.name);
-               CLprintf(f, ">");
-               break;
-       case tc_string:
-               CLprintf(f, "\"%s\"", (*exp).storage_as.string.data);
-               break;
-       case tc_closure:
-               CLprintf(f, "(lambda ");
-               if (CONSP((*exp).storage_as.closure.code)) {
-                       PrintTrigger(car((*exp).storage_as.closure.code), f);
-                       CLprintf(f, " ");
-                       PrintTrigger(cdr((*exp).storage_as.closure.code), f);
-               } else
-                       PrintTrigger((*exp).storage_as.closure.code, f);
-               CLprintf(f, ")");
-               break;
-       default:
-               break;
-#if 0
-               p = get_user_type_hooks(TYPE(exp));
-               if (p->prin1)
-                       (*p->prin1)(exp, f);
-               else {
-                       sprintf(tkbuffer, "#<UNKNOWN %d %p>", TYPE(exp), exp);
-                       CLprintf(f, tkbuffer);
-               }
-#endif
-       }
-#endif
 }
-#elif defined(USE_LUA)
-#endif
 
 /**
 **  Save the trigger module.
@@ -2296,7 +1314,7 @@
        int trigger;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: trigger $Id: trigger.c,v 1.52 2003/12/21 
10:51:31 wizzard Exp $\n\n");
+       CLprintf(file, ";;; MODULE: trigger $Id: trigger.c,v 1.53 2004/01/01 
21:24:07 jsalmon3 Exp $\n\n");
 
        i = 0;
        trigger = -1;
@@ -2313,7 +1331,8 @@
                list = gh_cdr(list);
                ++i;
        }
-       CLprintf(file, "(set-trigger-number! %d)\n", trigger);
+#endif
+//     CLprintf(file, "(set-trigger-number! %d)\n", trigger);
 
        if (GameTimer.Init) {
                CLprintf(file, "(action-set-timer %ld %d)\n",
@@ -2322,8 +1341,6 @@
                        CLprintf(file, "(action-start-timer)\n");
                }
        }
-#elif defined(USE_LUA)
-#endif
 }
 
 /**
@@ -2338,12 +1355,6 @@
 
        // FIXME: choose the triggers for game type
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       if (gh_null_p(symbol_value(gh_symbol2scm("*triggers*"), NIL))) {
-               DebugLevel0Fn("Default triggers\n");
-               gh_apply(symbol_value(gh_symbol2scm("single-player-triggers"), 
NIL), NIL);
-       }
-#elif defined(USE_LUA)
        lua_pushstring(Lua, "_triggers_");
        lua_gettable(Lua, LUA_GLOBALSINDEX);
        if (lua_isnil(Lua, -1)) {
@@ -2352,7 +1363,6 @@
                LuaCall(0, 1);
        }
        lua_pop(Lua, 1);
-#endif
 
        memset(Switch, 0, sizeof(Switch));
 }
Index: stratagus/src/include/Module.make
diff -u stratagus/src/include/Module.make:1.6 
stratagus/src/include/Module.make:1.7
--- stratagus/src/include/Module.make:1.6       Fri Dec 12 13:12:45 2003
+++ stratagus/src/include/Module.make   Fri Jan  2 08:24:08 2004
@@ -1,2 +1,2 @@
-HDRS += src/include/actions.h src/include/ai.h src/include/avi.h 
src/include/campaign.h src/include/ccl.h src/include/ccl_helpers.h 
src/include/ccl_sound.h src/include/cdaudio.h src/include/commands.h 
src/include/construct.h src/include/cursor.h src/include/deco.h 
src/include/depend.h src/include/editor.h src/include/fc_types.h 
src/include/font.h src/include/stratagus.h src/include/icons.h 
src/include/interface.h src/include/iocompat.h src/include/iolib.h 
src/include/libcda.h src/include/map.h src/include/master.h src/include/menus.h 
src/include/minimap.h src/include/missile.h src/include/movie.h 
src/include/mpq.h src/include/myendian.h src/include/net_lowlevel.h 
src/include/netconnect.h src/include/network.h src/include/pathfinder.h 
src/include/player.h src/include/pud.h src/include/rdtsc.h 
src/include/settings.h src/include/siod.h src/include/siodp.h 
src/include/sound.h src/include/sound_id.h src/include/sound_server.h 
src/include/spells.h src/include/tileset.h src/include/trigger.h 
src/include/ui.h src/include/unit.h src/include/unitsound.h 
src/include/unittype.h src/include/upgrade.h src/include/upgrade_structs.h 
src/include/video.h src/include/wav.h
+HDRS += src/include/actions.h src/include/ai.h src/include/avi.h 
src/include/campaign.h src/include/ccl.h src/include/ccl_helpers.h 
src/include/ccl_sound.h src/include/cdaudio.h src/include/commands.h 
src/include/construct.h src/include/cursor.h src/include/deco.h 
src/include/depend.h src/include/editor.h src/include/fc_types.h 
src/include/font.h src/include/stratagus.h src/include/icons.h 
src/include/interface.h src/include/iocompat.h src/include/iolib.h 
src/include/libcda.h src/include/map.h src/include/master.h src/include/menus.h 
src/include/minimap.h src/include/missile.h src/include/movie.h 
src/include/mpq.h src/include/myendian.h src/include/net_lowlevel.h 
src/include/netconnect.h src/include/network.h src/include/pathfinder.h 
src/include/player.h src/include/pud.h src/include/rdtsc.h 
src/include/settings.h src/include/sound.h src/include/sound_id.h 
src/include/sound_server.h src/include/spells.h src/include/tileset.h 
src/include/trigger.h src/include/ui.h src/include/unit.h 
src/include/unitsound.h src/include/unittype.h src/include/upgrade.h 
src/include/upgrade_structs.h src/include/video.h src/include/wav.h
 HDRS += src/include/etlib/dllist.h src/include/etlib/generic.h 
src/include/etlib/hash.h src/include/etlib/xmalloc.h
Index: stratagus/src/include/ccl.h
diff -u stratagus/src/include/ccl.h:1.48 stratagus/src/include/ccl.h:1.49
--- stratagus/src/include/ccl.h:1.48    Mon Dec 22 11:33:44 2003
+++ stratagus/src/include/ccl.h Fri Jan  2 08:24:08 2004
@@ -26,138 +26,17 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl.h,v 1.48 2003/12/22 00:33:44 wizzard Exp $
+//      $Id: ccl.h,v 1.49 2004/01/01 21:24:08 jsalmon3 Exp $
 
 #ifndef __CCL_H__
 #define __CCL_H__
 
 //@{
 
-#if !defined(USE_GUILE) && !defined(USE_SIOD) && !defined(USE_LUA)
-#define USE_SIOD
-#endif
-
 /*----------------------------------------------------------------------------
 --  Includes
 ----------------------------------------------------------------------------*/
 
-#if defined(USE_GUILE)
-
-
-#  include <guile/gh.h>
-#  define get_c_string(lisp)      CclConvertToString(lisp)
-#  define try_get_c_string(lisp)  CclConvertToString(lisp)
-#  define symbol_value(x, env)    scm_variable_ref(scm_lookup(x))
-#  define NIL                     SCM_EOL
-#  define cons(a, b)              gh_cons(a, b)
-#  define symbol_boundp(x, env)   (!SCM_UNBNDP(x))
-#  define fast_load(s_filename, bogus)  scm_primitive_load(s_filename)
-#  define cons_array              gh_make_vector
-#  define gh_eval(expr, env)      scm_primitive_eval(expr)
-#  define setvar(sym, value, env) scm_define(sym,value)
-#  define vload(buf,cflag,rflag)  gh_load(buf)
-#  define errl(message, value)    { fputs(message, stdout); gh_display(value); 
putchar('\n'); }
-#  define lprin1CL(var, file)     { char * tmp; tmp = CclRepresentation(var); 
CLprintf(file, "%s", tmp); free(tmp); }
-#  define gh_new_procedureN(name, proc) gh_new_procedure(name, proc, 0, 0, 1)
-#  define aset1(array, pos, value)  gh_vector_set_x(array, pos, value)
-#  define repl_c_string(msg, a, b, c)   gh_eval_str(msg)
-#  define print_welcome()
-#  define gh_scm2newstr(scm, lenp) \
-  (gh_symbol_p(scm) ? gh_symbol2newstr(scm, lenp) : gh_scm2newstr(scm,lenp))
-#  define gh_scm2int(val) \
-  (gh_inexact_p(val) ? (int)gh_scm2double(val) : gh_scm2int(val))
-#  define gh_scm2long(val) \
-  (gh_inexact_p(val) ? (long)gh_scm2double(val) : gh_scm2long(val))
-
-extern int siod_verbose_level;
-struct gen_printio* f;
-typedef scm_t_bits ccl_smob_type_t;
-extern char* CclRepresentation(SCM value);
-
-
-#elif defined(USE_SIOD)
-
-
-#  include <string.h>
-#  include "siod.h"
-#  include "siodp.h"
-
-extern LISP fast_load(LISP lfname,LISP noeval);
-/*----------------------------------------------------------------------------
---  Macros
-----------------------------------------------------------------------------*/
-
-//
-//  Macros for compatibility with guile high level interface.
-//
-
-#define SCM LISP
-#define SCM_UNSPECIFIED NIL
-#define gh_null_p(lisp) NULLP(lisp)
-
-#define gh_eq_p(lisp1, lisp2)  EQ(lisp1, lisp2)
-
-#define gh_list_p(lisp)  CONSP(lisp)
-#define gh_car(lisp)     car(lisp)
-#define gh_cdr(lisp)     cdr(lisp)
-#define gh_caar(lisp)    caar(lisp)
-#define gh_cadr(lisp)    cadr(lisp)
-#define gh_cddr(lisp)    cddr(lisp)
-#define gh_length(lisp)  nlength(lisp)
-
-#define gh_set_car_x(pair, val) setcar(pair, val)
-#define gh_set_cdr_x(pair, val) setcdr(pair, val)
-
-#define gh_exact_p(lisp)   TYPEP(lisp, tc_flonum)
-#define gh_scm2int(lisp)   (long)FLONM(lisp)
-#define gh_scm2long(lisp)  (long)FLONM(lisp)
-#define gh_int2scm(num)    flocons(num)
-
-#define gh_string_p(lisp)        TYPEP(lisp, tc_string)
-#define gh_scm2newstr(lisp,str)  strdup(get_c_string(lisp))
-#define gh_str02scm(str)         strcons(strlen(str), str)
-
-#define gh_vector_p(lisp) \
-               (TYPE(lisp) >= tc_string && TYPE(lisp) <= tc_byte_array)
-#define gh_vector_length(lisp)  nlength(lisp)
-#define gh_vector_ref(lisp,n)   aref1(lisp,n)
-
-#define gh_boolean_p(lisp)  (EQ(lisp,sym_t) || NULLP(lisp))
-#define gh_scm2bool(lisp)   (NNULLP(lisp))
-#define gh_bool2scm(n)      ((n) ? SCM_BOOL_T : SCM_BOOL_F)
-
-#define gh_symbol_p(lisp)   SYMBOLP(lisp)
-#define gh_symbol2scm(str)  cintern(str)
-
-#define gh_define(str,val)  setvar(rintern((str)), (val), NIL)
-
-#define gh_display(lisp)    lprin1f(lisp, stdout)
-#define gh_newline()        fprintf(stdout, "\n")
-
-#define gh_load(str)        vload(str,0,0)
-
-#define gh_apply(proc,args)  lapply(proc,args)
-#define gh_eval(proc,env)    leval(proc,env)
-
-#define gh_new_procedure0_0  init_subr_0
-#define gh_new_procedure1_0  init_subr_1
-#define gh_new_procedure2_0  init_subr_2
-#define gh_new_procedure3_0  init_subr_3
-#define gh_new_procedure4_0  init_subr_4
-#define gh_new_procedure5_0  init_subr_5
-#define gh_new_procedureN    init_lsubr
-
-#define SCM_BOOL_T  sym_t
-#define SCM_BOOL_F  NIL
-
-#define gh_vector_set_x(array, pos, value)  aset1(array, pos, value)
-
-extern LISP sym_t;
-typedef long ccl_smob_type_t;
-
-
-#elif defined(USE_LUA)
-
 #include "lua.h"
 #include "lauxlib.h"
 #include "lualib.h"
@@ -178,15 +57,9 @@
 extern int LuaCall(int narg, int clear);
 
 
-#endif // USE_LUA
-
 
 #include "iolib.h"
 
-#if 0
-extern SCM CclEachSecond;  /// Scheme function called each second
-#endif
-
 /*----------------------------------------------------------------------------
 --  Variables
 ----------------------------------------------------------------------------*/
@@ -198,23 +71,11 @@
 --  Functions
 ----------------------------------------------------------------------------*/
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern char*            CclConvertToString(SCM scm);
-extern ccl_smob_type_t  CclMakeSmobType(const char* name);
-extern SCM              CclMakeSmobObj(ccl_smob_type_t tag, void* ptr);
-extern void*            CclGetSmobData(SCM smob);
-extern ccl_smob_type_t  CclGetSmobType(SCM smob);
-
-extern void CclGcProtect(SCM* obj);    /// Protect scm var for GC
-extern void CclGcUnprotect(SCM* obj);  /// Unprotect scm var for GC
-extern void CclGcProtectedAssign(SCM* obj, SCM value);  /// Alter garbage 
protected scm var.
-#elif defined(USE_LUA)
 extern const char* LuaToString(lua_State* l, int narg);
 extern lua_Number LuaToNumber(lua_State* l, int narg);
 extern int LuaToBoolean(lua_State* l, int narg);
-#endif
+
 extern void CclGarbageCollect(int fast);  /// Perform garbage collection
-extern void CclFlushOutput();             /// Flush ccl output
 extern void InitCcl(void);                /// Initialise ccl
 extern void LoadCcl(void);                /// Load ccl config file
 extern void SaveCcl(CLFile* file);        /// Save CCL module
Index: stratagus/src/include/ccl_helpers.h
diff -u stratagus/src/include/ccl_helpers.h:1.6 
stratagus/src/include/ccl_helpers.h:1.7
--- stratagus/src/include/ccl_helpers.h:1.6     Mon Dec 22 12:17:01 2003
+++ stratagus/src/include/ccl_helpers.h Fri Jan  2 08:24:08 2004
@@ -26,170 +26,13 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl_helpers.h,v 1.6 2003/12/22 01:17:01 wizzard Exp $
+//      $Id: ccl_helpers.h,v 1.7 2004/01/01 21:24:08 jsalmon3 Exp $
 
 #ifndef __CCL_HELPERS__
 #define __CCL_HELPERS__
 
 
 //@{
-
-/*----------------------------------------------------------------------------
---  Documentation
-----------------------------------------------------------------------------*/
-
-/**
-**
-**  This Module is a translator to and from scheme.
-**
-**  It builds a nice looking scheme list from a structure and it's description
-**  It can also load a structure from this list and the description
-**
-**  The IOLoadingMode variable control wether IO functions will load or save 
datas.
-**  Theses IO functions all take the same parameters :
-**    A list : The ccl list to translate into data (unused when saving)
-**    A pointer : points to the structure to load,
-**      or to a (structure*), when loading a ptr
-**    A parameter which is used differently by the functions
-**
-**  Example:
-**    1 To load or save a unit ptr
-**
-**    void load_dummy_struct(void)
-**    {
-**       Unit* u;
-**       IOLoadingMode=1;
-**       IOUnitPtr(list, (void*)&u, 0);
-**    }
-**
-**
-**    2 To load/save a full struct
-**
-**    If the struct is :
-**
-**    typedef struct _my_struct_{
-**      UnitType* unit;
-**      int       count;
-**    } MyStruct;
-**
-**    These describe the structure :
-**
-**    IOStructDef MyStructDef = {
-**      "MyStruct",                /// Name
-**      sizeof(MyStruct),          /// Size
-**      -1,                        /// Array size
-**      {
-**       {"unit", IOUnitPtr, &((MyStruct *) 0)->Unit, 0},
-**       {"count", IOInt, &((MyStruct *) 0)->Count, 0},
-**       { 0,0,0,0 }
-**      }
-**
-**    Then :
-**      IOStructPtr(list,(void*)&myglobalstructptr,(void*)&MyStructDef);
-**      This code will load or save the myglobalstructptr, depending on 
IOLoadingMode value
-**
-**      There are more facility available ( for handling arrays,linked 
list,... ).
-**      Have a look at the differents IOxxx functions for details
-*/
-
-/*----------------------------------------------------------------------------
---  Structures
-----------------------------------------------------------------------------*/
-
-/**
-**  Definition of flags.
-**  Each flag map an int value to a SCM symbol
-*/
-typedef struct _io_flag_def_ {
-       char* ident;  /// Flag name
-       int   value;  /// Flag value
-} IOFlagDef;
-
-/**
-**  The IOFieldDef structure define each field in a structure
-**  The name of the field is used to identify the field in Scheme LIST.
-**
-**  The fonction receive as parameter (binaryform), a void pointer to the field
-*/
-typedef struct _io_field_def_ {
-       char* name;  /// Name of the field ( used as ccl ident )
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       void (*convertfunc) (SCM scmfrom, void* binaryform, void* para);
-       /// Function to load/save the field
-#elif defined(USE_LUA)
-#endif
-       void* offset;  /// Offset of the field in the structure
-       void* para;    /// Parameter passed to the field
-} IOFieldDef;
-
-/**
-**  The IOStructDef define a full structure, for loading & saving.
-**  It is meant to be used with the IOStruct or IOStruct parameter,
-**  to load or save a structure (depending on IOLoadingMode value)
-**
-*/
-typedef struct _io_struct_def_ {
-       char*      name;        /// Name of the structure (debugging only)
-       int        size;        /// Size of the structure (for malloc)
-       int        array_size;  /// Number of element when in an array
-       IOFieldDef defs[];      /// Definition of fields, terminated by a null 
field
-} IOStructDef;
-
-/*----------------------------------------------------------------------------
---  Variables
-----------------------------------------------------------------------------*/
-extern int          IOLoadingMode;  /// IOxxx functions do load (1) or save 
(0) struct
-extern unsigned int IOTabLevel;     /// When saving to ccl, current 
indentation level
-extern CLFile*      IOOutFile;      /// When saving to ccl, output file
-
-/*----------------------------------------------------------------------------
---  Functions
-----------------------------------------------------------------------------*/
-
-       /// Print "IOTabLevel" tabs on the ccl output
-extern void IOPrintTabs();
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       /// Handle saving/loading of structure
-extern void IOStruct(SCM scmform, void* binaryform, void* para);
-       /// Handle saving/loading a pointer to a structure.
-extern void IOStructPtr(SCM scmform, void* binaryform, void* para);
-       /// Handle loading a fixed size array of structure.
-extern void IOStructArray(SCM from, void* binaryform, void* para);
-       /// Handle saving/loading linked list.
-extern void IOLinkedList(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading tables.
-extern void IOTable(SCM scmfrom, void* binaryform, void* para);
-       /// Handle the case of saving/loading pointers which are null
-extern int IOHandleNullPtr(SCM scmfrom, void* binaryform);
-       /// Handle saving/loading of int
-extern void IOInt(SCM scmform, void* binaryform, void* para);
-       /// Handle saving/loading of bool stored as int
-extern void IOBool(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading of bool stored as char
-extern void IOCharBool(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading of string
-extern void IOString(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading of SCM
-extern void IOCcl(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading of flag stored in char
-extern void IOCharFlag(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading a fixed length string
-extern void IOStrBuffer(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading a dynamic array of int
-extern void IOIntArrayPtr(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading an already allocated array of int
-extern void IOIntArray(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading an unittype pointer (UnitType*)
-extern void IOUnitTypePtr(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading a reference to an unit (Unit*)
-extern void IOUnitPtr(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading a reference to an upgrade (Upgrade*)
-extern void IOUpgradePtr(SCM scmfrom, void* binaryform, void* para);
-       /// Handle saving/loading a reference to a player (Player*)
-extern void IOPlayerPtr(SCM scmfrom, void* binaryform, void* para);
-#elif defined(USE_LUA)
-#endif
-
 //@}
 
 #endif // !__CCL_H__
Index: stratagus/src/include/ccl_sound.h
diff -u stratagus/src/include/ccl_sound.h:1.21 
stratagus/src/include/ccl_sound.h:1.22
--- stratagus/src/include/ccl_sound.h:1.21      Mon Dec 22 12:17:01 2003
+++ stratagus/src/include/ccl_sound.h   Fri Jan  2 08:24:08 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl_sound.h,v 1.21 2003/12/22 01:17:01 wizzard Exp $
+//      $Id: ccl_sound.h,v 1.22 2004/01/01 21:24:08 jsalmon3 Exp $
 
 #ifndef __CCL_SOUND_H__
 #define __CCL_SOUND_H__
@@ -44,13 +44,6 @@
 /*----------------------------------------------------------------------------
 --  Functions
 ----------------------------------------------------------------------------*/
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern int ccl_sound_p(SCM sound);  /// is it a ccl sound?
-
-extern SoundId ccl_sound_id(SCM sound);  /// scheme -> sound id
-#elif defined(USE_LUA)
-#endif
 
 extern void SoundCclRegister(void);  /// register ccl features
 
Index: stratagus/src/include/font.h
diff -u stratagus/src/include/font.h:1.32 stratagus/src/include/font.h:1.33
--- stratagus/src/include/font.h:1.32   Mon Dec 22 12:50:36 2003
+++ stratagus/src/include/font.h        Fri Jan  2 08:24:08 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: font.h,v 1.32 2003/12/22 01:50:36 wizzard Exp $
+//      $Id: font.h,v 1.33 2004/01/01 21:24:08 jsalmon3 Exp $
 
 #ifndef __FONT_H__
 #define __FONT_H__
@@ -176,11 +176,7 @@
        /// Check if font is loaded
 extern int IsFontLoaded(unsigned font);
        /// Font symbol to id
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern int CclFontByIdentifier(SCM type);
-#elif defined(USE_LUA)
 extern int CclFontByIdentifier(const char* type);
-#endif
 
 //@}
 
Index: stratagus/src/include/spells.h
diff -u stratagus/src/include/spells.h:1.43 stratagus/src/include/spells.h:1.44
--- stratagus/src/include/spells.h:1.43 Sat Dec 20 16:33:28 2003
+++ stratagus/src/include/spells.h      Fri Jan  2 08:24:08 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: spells.h,v 1.43 2003/12/20 05:33:28 jsalmon3 Exp $
+//     $Id: spells.h,v 1.44 2004/01/01 21:24:08 jsalmon3 Exp $
 
 #ifndef __SPELLS_H__
 #define __SPELLS_H__
@@ -322,17 +322,10 @@
 /// return spell type by spell id
 extern SpellType* SpellTypeById(int Id);
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern unsigned CclGetSpellByIdent(SCM value);
-
-// return 0, 1, 2 for true, only, false.
-extern char Scm2Condition(SCM value);
-#elif defined(USE_LUA)
 extern unsigned CclGetSpellByIdent(lua_State* l);
 
 // return 0, 1, 2 for true, only, false.
 extern char Ccl2Condition(lua_State* l, const char* value);
-#endif
 
 /*
 **             Spelltype to cast.
Index: stratagus/src/include/trigger.h
diff -u stratagus/src/include/trigger.h:1.16 
stratagus/src/include/trigger.h:1.17
--- stratagus/src/include/trigger.h:1.16        Sat Dec 20 16:33:28 2003
+++ stratagus/src/include/trigger.h     Fri Jan  2 08:24:08 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: trigger.h,v 1.16 2003/12/20 05:33:28 jsalmon3 Exp $
+//     $Id: trigger.h,v 1.17 2004/01/01 21:24:08 jsalmon3 Exp $
 
 #ifndef __TRIGGER_H__
 #define __TRIGGER_H__
@@ -69,13 +69,8 @@
 --             Functions
 ----------------------------------------------------------------------------*/
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern int TriggerGetPlayer(SCM player);/// get player number.
-extern const UnitType* TriggerGetUnitType(SCM unit);           /// get the 
unit-type
-#elif defined(USE_LUA)
 extern int TriggerGetPlayer(lua_State* l);/// get player number.
 extern const UnitType* TriggerGetUnitType(lua_State* l);               /// get 
the unit-type
-#endif
 extern void TriggersEachCycle(void);           /// test triggers
 
 extern void TriggerCclRegister(void);          /// Register ccl features
Index: stratagus/src/map/ccl_map.c
diff -u stratagus/src/map/ccl_map.c:1.48 stratagus/src/map/ccl_map.c:1.49
--- stratagus/src/map/ccl_map.c:1.48    Sat Dec 20 16:33:30 2003
+++ stratagus/src/map/ccl_map.c Fri Jan  2 08:24:09 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_map.c,v 1.48 2003/12/20 05:33:30 jsalmon3 Exp $
+//     $Id: ccl_map.c,v 1.49 2004/01/01 21:24:09 jsalmon3 Exp $
 
 //@{
 
@@ -248,18 +248,6 @@
 /**
 **             Reveal the complete map.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclRevealMap(void)
-{
-       if (CclInConfigFile) {
-               FlagRevealMap = 1;
-       } else {
-               RevealMap();
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclRevealMap(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -274,7 +262,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Center the map.
@@ -282,13 +269,6 @@
 **             @param x                X tile location.
 **             @param y                Y tile location.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclCenterMap(SCM x, SCM y)
-{
-       ViewportCenterViewpoint(TheUI.SelectedViewport, gh_scm2int(x), 
gh_scm2int(y));
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclCenterMap(lua_State* l)
 {
        if (lua_gettop(l) != 2) {
@@ -300,7 +280,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Show Map Location
@@ -311,27 +290,6 @@
 **             @param          cycle           cycles show vision for.
 **             @param          unit            name of unit to use for showing 
map
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowMapLocation(SCM x, SCM y, SCM radius, SCM cycle, SCM unit)
-{
-       Unit* target;
-       char* unitname;
-       // Put a unit on map, use it's properties, except for
-       // what is listed below
-
-       unitname = gh_scm2newstr(unit,NULL);
-       target = MakeUnit(UnitTypeByIdent(unitname), ThisPlayer);
-       target->Orders[0].Action = UnitActionStill;
-       target->HP = 0;
-       target->X = gh_scm2int(x);
-       target->Y = gh_scm2int(y);
-       target->TTL = GameCycle + gh_scm2int(cycle);
-       target->CurrentSightRange = gh_scm2int(radius);
-       MapMarkUnitSight(target);
-       free(unitname);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowMapLocation(lua_State* l)
 {
        Unit* target;
@@ -354,7 +312,6 @@
        MapMarkUnitSight(target);
        return 0;
 }
-#endif
 
 /**
 **             Set the default map.
@@ -363,22 +320,6 @@
 **
 **             @return                         The old default map.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetDefaultMap(SCM map)
-{
-       SCM old;
-       char* str;
-
-       old = NIL;
-       if (!gh_null_p(map)) {
-               old = gh_str02scm(DefaultMap);
-               str = gh_scm2newstr(map, NULL);
-               strcpy(DefaultMap, str);
-               free(str);
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetDefaultMap(lua_State* l)
 {
        char* old;
@@ -394,7 +335,6 @@
        free(old);
        return 1;
 }
-#endif
 
 /**
 **             Set fog of war on/off.
@@ -403,20 +343,6 @@
 **
 **             @return                         The old state of fog of war.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetFogOfWar(SCM flag)
-{
-       int old;
-
-       old = !TheMap.NoFogOfWar;
-       TheMap.NoFogOfWar = !gh_scm2bool(flag);
-       if (!CclInConfigFile) {
-               UpdateFogOfWarChange();
-       }
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetFogOfWar(lua_State* l)
 {
        int old;
@@ -434,7 +360,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Enable display of terrain in minimap.
@@ -443,17 +368,6 @@
 **
 **             @return                         The old state of the minimap 
with terrain.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMinimapTerrain(SCM flag)
-{
-       int old;
-
-       old = MinimapWithTerrain;
-       MinimapWithTerrain = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetMinimapTerrain(lua_State* l)
 {
        int old;
@@ -468,23 +382,10 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Original fog of war.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclOriginalFogOfWar(void)
-{
-       OriginalFogOfWar = 1;
-
-       if (!CclInConfigFile) {
-               InitMapFogOfWar();
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclOriginalFogOfWar(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -499,23 +400,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Alpha style fog of war.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAlphaFogOfWar(void)
-{
-       OriginalFogOfWar = 0;
-
-       if (!CclInConfigFile) {
-               InitMapFogOfWar();
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclAlphaFogOfWar(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -530,33 +418,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Gray style fog of war contrast.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetFogOfWarContrast(SCM contrast)
-{
-       int i;
-       int old;
-
-       i = gh_scm2int(contrast);
-       if (i < 0 || i > 400) {
-               PrintFunction();
-               fprintf(stdout, "Contrast should be 0 - 400\n");
-               i = 100;
-       }
-       old = FogOfWarContrast;
-       FogOfWarContrast = i;
-
-       if (!CclInConfigFile) {
-               InitMapFogOfWar();
-       }
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetFogOfWarContrast(lua_State* l)
 {
        int i;
@@ -582,33 +447,10 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Gray style fog of war brightness.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetFogOfWarBrightness(SCM brightness)
-{
-       int i;
-       int old;
-
-       i = gh_scm2int(brightness);
-       if (i < -100 || i > 100) {
-               PrintFunction();
-               fprintf(stdout, "Brightness should be -100 - 100\n");
-               i = 0;
-       }
-       old = FogOfWarBrightness;
-       FogOfWarBrightness = i;
-
-       if (!CclInConfigFile) {
-               InitMapFogOfWar();
-       }
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetFogOfWarBrightness(lua_State* l)
 {
        int i;
@@ -634,33 +476,10 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Gray style fog of war saturation.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetFogOfWarSaturation(SCM saturation)
-{
-       int i;
-       int old;
-
-       i = gh_scm2int(saturation);
-       if (i < -100 || i > 200) {
-               PrintFunction();
-               fprintf(stdout, "Saturation should be -100 - 200\n");
-               i = 0;
-       }
-       old = FogOfWarSaturation;
-       FogOfWarSaturation = i;
-
-       if (!CclInConfigFile) {
-               InitMapFogOfWar();
-       }
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetFogOfWarSaturation(lua_State* l)
 {
        int i;
@@ -686,7 +505,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set forest regeneration speed.
@@ -695,24 +513,6 @@
 **
 **             @return                         Old speed
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetForestRegeneration(SCM speed)
-{
-       int i;
-       int old;
-
-       i = gh_scm2int(speed);
-       if (i < 0 || i > 255) {
-               PrintFunction();
-               fprintf(stdout, "Regneration speed should be 0 - 255\n");
-               i = 0;
-       }
-       old = ForestRegeneration;
-       ForestRegeneration = i;
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetForestRegeneration(lua_State* l)
 {
        int i;
@@ -738,32 +538,12 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Register CCL features for map.
 */
 global void MapCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("stratagus-map", CclStratagusMap);
-       gh_new_procedure0_0("reveal-map", CclRevealMap);
-       gh_new_procedure2_0("center-map", CclCenterMap);
-       gh_new_procedure5_0("show-map-location", CclShowMapLocation);
-
-       gh_new_procedure1_0("set-default-map!", CclSetDefaultMap);
-       gh_new_procedure1_0("set-fog-of-war!", CclSetFogOfWar);
-       gh_new_procedure1_0("set-minimap-terrain!", CclSetMinimapTerrain);
-
-       gh_new_procedure0_0("original-fog-of-war", CclOriginalFogOfWar);
-       gh_new_procedure0_0("alpha-fog-of-war", CclAlphaFogOfWar);
-
-       gh_new_procedure1_0("set-fog-of-war-contrast!", CclSetFogOfWarContrast);
-       gh_new_procedure1_0("set-fog-of-war-brightness!", 
CclSetFogOfWarBrightness);
-       gh_new_procedure1_0("set-fog-of-war-saturation!", 
CclSetFogOfWarSaturation);
-
-       
gh_new_procedure1_0("set-forest-regeneration!",CclSetForestRegeneration);
-#elif defined(USE_LUA)
 //     lua_register(Lua, "StratagusMap", CclStratagusMap);
        lua_register(Lua, "RevealMap", CclRevealMap);
        lua_register(Lua, "CenterMap", CclCenterMap);
@@ -781,7 +561,6 @@
        lua_register(Lua, "SetFogOfWarSaturation", CclSetFogOfWarSaturation);
 
        lua_register(Lua, "SetForestRegeneration",CclSetForestRegeneration);
-#endif
 }
 
 //@}
Index: stratagus/src/map/ccl_tileset.c
diff -u stratagus/src/map/ccl_tileset.c:1.35 
stratagus/src/map/ccl_tileset.c:1.36
--- stratagus/src/map/ccl_tileset.c:1.35        Sat Dec 20 16:33:30 2003
+++ stratagus/src/map/ccl_tileset.c     Fri Jan  2 08:24:09 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_tileset.c,v 1.35 2003/12/20 05:33:30 jsalmon3 Exp $
+//     $Id: ccl_tileset.c,v 1.36 2004/01/01 21:24:09 jsalmon3 Exp $
 
 //@{
 
@@ -52,37 +52,6 @@
 **
 **             @param list             List of all names.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineTilesetWcNames(SCM list)
-{
-       int i;
-       char** cp;
-
-       if ((cp = TilesetWcNames)) {            // Free all old names
-               while (*cp) {
-                       free(*cp++);
-               }
-               free(TilesetWcNames);
-       }
-
-       //
-       //              Get new table.
-       //
-       i = gh_length(list);
-       TilesetWcNames = cp = malloc((i + 1) * sizeof(char*));
-       if (!cp) {
-               fprintf(stderr, "out of memory.\n");
-               ExitFatal(-1);
-       }
-       while (i--) {
-               *cp++ = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-       }
-       *cp = NULL;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineTilesetWcNames(lua_State* l)
 {
        int i;
@@ -113,7 +82,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Extend tables of the tileset.
@@ -148,28 +116,6 @@
 **             @param tileset          Tileset currently parsed.
 **             @param list             List with name.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local int TilesetParseName(Tileset* tileset, SCM list)
-{
-       char* ident;
-       int i;
-
-       ident = gh_scm2newstr(gh_car(list), NULL);
-       for (i = 0; i < tileset->NumTerrainTypes; ++i) {
-               if (!strcmp(ident, tileset->SolidTerrainTypes[i].TerrainName)) {
-                       free(ident);
-                       return i;
-               }
-       }
-
-       //  Can't find it, then we add another solid terrain type.
-       tileset->SolidTerrainTypes = realloc(tileset->SolidTerrainTypes,
-               ++tileset->NumTerrainTypes * 
sizeof(*tileset->SolidTerrainTypes));
-       tileset->SolidTerrainTypes[i].TerrainName = ident;
-
-       return i;
-}
-#elif defined(USE_LUA)
 local int TilesetParseName(lua_State* l, Tileset* tileset)
 {
        char* ident;
@@ -190,7 +136,6 @@
 
        return i;
 }
-#endif
 
 /**
 **             Parse the flag section of a tile definition.
@@ -200,62 +145,6 @@
 **
 **             @return                         remaining list
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM ParseTilesetTileFlags(SCM list, int* back)
-{
-       int flags;
-
-       //
-       //  Parse the list: flags of the slot
-       //
-       flags = 0;
-       while (!gh_null_p(list)) {
-               SCM value;
-
-               value = gh_car(list);
-
-               if (!gh_symbol_p(value)) {
-                       break;
-               }
-               list = gh_cdr(list);
-
-               //
-               //        Flags are only needed for the editor
-               //
-               if (gh_eq_p(value, gh_symbol2scm("water"))) {
-                       flags |= MapFieldWaterAllowed;
-               } else if (gh_eq_p(value, gh_symbol2scm("land"))) {
-                       flags |= MapFieldLandAllowed;
-               } else if (gh_eq_p(value, gh_symbol2scm("coast"))) {
-                       flags |= MapFieldCoastAllowed;
-               } else if (gh_eq_p(value, gh_symbol2scm("no-building"))) {
-                       flags |= MapFieldNoBuilding;
-               } else if (gh_eq_p(value, gh_symbol2scm("unpassable"))) {
-                       flags |= MapFieldUnpassable;
-               } else if (gh_eq_p(value, gh_symbol2scm("wall"))) {
-                       flags |= MapFieldWall;
-               } else if (gh_eq_p(value, gh_symbol2scm("rock"))) {
-                       flags |= MapFieldRocks;
-               } else if (gh_eq_p(value, gh_symbol2scm("forest"))) {
-                       flags |= MapFieldForest;
-               } else if (gh_eq_p(value, gh_symbol2scm("land-unit"))) {
-                       flags |= MapFieldLandUnit;
-               } else if (gh_eq_p(value, gh_symbol2scm("air-unit"))) {
-                       flags |= MapFieldAirUnit;
-               } else if (gh_eq_p(value, gh_symbol2scm("sea-unit"))) {
-                       flags |= MapFieldSeaUnit;
-               } else if (gh_eq_p(value, gh_symbol2scm("building"))) {
-                       flags |= MapFieldBuilding;
-               } else if (gh_eq_p(value, gh_symbol2scm("human"))) {
-                       flags |= MapFieldHuman;
-               } else {
-                       errl("solid: unsupported tag", value);
-               }
-       }
-       *back = flags;
-       return list;
-}
-#elif defined(USE_LUA)
 local void ParseTilesetTileFlags(lua_State* l, int* back, int* j)
 {
        int flags;
@@ -311,7 +200,6 @@
        }
        *back = flags;
 }
-#endif
 
 /**
 **             Parse the special slot part of a tileset definition
@@ -319,68 +207,6 @@
 **             @param tileset          Tileset to be filled.
 **             @param list             Tagged list defining a special slot.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void DefineTilesetParseSpecial(Tileset* tileset, SCM list)
-{
-       SCM value;
-       SCM data;
-       int i;
-
-       //
-       //              Parse the list:         (still everything could be 
changed!)
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               data = gh_car(list);
-               list = gh_cdr(list);
-
-               //
-               //              top-one-tree, mid-one-tree, bot-one-tree
-               //
-               if (gh_eq_p(value, gh_symbol2scm("top-one-tree"))) {
-                       tileset->TopOneTree = gh_scm2int(data);
-               } else if (gh_eq_p(value, gh_symbol2scm("mid-one-tree"))) {
-                       tileset->MidOneTree = gh_scm2int(data);
-               } else if (gh_eq_p(value, gh_symbol2scm("bot-one-tree"))) {
-                       tileset->BotOneTree = gh_scm2int(data);
-               //
-               //              removed-tree
-               //
-               } else if (gh_eq_p(value, gh_symbol2scm("removed-tree"))) {
-                       tileset->RemovedTree = gh_scm2int(data);
-               //
-               //              growing-tree
-               //
-               } else if (gh_eq_p(value, gh_symbol2scm("growing-tree"))) {
-                       if (gh_vector_length(data) != 2) {
-                               errl("growing-tree: Wrong vector length", data);
-                       }
-                       for (i = 0; i < 2; ++i) {
-                               value = gh_vector_ref(data, gh_int2scm(i));
-                               tileset->GrowingTree[i] = gh_scm2int(value);
-                       }
-
-               //
-               //              top-one-rock, mid-one-rock, bot-one-rock
-               //
-               } else if (gh_eq_p(value, gh_symbol2scm("top-one-rock"))) {
-                       tileset->TopOneRock = gh_scm2int(data);
-               } else if (gh_eq_p(value, gh_symbol2scm("mid-one-rock"))) {
-                       tileset->MidOneRock = gh_scm2int(data);
-               } else if (gh_eq_p(value, gh_symbol2scm("bot-one-rock"))) {
-                       tileset->BotOneRock = gh_scm2int(data);
-               //
-               //              removed-rock
-               //
-               } else if (gh_eq_p(value, gh_symbol2scm("removed-rock"))) {
-                       tileset->RemovedRock = gh_scm2int(data);
-               } else {
-                       errl("special: unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void DefineTilesetParseSpecial(lua_State* l, Tileset* tileset)
 {
        const char* value;
@@ -481,7 +307,6 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse the solid slot part of a tileset definition
@@ -490,58 +315,6 @@
 **             @param index            Current table index.
 **             @param list             Tagged list defining a solid slot.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local int DefineTilesetParseSolid(Tileset* tileset, int index, SCM list)
-{
-       SCM value;
-       SCM data;
-       int i;
-       int f;
-       int l;
-       int basic_name;
-       SolidTerrainInfo* tt;// short for terrain type.
-
-       ExtendTilesetTables(tileset, index + 16);
-
-       basic_name = TilesetParseName(tileset, list);           // base name
-       tt = tileset->SolidTerrainTypes + basic_name;
-       list = gh_cdr(list);
-
-       list = ParseTilesetTileFlags(list, &f);
-
-       //
-       //              Vector: the tiles.
-       //
-       value = gh_car(list);
-       tt->NumSolidTiles = l = gh_vector_length(value);
-
-       // hack for sc tilesets, remove when fixed
-       if (l > 16) {
-               ExtendTilesetTables(tileset, index + l);
-       }
-
-       for (i = 0; i < l; ++i) {
-               data = gh_vector_ref(value, gh_int2scm(i));
-//             tt->SolidTiles[i] = tileset->Table[index + i] = 
gh_scm2int(data);
-               tileset->Table[index + i] = gh_scm2int(data);
-               tileset->FlagsTable[index + i] = f;
-               tileset->Tiles[index + i].BaseTerrain = basic_name;
-               tileset->Tiles[index + i].MixTerrain = 0;
-       }
-       while (i < 16) {
-               tileset->Table[index + i] = 0;
-               tileset->FlagsTable[index + i] = 0;
-               tileset->Tiles[index + i].BaseTerrain = 0;
-               tileset->Tiles[index + i].MixTerrain = 0;
-               ++i;
-       }
-
-       if (l < 16) {
-               return index + 16;
-       }
-       return index + l;
-}
-#elif defined(USE_LUA)
 local int DefineTilesetParseSolid(lua_State* l, Tileset* tileset, int index)
 {
        int i;
@@ -604,7 +377,6 @@
        }
        return index + len;
 }
-#endif
 
 /**
 **             Parse the mixed slot part of a tileset definition
@@ -613,67 +385,6 @@
 **             @param index            Current table index.
 **             @param list             Tagged list defining a mixed slot.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local int DefineTilesetParseMixed(Tileset* tileset, int index, SCM list)
-{
-       SCM value;
-       SCM data;
-       int i;
-       int l;
-       int f;
-       int basic_name;
-       int mixed_name;
-       int new_index;
-
-       new_index = index + 256;
-       ExtendTilesetTables(tileset, new_index);
-
-       basic_name = TilesetParseName(tileset, list);           // base name
-       list = gh_cdr(list);
-       mixed_name = TilesetParseName(tileset, list);           // mixed name
-       list = gh_cdr(list);
-
-       list = ParseTilesetTileFlags(list, &f);
-
-       //
-       //              Parse the list:         slots FIXME: no error checking 
number of slots
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               //
-               //              Vector: the tiles.
-               //
-               l = gh_vector_length(value);
-               for (i = 0; i < l; ++i) {
-                       data = gh_vector_ref(value, gh_int2scm(i));
-                       tileset->Table[index + i] = gh_scm2int(data);
-                       tileset->FlagsTable[index + i] = f;
-                       tileset->Tiles[index + i].BaseTerrain = basic_name;
-                       tileset->Tiles[index + i].MixTerrain = mixed_name;
-               }
-               while (i < 16) {                                                
// Fill missing slots
-                       tileset->Table[index + i] = 0;
-                       tileset->FlagsTable[index + i] = 0;
-                       tileset->Tiles[index + i].BaseTerrain = 0;
-                       tileset->Tiles[index + i].MixTerrain = 0;
-                       ++i;
-               }
-               index += 16;
-       }
-
-       while (index < new_index) {
-               tileset->Table[index] = 0;
-               tileset->FlagsTable[index] = 0;
-               tileset->Tiles[index].BaseTerrain = 0;
-               tileset->Tiles[index].MixTerrain = 0;
-               ++index;
-       }
-
-       return new_index;
-}
-#elif defined(USE_LUA)
 local int DefineTilesetParseMixed(lua_State* l, Tileset* tileset, int index)
 {
        int i;
@@ -744,7 +455,6 @@
 
        return new_index;
 }
-#endif
 
 /**
 **             Parse the slot part of a tileset definition
@@ -752,69 +462,6 @@
 **             @param tileset          Tileset to be filled.
 **             @param list             Tagged list defining a slot.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void DefineTilesetParseSlot(Tileset* tileset, SCM list)
-{
-       SCM value;
-       SCM data;
-       int index;
-
-       index = 0;
-       tileset->Table = malloc(16 * sizeof(*tileset->Table));
-       if (!tileset->Table) {
-               fprintf(stderr, "out of memory.\n");
-               ExitFatal(-1);
-       }
-       tileset->FlagsTable =
-               malloc(16 * sizeof(*tileset->FlagsTable));
-       if (!tileset->FlagsTable) {
-               fprintf(stderr, "out of memory.\n");
-               ExitFatal(-1);
-       }
-       tileset->Tiles = malloc(16 * sizeof(TileInfo));
-       if (!tileset->Tiles) {
-               fprintf(stderr, "out of memory.\n");
-               ExitFatal(-1);
-       }
-       tileset->SolidTerrainTypes = malloc(sizeof(SolidTerrainInfo));
-       if (!tileset->SolidTerrainTypes) {
-               fprintf(stderr, "out of memory.\n");
-               ExitFatal(-1);
-       }
-       tileset->SolidTerrainTypes[0].TerrainName = strdup("unused");
-       tileset->NumTerrainTypes = 1;
-
-       //
-       //              Parse the list:         (still everything could be 
changed!)
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               data = gh_car(list);
-               list = gh_cdr(list);
-
-               //
-               //              special part
-               //
-               if (gh_eq_p(value, gh_symbol2scm("special"))) {
-                       DefineTilesetParseSpecial(tileset, data);
-               //
-               //              solid part
-               //
-               } else if (gh_eq_p(value, gh_symbol2scm("solid"))) {
-                       index = DefineTilesetParseSolid(tileset, index, data);
-               //
-               //              mixed part
-               //
-               } else if (gh_eq_p(value, gh_symbol2scm("mixed"))) {
-                       index = DefineTilesetParseMixed(tileset, index, data);
-               } else {
-                       errl("slots: unsupported tag", value);
-               }
-       }
-       tileset->NumTiles = index;
-}
-#elif defined(USE_LUA)
 local void DefineTilesetParseSlot(lua_State* l, Tileset* tileset, int t)
 {
        const char* value;
@@ -885,7 +532,6 @@
        }
        tileset->NumTiles = index;
 }
-#endif
 
 /**
 **             Parse the item mapping part of a tileset definition
@@ -893,30 +539,6 @@
 **             @param tileset          Tileset to be filled.
 **             @param list             List defining item mapping.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void DefineTilesetParseItemMapping(Tileset* tileset, SCM list)
-{
-       SCM value;
-       int num;
-       char* unit;
-       char buf[30];
-       char** h;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               num = gh_scm2int(value);
-               value = gh_car(list);
-               list = gh_cdr(list);
-               unit = gh_scm2newstr(value, 0);
-               sprintf(buf, "%d", num);
-               if ((h = (char**)hash_find(tileset->ItemsHash, buf)) != NULL) {
-                       free(*h);
-               }
-               *(char**)hash_add(tileset->ItemsHash, buf) = unit;
-       }
-}
-#elif defined(USE_LUA)
 local void DefineTilesetParseItemMapping(lua_State* l, Tileset* tileset, int t)
 {
        int num;
@@ -942,110 +564,12 @@
                *(char**)hash_add(tileset->ItemsHash, buf) = unit;
        }
 }
-#endif
 
 /**
 **             Define tileset
 **
 **             @param list             Tagged list defining a tileset.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineTileset(SCM list)
-{
-       SCM value;
-       SCM data;
-       int type;
-       Tileset* tileset;
-       char* ident;
-
-       value = gh_car(list);
-       list = gh_cdr(list);
-
-       if (!gh_symbol_p(value)) {
-               errl("illegal tileset slot name", value);
-       }
-       ident = gh_scm2newstr(value, NULL);
-
-       //
-       //              Find the tile set.
-       //
-       if (Tilesets) {
-               for (type = 0; type < NumTilesets; ++type) {
-                       if(!strcmp(Tilesets[type]->Ident, ident)) {
-                               free(Tilesets[type]->Ident);
-                               free(Tilesets[type]->File);
-                               free(Tilesets[type]->Class);
-                               free(Tilesets[type]->Name);
-                               free(Tilesets[type]->ImageFile);
-                               free(Tilesets[type]->PaletteFile);
-                               free(Tilesets[type]->Table);
-                               free(Tilesets[type]->Tiles);
-                               free(Tilesets[type]->TileTypeTable);
-                               free(Tilesets[type]->AnimationTable);
-                               free(Tilesets[type]);
-                               break;
-                       }
-               }
-               if (type == NumTilesets) {
-                       Tilesets = realloc(Tilesets, ++NumTilesets * 
sizeof(*Tilesets));
-               }
-       } else {
-               Tilesets = malloc(sizeof(*Tilesets));
-               type = 0;
-               ++NumTilesets;
-       }
-       if (!Tilesets) {
-               fprintf(stderr, "out of memory.\n");
-               ExitFatal(-1);
-       }
-       Tilesets[type] = tileset = calloc(sizeof(Tileset), 1);
-       if (!tileset) {
-               fprintf(stderr, "out of memory.\n");
-               ExitFatal(-1);
-       }
-       Tilesets[type]->Ident = ident;
-       Tilesets[type]->TileSizeX = 32;
-       Tilesets[type]->TileSizeY = 32;
-
-       //
-       //              Parse the list:         (still everything could be 
changed!)
-       //
-       while (!gh_null_p(list)) {
-
-               value = gh_car(list);
-               list = gh_cdr(list);
-               data = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("file"))) {
-                       tileset->File = gh_scm2newstr(data, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("class"))) {
-                       tileset->Class = gh_scm2newstr(data, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("name"))) {
-                       tileset->Name = gh_scm2newstr(data, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("image"))) {
-                       tileset->ImageFile = gh_scm2newstr(data, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("palette"))) {
-                       tileset->PaletteFile = gh_scm2newstr(data, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
-                       tileset->TileSizeX = gh_scm2int(gh_car(data));
-                       data = gh_cdr(data);
-                       tileset->TileSizeY = gh_scm2int(gh_car(data));
-               } else if (gh_eq_p(value, gh_symbol2scm("slots"))) {
-                       DefineTilesetParseSlot(tileset, data);
-               } else if (gh_eq_p(value, gh_symbol2scm("animations"))) {
-                       DebugLevel0Fn("Animations not supported.\n");
-               } else if (gh_eq_p(value, gh_symbol2scm("objects"))) {
-                       DebugLevel0Fn("Objects not supported.\n");
-               } else if (gh_eq_p(value, gh_symbol2scm("item-mapping"))) {
-                       DefineTilesetParseItemMapping(tileset, data);
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-       return list;
-}
-#elif defined(USE_LUA)
 local int CclDefineTileset(lua_State* l)
 {
        const char* value;
@@ -1150,20 +674,14 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for tileset.
 */
 global void TilesetCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-tileset-wc-names", CclDefineTilesetWcNames);
-       gh_new_procedureN("define-tileset", CclDefineTileset);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineTilesetWcNames", CclDefineTilesetWcNames);
        lua_register(Lua, "DefineTileset", CclDefineTileset);
-#endif
 }
 
 //@}
Index: stratagus/src/map/tileset.c
diff -u stratagus/src/map/tileset.c:1.58 stratagus/src/map/tileset.c:1.59
--- stratagus/src/map/tileset.c:1.58    Sat Dec 20 16:33:32 2003
+++ stratagus/src/map/tileset.c Fri Jan  2 08:24:09 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: tileset.c,v 1.58 2003/12/20 05:33:32 jsalmon3 Exp $
+//     $Id: tileset.c,v 1.59 2004/01/01 21:24:09 jsalmon3 Exp $
 
 //@{
 
@@ -115,11 +115,7 @@
        if (!Tilesets[i]->Table) {
                char buf[1024];
                LibraryFileName(Tilesets[i]->File, buf);
-#if defined(USE_GUILE) || defined(USE_SIOD)
-               vload(buf, 0, 1);
-#elif defined(USE_LUA)
                LuaLoadFile(buf);
-#endif
        }
 
        TheMap.Tileset = Tilesets[i];
@@ -749,7 +745,7 @@
        char** sp;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: tileset $Id: tileset.c,v 1.58 2003/12/20 
05:33:32 jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: tileset $Id: tileset.c,v 1.59 2004/01/01 
21:24:09 jsalmon3 Exp $\n\n");
 
        //  Original number to internal tileset name
 
Index: stratagus/src/missile/ccl_missile.c
diff -u stratagus/src/missile/ccl_missile.c:1.51 
stratagus/src/missile/ccl_missile.c:1.52
--- stratagus/src/missile/ccl_missile.c:1.51    Wed Dec 17 06:19:36 2003
+++ stratagus/src/missile/ccl_missile.c Fri Jan  2 08:24:10 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl_missile.c,v 1.51 2003/12/16 19:19:36 jsalmon3 Exp $
+//      $Id: ccl_missile.c,v 1.52 2004/01/01 21:24:10 jsalmon3 Exp $
 
 //@{
 
@@ -63,111 +63,6 @@
 **
 **  @param list  List describing missile-type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineMissileType(SCM list)
-{
-       SCM value;
-       char* str;
-       MissileType* mtype;
-       unsigned i;
-
-       // Slot identifier
-
-       str = gh_scm2newstr(gh_car(list), NULL);
-       list = gh_cdr(list);
-#ifdef DEBUG
-       i = NoWarningMissileType;
-       NoWarningMissileType = 1;
-#endif
-       mtype = MissileTypeByIdent(str);
-#ifdef DEBUG
-       NoWarningMissileType = i;
-#endif
-       if (mtype) {
-               DebugLevel0Fn("Redefining missile-type `%s'\n" _C_ str);
-               free(str);
-       } else {
-               mtype = NewMissileTypeSlot(str);  // str consumed!
-       }
-
-       mtype->NumDirections = 1;
-       // Ensure we don't divide by zero.
-       mtype->SplashFactor = 100;
-       //
-       // Parse the arguments, already the new tagged format.
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("file"))) {
-                       free(mtype->File);
-                       mtype->File = gh_scm2newstr(gh_car(list), NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
-                       value = gh_car(list);
-                       mtype->Width = gh_scm2int(gh_car(value));
-                       value = gh_cdr(value);
-                       mtype->Height = gh_scm2int(gh_car(value));
-               } else if (gh_eq_p(value,gh_symbol2scm("frames"))) {
-                       mtype->SpriteFrames = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("num-directions"))) {
-                       mtype->NumDirections = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("transparency"))) {
-                       mtype->Transparency = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("fired-sound"))) {
-                       free(mtype->FiredSound.Name);
-                       mtype->FiredSound.Name = gh_scm2newstr(gh_car(list), 
NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("impact-sound"))) {
-                       free(mtype->ImpactSound.Name);
-                       mtype->ImpactSound.Name = gh_scm2newstr(gh_car(list), 
NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("class"))) {
-                       const char* name;
-
-                       value = gh_car(list);
-                       name = get_c_string(value);
-                       for (i = 0; MissileClassNames[i]; ++i) {
-                               if (!strcmp(name, MissileClassNames[i])) {
-                                       mtype->Class = i;
-                                       break;
-                               }
-                       }
-                       if (!MissileClassNames[i]) {
-                               // FIXME: this leaves a half initialized 
missile-type
-                               errl("Unsupported class", value);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("num-bounces"))) {
-                       mtype->NumBounces = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("delay"))) {
-                       mtype->StartDelay = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("sleep"))) {
-                       mtype->Sleep = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("speed"))) {
-                       mtype->Speed = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("draw-level"))) {
-                       mtype->DrawLevel = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("range"))) {
-                       mtype->Range = gh_scm2int(gh_car(list));
-               } else if (gh_eq_p(value, gh_symbol2scm("impact-missile"))) {
-                       free(mtype->ImpactName);
-                       mtype->ImpactName = gh_scm2newstr(gh_car(list), NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("smoke-missile"))) {
-                       free(mtype->ImpactName);
-                       mtype->SmokeName = gh_scm2newstr(gh_car(list), NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("can-hit-owner"))) {
-                       mtype->CanHitOwner = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("friendly-fire"))) {
-                       mtype->FriendlyFire = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("splash-factor"))) {
-                       mtype->SplashFactor = gh_scm2int(gh_car(list));;
-               } else {
-                       // FIXME: this leaves a half initialized missile-type
-                       errl("Unsupported tag", value);
-               }
-               list = gh_cdr(list);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineMissileType(lua_State* l)
 {
        const char* value;
@@ -279,40 +174,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Define missile type mapping from original number to internal symbol
 **
 **  @param list  List of all names.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineMissileTypeWcNames(SCM list)
-{
-       int i;
-       char** cp;
-
-       if ((cp = MissileTypeWcNames)) {  // Free all old names
-               while (*cp) {
-                       free(*cp++);
-               }
-               free(MissileTypeWcNames);
-       }
-
-       //
-       // Get new table.
-       //
-       i = gh_length(list);
-       MissileTypeWcNames = cp = malloc((i + 1) * sizeof(char*));
-       while (i--) {
-               *cp++ = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-       }
-       *cp = NULL;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineMissileTypeWcNames(lua_State* l)
 {
        int i;
@@ -343,7 +210,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **  Create a missile.
@@ -497,52 +363,6 @@
 **
 **  @param list  FIXME: docu.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineBurningBuilding(SCM list)
-{
-       SCM value;
-       SCM sublist;
-       BurningBuildingFrame** frame;
-       BurningBuildingFrame* ptr;
-       BurningBuildingFrame* next;
-       char* str;
-
-       ptr = BurningBuildingFrames;
-       while (ptr) {
-               next = ptr->Next;
-               free(ptr);
-               ptr = next;
-       }
-       BurningBuildingFrames = NULL;
-
-       frame = &BurningBuildingFrames;
-
-       while (!gh_null_p(list)) {
-               sublist = gh_car(list);
-               list = gh_cdr(list);
-
-               *frame = calloc(1, sizeof(BurningBuildingFrame));
-               while (!gh_null_p(sublist)) {
-                       value = gh_car(sublist);
-                       sublist = gh_cdr(sublist);
-
-                       if (gh_eq_p(value, gh_symbol2scm("percent"))) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               (*frame)->Percent = gh_scm2int(value);
-                       } else if (gh_eq_p(value, gh_symbol2scm("missile"))) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               str = gh_scm2newstr(value, NULL);
-                               (*frame)->Missile = MissileTypeByIdent(str);
-                               free(str);
-                       }
-               }
-               frame = &((*frame)->Next);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineBurningBuilding(lua_State* l)
 {
        const char* value;
@@ -593,26 +413,17 @@
        }
        return 0;
 }
-#endif
 
 /**
 **  Register CCL features for missile-type.
 */
 global void MissileCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-missiletype-wc-names",
-               CclDefineMissileTypeWcNames);
-       gh_new_procedureN("define-missile-type", CclDefineMissileType);
-       gh_new_procedureN("missile", CclMissile);
-       gh_new_procedureN("define-burning-building", CclDefineBurningBuilding);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineMissileTypeWcNames",
                CclDefineMissileTypeWcNames);
        lua_register(Lua, "DefineMissileType", CclDefineMissileType);
        lua_register(Lua, "Missile", CclMissile);
        lua_register(Lua, "DefineBurningBuilding", CclDefineBurningBuilding);
-#endif
 }
 
 //@}
Index: stratagus/src/network/commands.c
diff -u stratagus/src/network/commands.c:1.85 
stratagus/src/network/commands.c:1.86
--- stratagus/src/network/commands.c:1.85       Sat Dec 20 16:33:33 2003
+++ stratagus/src/network/commands.c    Fri Jan  2 08:24:10 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: commands.c,v 1.85 2003/12/20 05:33:33 jsalmon3 Exp $
+//     $Id: commands.c,v 1.86 2004/01/01 21:24:10 jsalmon3 Exp $
 
 //@{
 
@@ -71,11 +71,7 @@
 **             LogEntry structure.
 */
 struct _log_entry_ {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       int                             GameCycle;
-#elif defined(USE_LUA)
        unsigned long   GameCycle;
-#endif
        int                             UnitNumber;
        char*           UnitIdent;
        char*           Action;
@@ -85,11 +81,7 @@
        int                             DestUnitNumber;
        char*           Value;
        int                             Num;
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       int                             SyncRandSeed;
-#elif defined(USE_LUA)
        unsigned                SyncRandSeed;
-#endif
        LogEntry*               Next;
 };
 
@@ -113,11 +105,7 @@
        char*           Date;
        char*           Map;
        char*           MapPath;
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       int                             MapId;
-#elif defined(USE_LUA)
        unsigned                MapId;
-#endif
 
        int                             Type;
        int                             Race;
@@ -140,72 +128,6 @@
 //             Constants
 //----------------------------------------------------------------------------
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-/// Description of the LogEntry structure
-static IOStructDef LogEntryStructDef = {
-       "LogEntry",
-       sizeof(LogEntry),
-       -1,
-       {
-               {"`next",                               NULL,                   
        &((LogEntry*)0)->Next,                          NULL},
-               {"game-cycle",                          &IOInt,                 
        &((LogEntry*)0)->GameCycle,             NULL},
-               {"unit-number",                         &IOInt,                 
        &((LogEntry*)0)->UnitNumber,            NULL},
-               {"unit-ident",                          &IOString,              
&((LogEntry*)0)->UnitIdent,             NULL},
-               {"action",                              &IOString,              
&((LogEntry*)0)->Action,                NULL},
-               {"flush",                               &IOInt,                 
        &((LogEntry*)0)->Flush,                         NULL},
-               {"posx",                                &IOInt,                 
        &((LogEntry*)0)->PosX,                          NULL},
-               {"posy",                                &IOInt,                 
        &((LogEntry*)0)->PosY,                          NULL},
-               {"dest-unit-number",            &IOInt,                         
&((LogEntry*)0)->DestUnitNumber,NULL},
-               {"value",                               &IOString,              
&((LogEntry*)0)->Value,                         NULL},
-               {"Num",                                         &IOInt,         
                &((LogEntry*)0)->Num,                           NULL},
-               {"SyncRandSeed",                &IOInt,                         
&((LogEntry*)0)->SyncRandSeed,          NULL},
-               {0, 0, 0, 0}
-       }
-};
-
-static IOStructDef MPPlayerStructDef = {
-       "MPPlayer",
-       sizeof(MPPlayer),
-       PlayerMax,
-       {
-               {"name",                                &IOString,              
&((MPPlayer*)0)->Name,          NULL},
-               {"race",                                &IOInt,                 
        &((MPPlayer*)0)->Race,          NULL},
-               {"team",                                &IOInt,                 
        &((MPPlayer*)0)->Team,          NULL},
-               {"type",                                &IOInt,                 
        &((MPPlayer*)0)->Type,          NULL},
-               {0, 0, 0, 0}
-       }
-};
-
-static IOStructDef FullReplayStructDef = {
-       "FullReplay",
-       sizeof(FullReplay),
-       -1,
-       {
-               {"comment-1",                           &IOString,              
&((FullReplay*)0)->Comment1,            NULL},
-               {"comment-2",                           &IOString,              
&((FullReplay*)0)->Comment2,            NULL},
-               {"comment-3",                           &IOString,              
&((FullReplay*)0)->Comment3,            NULL},
-               {"date",                                &IOString,              
&((FullReplay*)0)->Date,                NULL},
-               {"map",                                         &IOString,      
        &((FullReplay*)0)->Map,         NULL},
-               {"mappath",                             &IOString,              
&((FullReplay*)0)->MapPath,             NULL},
-               {"mapid",                               &IOInt,                 
        &((FullReplay*)0)->MapId,               NULL},
-               {"type",                                &IOInt,                 
        &((FullReplay*)0)->Type,                NULL},
-               {"race",                                &IOInt,                 
        &((FullReplay*)0)->Race,                NULL},
-               {"local-player",                &IOInt,                         
&((FullReplay*)0)->LocalPlayer,         NULL},
-               {"players",                             &IOStructArray,         
&((FullReplay*)0)->Players,             (void*)&MPPlayerStructDef},
-               {"resource",                            &IOInt,                 
        &((FullReplay*)0)->Resource,            NULL},
-               {"num-units",                           &IOInt,                 
        &((FullReplay*)0)->NumUnits,            NULL},
-               {"tileset",                             &IOInt,                 
        &((FullReplay*)0)->TileSet,             NULL},
-               {"no-fow",                              &IOInt,                 
        &((FullReplay*)0)->NoFow,               NULL},
-               {"reveal-map",                          &IOInt,                 
        &((FullReplay*)0)->RevealMap,           NULL},
-               {"game-type",                           &IOInt,                 
        &((FullReplay*)0)->GameType,            NULL},
-               {"Opponents",                           &IOInt,                 
        &((FullReplay*)0)->Opponents,           NULL},
-               {"engine",                              &IOIntArray,            
&((FullReplay*)0)->Engine,              (void*)3},
-               {"network",                             &IOIntArray,            
&((FullReplay*)0)->Network,             (void*)3},
-               {"commands",                            &IOLinkedList,          
&((FullReplay*)0)->Commands,            (void*)&LogEntryStructDef},
-               {0, 0, 0, 0}
-       }
-};
-#endif
 
 //----------------------------------------------------------------------------
 //             Variables
@@ -252,7 +174,7 @@
 
        replay->Comment1 = strdup("Generated by Stratagus Version " VERSION "");
        replay->Comment2 = strdup("Visit http://Stratagus.Org for more 
information");
-       replay->Comment3 = strdup("$Id: commands.c,v 1.85 2003/12/20 05:33:33 
jsalmon3 Exp $");
+       replay->Comment3 = strdup("$Id: commands.c,v 1.86 2004/01/01 21:24:10 
jsalmon3 Exp $");
 
        if (GameSettings.NetGameType == SettingsSinglePlayerGame) {
                replay->Type = ReplaySinglePlayer;
@@ -376,17 +298,6 @@
 */
 local void SaveFullLog(CLFile* dest)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       // FIXME : IOStartSaving(dest);
-       IOLoadingMode = 0;
-       IOOutFile = dest;
-       IOTabLevel = 2;
-
-       CLprintf(dest, "(replay-log (quote\n");
-       IOStructPtr(SCM_UNSPECIFIED, (void*)&CurrentReplay, 
(void*)&FullReplayStructDef);
-       CLprintf(dest, "))\n");
-       // FIXME : IODone();
-#elif defined(USE_LUA)
        LogEntry* log;
        int i;
 
@@ -431,7 +342,6 @@
                AppendLog(log, dest);
                log = log->Next;
        }
-#endif
 }
 
 /**
@@ -457,16 +367,6 @@
                return;
        }
 
-       // FIXME : IOStartSaving(dest);
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       IOLoadingMode = 0;
-       IOOutFile = dest;
-       IOTabLevel = 2;
-       CLprintf(dest, "(log (quote ");
-       IOLinkedList(SCM_UNSPECIFIED, (void*)&log, (void*)&LogEntryStructDef);
-       CLprintf(dest,"))\n");
-#elif defined(USE_LUA)
        CLprintf(dest, "Log( { ");
        CLprintf(dest, "GameCycle = %lu, ", log->GameCycle);
        if (log->UnitNumber != -1) {
@@ -490,10 +390,7 @@
                CLprintf(dest, "Num = %d, ", log->Num);
        }
        CLprintf(dest, "SyncRandSeed = %u } )\n", log->SyncRandSeed);
-#endif
        CLflush(dest);
-
-       // FIXME : IODone();
 }
 
 /**
@@ -607,30 +504,6 @@
 /**
 **             Parse log
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclLog(SCM list)
-{
-       LogEntry* log;
-       LogEntry** last;
-
-       DebugCheck(!CurrentReplay);
-
-       IOLoadingMode = 1;
-
-       log = NULL;
-       IOLinkedList(list, (void*)&log, (void*)&LogEntryStructDef);
-
-       // Append to linked list
-       last = &CurrentReplay->Commands;
-       while (*last) {
-               last = &(*last)->Next;
-       }
-
-       *last = log;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclLog(lua_State* l)
 {
        LogEntry* log;
@@ -693,30 +566,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Parse replay-log
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclReplayLog(SCM list)
-{
-       FullReplay* replay;
-
-       DebugCheck(CurrentReplay != NULL);
-
-       IOLoadingMode = 1;
-       replay = 0;
-       IOStructPtr(list, (void*)&replay, (void*)&FullReplayStructDef);
-
-       CurrentReplay = replay;
-
-       // Apply CurrentReplay settings.
-       ApplyReplaySettings();
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclReplayLog(lua_State* l)
 {
        FullReplay* replay;
@@ -844,7 +697,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Save generated replay
@@ -866,11 +718,7 @@
        CleanReplayLog();
        ReplayGameType = ReplaySinglePlayer;
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       vload(name, 0, 1);
-#elif defined(USE_LUA)
        LuaLoadFile(name);
-#endif
 
        NextLogCycle = ~0UL;
        if (!CommandLogDisabled) {
@@ -1605,15 +1453,13 @@
        }
 }
 
+/**
+**  FIXME: docu
+*/
 global void NetworkCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure1_0("log", CclLog);
-       gh_new_procedure1_0("replay-log", CclReplayLog);
-#elif defined(USE_LUA)
        lua_register(Lua, "Log", CclLog);
        lua_register(Lua, "ReplayLog", CclReplayLog);
-#endif
 }
 
 //@}
Index: stratagus/src/pathfinder/ccl_pathfinder.c
diff -u stratagus/src/pathfinder/ccl_pathfinder.c:1.28 
stratagus/src/pathfinder/ccl_pathfinder.c:1.29
--- stratagus/src/pathfinder/ccl_pathfinder.c:1.28      Sat Dec 20 16:33:35 2003
+++ stratagus/src/pathfinder/ccl_pathfinder.c   Fri Jan  2 08:24:11 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_pathfinder.c,v 1.28 2003/12/20 05:33:35 jsalmon3 Exp $
+//     $Id: ccl_pathfinder.c,v 1.29 2004/01/01 21:24:11 jsalmon3 Exp $
 
 //@{
 
@@ -57,54 +57,6 @@
 /**
 **             Enable a*.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAStar(SCM list)
-{
-       SCM value;
-       int i;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("fixed-unit-cost"))) {
-                       i = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-                       if (i <= 3) {
-                               PrintFunction();
-                               fprintf(stdout,"Fixed unit crossing cost must 
be strictly > 3\n");
-                       } else {
-                               AStarFixedUnitCrossingCost = i;
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("moving-unit-cost"))) {
-                       i = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-                       if (i <= 3) {
-                               PrintFunction();
-                               fprintf(stdout,"Moving unit crossing cost must 
be strictly > 3\n");
-                       } else {
-                               AStarMovingUnitCrossingCost = i;
-                       }
-               } else if (gh_eq_p(value, 
gh_symbol2scm("know-unseen-terrain"))) {
-                       AStarKnowUnknown = 1;
-               } else if (gh_eq_p(value, 
gh_symbol2scm("dont-know-unseen-terrain"))) {
-                       AStarKnowUnknown = 0;
-               } else if (gh_eq_p(value, 
gh_symbol2scm("unseen-terrain-cost"))) {
-                       i = gh_scm2int(gh_car(list));
-                       if (i < 0) {
-                               PrintFunction();
-                               fprintf(stdout,"Unseen Terrain Cost must be 
non-negative\n");
-                       } else {
-                               AStarUnknownTerrainCost = i;
-                       }
-                       list = gh_cdr(list);
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclAStar(lua_State* l)
 {
        const char* value;
@@ -154,16 +106,8 @@
 
        return 0;
 }
-#endif
 
 #ifdef HIERARCHIC_PATHFINDER
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPfHierShowRegIds(SCM flag)
-{
-       PfHierShowRegIds = gh_scm2bool(flag);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPfHierShowRegIds(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -173,15 +117,7 @@
        PfHierShowRegIds = LuaToBoolean(l, 1);
        return 0;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPfHierShowGroupIds(SCM flag)
-{
-       PfHierShowGroupIds = gh_scm2bool(flag);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPfHierShowGroupIds(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -191,48 +127,25 @@
        PfHierShowGroupIds = LuaToBoolean(l, 1);
        return 0;
 }
-#endif
 #else
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPfHierShowRegIds(SCM flag __attribute__((unused)))
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPfHierShowRegIds(lua_State* l)
 {
        return 0;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPfHierShowGroupIds(SCM flag __attribute__((unused)))
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPfHierShowGroupIds(lua_State* l)
 {
        return 0;
 }
-#endif
 
 #ifdef MAP_REGIONS
 global void MapSplitterDebug(void);
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDebugRegions(void)
-{
-       MapSplitterDebug();
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDebugRegions(lua_State* l)
 {
        MapSplitterDebug();
        return 0;
 }
-#endif
 #endif // MAP_REGIONS
 
 #endif
@@ -243,21 +156,12 @@
 */
 global void PathfinderCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("a-star", CclAStar);
-#ifdef MAP_REGIONS
-       gh_new_procedure0_0("debug-regions", CclDebugRegions);
-#endif // MAP_REGIONS
-       gh_new_procedure1_0 ("pf-show-regids!", CclPfHierShowRegIds);
-       gh_new_procedure1_0 ("pf-show-groupids!", CclPfHierShowGroupIds);
-#elif defined(USE_LUA)
        lua_register(Lua, "AStar", CclAStar);
 #ifdef MAP_REGIONS
        lua_register(Lua, "DebugRegions", CclDebugRegions);
 #endif // MAP_REGIONS
        lua_register(Lua, "PfShowRegids", CclPfHierShowRegIds);
        lua_register(Lua, "PfShowGroupids", CclPfHierShowGroupIds);
-#endif
 }
 
 //@}
Index: stratagus/src/sound/ccl_sound.c
diff -u stratagus/src/sound/ccl_sound.c:1.61 
stratagus/src/sound/ccl_sound.c:1.62
--- stratagus/src/sound/ccl_sound.c:1.61        Tue Dec 23 14:48:03 2003
+++ stratagus/src/sound/ccl_sound.c     Fri Jan  2 08:24:13 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_sound.c,v 1.61 2003/12/23 03:48:03 jsalmon3 Exp $
+//     $Id: ccl_sound.c,v 1.62 2004/01/01 21:24:13 jsalmon3 Exp $
 
 //@{
 
@@ -53,58 +53,17 @@
 --             Variables
 ----------------------------------------------------------------------------*/
 
-/**
-** C representation for the siod sound type
-** ALPHA VERSION!!!!!!!!!
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local ccl_smob_type_t SiodSoundTag;
-
-#define CCL_SOUNDP(x)          (CclGetSmobType(x) == SiodSoundTag)
-#define CCL_SOUND_ID(x) ((SoundId)CclGetSmobData(x))
-#elif defined(USE_LUA)
-#endif
 
 /*----------------------------------------------------------------------------
 --             Functions
 ----------------------------------------------------------------------------*/
 
 /**
-**             Cast a Stratagus sound id to its scheme version
-**
-**             @param id               the sound id
-**
-**             @return                         its siod version
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM sound_id_ccl(SoundId id)
-{
-       SCM sound_id;
-
-       sound_id = CclMakeSmobObj(SiodSoundTag, id);
-       return sound_id;
-}
-#endif
-
-/**
 **             Glue between c and scheme. Ask the sound system to associate a
 **             sound id to a sound name.
 **
 **             @param name             name
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSoundForName(SCM name)
-{
-       SoundId id;
-       char* sound_name;
-
-       sound_name = gh_scm2newstr(name, NULL);
-       id = SoundIdForName(sound_name);
-       free(sound_name);
-
-       return sound_id_ccl(id);
-}
-#elif defined(USE_LUA)
 local int CclSoundForName(lua_State* l)
 {
        SoundId id;
@@ -119,8 +78,6 @@
        data->Data = id;
        return 1;
 }
-#endif
-
 
 /**
 **             Get a Game Sound Id from either a siod sound id or a sound name
@@ -128,16 +85,6 @@
 **             @param sound            Lisp cell, SoundID or string or symbol.
 **             @return                         The C sound id.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SoundId CclGetSoundId(SCM sound)
-{
-       if (CCL_SOUNDP(sound)) {                // if we've got the sound id
-               return CCL_SOUND_ID(sound);
-       } else {
-               return CCL_SOUND_ID(CclSoundForName(sound));
-       }
-}
-#elif defined(USE_LUA)
 local SoundId CclGetSoundId(lua_State* l)
 {
        LuaUserData* data;
@@ -155,7 +102,6 @@
        lua_error(l);
        return NULL;
 }
-#endif
 
 /**
 **             Create a sound.
@@ -169,63 +115,6 @@
 **
 **             @return                         the sound id of the created 
sound
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMakeSound(SCM name, SCM file)
-{
-       SoundId id;
-       char* c_name;
-       char* c_file;
-       char** c_files;
-       int nb;
-       int i;
-       SCM a_file;
-
-       if (!gh_string_p(name)) {
-               fprintf(stderr, "string expected\n");
-               return SCM_UNSPECIFIED;
-       }
-       if (gh_string_p(file)) {
-               // only one file
-               c_name = gh_scm2newstr(name, NULL);
-               c_file = gh_scm2newstr(file, NULL);
-               id = MakeSound(c_name, (const char**)&c_file, 1);
-               DebugLevel3("Making sound `%s' from `%s' with id %p\n" _C_ 
c_name _C_
-                       c_file _C_ id);
-               // the sound name (c_name) must be kept but the file name can 
be freed
-               // JOHNS: wrong!
-               free(c_file);
-               free(c_name);
-       } else if (gh_list_p(file)) {
-               // several files
-               c_name = gh_scm2newstr(name, NULL);
-               DebugLevel3("Making sound `%s'\n" _C_ c_name);
-               nb = gh_length(file);
-               c_files = (char**)malloc(sizeof(char*) * nb);
-               for (i = 0; i < nb; ++i) {
-                       a_file = gh_car(file);
-                       if (!gh_string_p(name)) {
-                               fprintf(stderr, "string expected\n");
-                               // FIXME: memory leak!
-                               return SCM_UNSPECIFIED;
-                       }
-                       c_files[i] = gh_scm2newstr(a_file, NULL);
-                       DebugLevel3("\tComponent %d: `%s'\n" _C_ i _C_ 
c_files[i]);
-                       file = gh_cdr(file);
-               }
-               //FIXME: check size before casting
-               id = MakeSound(c_name, (const char**)c_files, (unsigned 
char)nb);
-               for (i = 0; i < nb; ++i) {
-                       free(c_files[i]);
-               }
-               free(c_name);
-               free(c_files);
-       } else {
-               fprintf(stderr, "string or list expected\n");
-               return SCM_UNSPECIFIED;
-       }
-       return sound_id_ccl(id);
-}
-#elif defined(USE_LUA)
 local int CclMakeSound(lua_State* l)
 {
        SoundId id;
@@ -275,7 +164,6 @@
        data->Data = id;
        return 1;
 }
-#endif
 
 /**
 **             Glue between c and scheme. This function asks the sound system 
to
@@ -287,24 +175,6 @@
 **
 **             @return                         The sound id of the created 
sound
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMakeSoundGroup(SCM name, SCM first, SCM second)
-{
-       SoundId id;
-       char* c_name;
-
-       if (!gh_string_p(name) && !gh_symbol_p(name)) {
-               fprintf(stderr, "string or symbol expected\n");
-               return SCM_UNSPECIFIED;
-       }
-       c_name = gh_scm2newstr(name, NULL);
-
-       id = MakeSoundGroup(c_name, CclGetSoundId(first), 
CclGetSoundId(second));
-       // JOHNS: not anymore: c_name consumed by MakeSoundGroup!
-       free(c_name);
-       return sound_id_ccl(id);
-}
-#elif defined(USE_LUA)
 local int CclMakeSoundGroup(lua_State* l)
 {
        SoundId id;
@@ -330,7 +200,6 @@
        data->Data = id;
        return 1;
 }
-#endif
 
 /**
 **             Glue between c and scheme. Ask to the sound system to remap a 
sound id
@@ -341,17 +210,6 @@
 **
 **             @return                         the sound object
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMapSound(SCM name, SCM sound)
-{
-       char* sound_name;
-
-       sound_name = gh_scm2newstr(name, NULL);
-       MapSound(sound_name, CclGetSoundId(sound));
-       free(sound_name);
-       return sound;
-}
-#elif defined(USE_LUA)
 local int CclMapSound(lua_State* l)
 {
        const char* sound_name;
@@ -365,7 +223,6 @@
        lua_pushvalue(l, 2);
        return 1;
 }
-#endif
 
 /**
 **             Ask the sound system to play the specified sound.
@@ -374,16 +231,6 @@
 **
 **             @return                         SCM_UNSPECIFIED
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPlaySound(SCM sound)
-{
-       SoundId id;
-
-       id = CclGetSoundId(sound);
-       PlayGameSound(id, MaxSampleVolume);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPlaySound(lua_State* l)
 {
        SoundId id;
@@ -397,47 +244,11 @@
        PlayGameSound(id, MaxSampleVolume);
        return 0;
 }
-#endif
-
-/**
-**             Test whether a scheme object is a clone sound id
-**
-**             @param sound            the scheme object
-**
-**             @return                         true is sound is a clone sound 
id
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global int ccl_sound_p(SCM sound)
-{
-       return CCL_SOUNDP(sound);
-}
-#endif
-
-/**
-**             Cast a scheme object to a clone sound id
-**
-**             @param sound            the scheme object
-**
-**             @return                         the clone sound id
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global SoundId ccl_sound_id(SCM sound)
-{
-       return CCL_SOUND_ID(sound);
-}
-#endif
 
 /**
 **             Glue between c and scheme. Ask the sound system to dump on the
 **             standard output the mapping between sound names and sound id.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDisplaySounds(void)
-{
-       DisplaySoundHashTable();
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDisplaySounds(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -448,108 +259,11 @@
        DisplaySoundHashTable();
        return 0;
 }
-#endif
 
 /**
 **             Glue between c and scheme. Allows to specify some global game 
sounds
 **             in a ccl file.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineGameSounds(SCM list)
-{
-       //FIXME: should allow to define ALL the game sounds
-       SCM value;
-       SCM data;
-       SCM sublist;
-       char* str;
-       int i;
-
-       while (!gh_null_p(list)) {
-
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (!gh_symbol_p(value)) {
-                       PrintFunction();
-                       fprintf(stdout, "Symbol expected\n");
-                       return list;
-               }
-               // prepare for next iteration
-
-               // let's handle now the different cases
-               if (gh_eq_p(value, gh_symbol2scm("click"))) {
-                       data = gh_car(list);
-                       list = gh_cdr(list);
-                       if (!CCL_SOUNDP(data)) {
-                               fprintf(stderr, "Sound id expected\n");
-                               return list;
-                       }
-                       GameSounds.Click.Sound = CCL_SOUND_ID(data);
-               } else if (gh_eq_p(value, gh_symbol2scm("placement-error"))) {
-                       data = gh_car(list);
-                       list = gh_cdr(list);
-                       if (!CCL_SOUNDP(data)) {
-                               fprintf(stderr, "Sound id expected\n");
-                               return list;
-                       }
-                       GameSounds.PlacementError.Sound = CCL_SOUND_ID(data);
-               } else if (gh_eq_p(value, gh_symbol2scm("placement-success"))) {
-                       data = gh_car(list);
-                       list = gh_cdr(list);
-                       if (!CCL_SOUNDP(data)) {
-                               fprintf(stderr, "Sound id expected\n");
-                               return list;
-                       }
-                       GameSounds.PlacementSuccess.Sound = CCL_SOUND_ID(data);
-               } else if (gh_eq_p(value,gh_symbol2scm("work-complete"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       str = gh_scm2newstr(gh_car(sublist), NULL);
-                       for (i = 0; i < PlayerRaces.Count; ++i) {
-                               if (!strcmp(PlayerRaces.Name[i], str)) {
-                                       break;
-                               }
-                       }
-                       if (i == PlayerRaces.Count) {
-                               fprintf(stderr, "Unknown race: %s\n", str);
-                               ExitFatal(1);
-                       }
-                       free(str);
-                       sublist = gh_cdr(sublist);
-                       data = gh_car(sublist);
-                       if (!CCL_SOUNDP(data)) {
-                               fprintf(stderr, "Sound id expected\n");
-                               ExitFatal(1);
-                       }
-                       GameSounds.WorkComplete[i].Sound = CCL_SOUND_ID(data);
-               } else if (gh_eq_p(value,gh_symbol2scm("rescue"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       str = gh_scm2newstr(gh_car(sublist), NULL);
-                       for (i = 0; i < PlayerRaces.Count; ++i) {
-                               if (!strcmp(PlayerRaces.Name[i], str)) {
-                                       break;
-                               }
-                       }
-                       if (i == PlayerRaces.Count) {
-                               fprintf(stderr, "Unknown race: %s\n", str);
-                               ExitFatal(1);
-                       }
-                       free(str);
-                       sublist = gh_cdr(sublist);
-                       data = gh_car(sublist);
-                       if (!CCL_SOUNDP(data)) {
-                               fprintf(stderr, "Sound id expected\n");
-                               ExitFatal(1);
-                       }
-                       GameSounds.Rescue[i].Sound = CCL_SOUND_ID(data);
-               } else {
-                       errl("Unsupported tag", value);
-                       return list;
-               }
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineGameSounds(lua_State* l)
 {
        //FIXME: should allow to define ALL the game sounds
@@ -644,20 +358,12 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Global volume support
 **
 **             @param volume           new global sound volume
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSoundVolume(SCM volume)
-{
-       SetGlobalVolume(gh_scm2int(volume));
-       return volume;
-}
-#elif defined(USE_LUA)
 local int CclSetSoundVolume(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -669,20 +375,12 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Music volume support
 **
 **             @param volume           new global music volume
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMusicVolume(SCM volume)
-{
-       SetMusicVolume(gh_scm2int(volume));
-       return volume;
-}
-#elif defined(USE_LUA)
 local int CclSetMusicVolume(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -694,37 +392,12 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Set cd mode
 **
 **             @param mode             cd mode
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetCdMode(SCM mode)
-{
-#ifdef USE_CDAUDIO
-       CDModes cdmode;
-
-       if (gh_eq_p(mode, gh_symbol2scm("all"))) {
-               cdmode = CDModeAll;
-       } else if (gh_eq_p(mode, gh_symbol2scm("random"))) {
-               cdmode = CDModeRandom;
-       } else if (gh_eq_p(mode, gh_symbol2scm("defined"))) {
-               cdmode = CDModeDefined;
-       } else if (gh_eq_p(mode, gh_symbol2scm("off"))) {
-               cdmode = CDModeOff;
-       } else {
-               cdmode = CDModeOff;
-               errl("Unsupported tag", mode);
-       }
-
-       PlayCDRom(cdmode);
-#endif
-       return mode;
-}
-#elif defined(USE_LUA)
 local int CclSetCdMode(lua_State* l)
 {
 #ifdef USE_CDAUDIO
@@ -756,236 +429,147 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Define play sections
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefinePlaySections(SCM list)
+local int CclDefinePlaySections(lua_State* l)
 {
-       SCM value;
-       SCM sublist;
+       const char* value;
        PlaySection* p;
-       int i;
+       int args;
+       int j;
+       int subargs;
+       int k;
 
        ++NumPlaySections;
        PlaySections = realloc(PlaySections, NumPlaySections * 
sizeof(PlaySection));
        p = PlaySections + NumPlaySections - 1;
        memset(p, 0, sizeof(PlaySection));
 
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("race"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       p->Race = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("type"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("game"))) {
+       args = lua_gettop(l);
+       for (j = 0; j < args; ++j) {
+               value = LuaToString(l, j + 1);
+               ++j;
+               if (!strcmp(value, "race")) {
+                       p->Race = strdup(LuaToString(l, j + 1));
+               } else if (!strcmp(value, "type")) {
+                       value = LuaToString(l, j + 1);
+                       if (!strcmp(value, "game")) {
                                p->Type = PlaySectionGame;
-                       } else if (gh_eq_p(value, gh_symbol2scm("briefing"))) {
+                       } else if (!strcmp(value, "briefing")) {
                                p->Type = PlaySectionBriefing;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("stats-victory"))) {
+                       } else if (!strcmp(value, "stats-victory")) {
                                p->Type = PlaySectionStatsVictory;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("stats-defeat"))) {
+                       } else if (!strcmp(value, "stats-defeat")) {
                                p->Type = PlaySectionStatsDefeat;
-                       } else if (gh_eq_p(value, gh_symbol2scm("main-menu"))) {
+                       } else if (!strcmp(value, "main-menu")) {
                                p->Type = PlaySectionMainMenu;
                        } else {
-                               errl("Unsupported tag", value);
+                               lua_pushfstring(l, "Unsupported tag: %s", 
value);
+                               lua_error(l);
                        }
-               } else if (gh_eq_p(value, gh_symbol2scm("cd"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("order"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       if (gh_eq_p(value, 
gh_symbol2scm("all"))) {
+               } else if (!strcmp(value, "cd")) {
+                       if (!lua_istable(l, j + 1)) {
+                               lua_pushstring(l, "incorrect argument");
+                               lua_error(l);
+                       }
+                       subargs = luaL_getn(l, j + 1);
+                       for (k = 0; k < subargs; ++k) {
+                               lua_rawgeti(l, j + 1, k + 1);
+                               value = LuaToString(l, -1);
+                               lua_pop(l, 1);
+                               ++k;
+                               if (!strcmp(value, "order")) {
+                                       lua_rawgeti(l, j + 1, k + 1);
+                                       value = LuaToString(l, -1);
+                                       lua_pop(l, 1);
+                                       if (!strcmp(value, "all")) {
                                                p->CDOrder = 
PlaySectionOrderAll;
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("random"))) {
+                                       } else if (!strcmp(value, "random")) {
                                                p->CDOrder = 
PlaySectionOrderRandom;
                                        } else {
-                                               errl("Unsupported tag", value);
+                                               lua_pushfstring(l, "Unsupported 
tag: %s", value);
+                                               lua_error(l);
                                        }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("tracks"))) {
-                                       SCM temp;
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       for (i = 0; i < 
(signed)gh_vector_length(value); ++i) {
-                                               temp=gh_vector_ref(value, 
gh_int2scm(i));
-                                               p->CDTracks |= (1 << 
gh_scm2int(temp));
+                               } else if (!strcmp(value, "tracks")) {
+                                       int subsubargs;
+                                       int subk;
+
+                                       lua_rawgeti(l, j + 1, k + 1);
+                                       if (!lua_istable(l, -1)) {
+                                               lua_pushstring(l, "incorrect 
argument");
+                                               lua_error(l);
                                        }
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("no-cd"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("order"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       if (gh_eq_p(value, 
gh_symbol2scm("all"))) {
-                                               p->FileOrder = 
PlaySectionOrderAll;
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("random"))) {
-                                               p->FileOrder = 
PlaySectionOrderRandom;
-                                       } else {
-                                               errl("Unsupported tag", value);
-                                       }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("files"))) {
-                                       SCM sublist2;
-
-                                       sublist2 = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       i = 0;
-                                       while (!gh_null_p(sublist2)) {
-                                               value = gh_car(sublist2);
-                                               sublist2 = gh_cdr(sublist2);
-                                               ++i;
-                                               p->Files = realloc(p->Files, (i 
+ 1) * sizeof(char*));
-                                               p->Files[i - 1] = 
gh_scm2newstr(value, NULL);
-                                               p->Files[i] = NULL;
+                                       subsubargs = luaL_getn(l, -1);
+                                       for (subk = 0; subk < subsubargs; 
++subk) {
+                                               lua_rawgeti(l, -1, subk + 1);
+                                               p->CDTracks |= (1 << 
(int)LuaToNumber(l, -1));
+                                               lua_pop(l, 1);
                                        }
+                                       lua_pop(l, 1);
                                } else {
-                                       errl("Unsupported tag", value);
+                                       lua_pushfstring(l, "Unsupported tag: 
%s", value);
+                                       lua_error(l);
                                }
                        }
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
-local int CclDefinePlaySections(lua_State* l)
-{
-#if 0
-       SCM value;
-       SCM sublist;
-       PlaySection* p;
-       int i;
-
-       ++NumPlaySections;
-       PlaySections = realloc(PlaySections, NumPlaySections * 
sizeof(PlaySection));
-       p = PlaySections + NumPlaySections - 1;
-       memset(p, 0, sizeof(PlaySection));
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("race"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       p->Race = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("type"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("game"))) {
-                               p->Type = PlaySectionGame;
-                       } else if (gh_eq_p(value, gh_symbol2scm("briefing"))) {
-                               p->Type = PlaySectionBriefing;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("stats-victory"))) {
-                               p->Type = PlaySectionStatsVictory;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("stats-defeat"))) {
-                               p->Type = PlaySectionStatsDefeat;
-                       } else if (gh_eq_p(value, gh_symbol2scm("main-menu"))) {
-                               p->Type = PlaySectionMainMenu;
-                       } else {
-                               errl("Unsupported tag", value);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("cd"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("order"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       if (gh_eq_p(value, 
gh_symbol2scm("all"))) {
-                                               p->CDOrder = 
PlaySectionOrderAll;
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("random"))) {
-                                               p->CDOrder = 
PlaySectionOrderRandom;
-                                       } else {
-                                               errl("Unsupported tag", value);
-                                       }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("tracks"))) {
-                                       SCM temp;
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       for (i = 0; i < 
(signed)gh_vector_length(value); ++i) {
-                                               temp=gh_vector_ref(value, 
gh_int2scm(i));
-                                               p->CDTracks |= (1 << 
gh_scm2int(temp));
-                                       }
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
+               } else if (!strcmp(value, "no-cd")) {
+                       if (!lua_istable(l, j + 1)) {
+                               lua_pushstring(l, "incorrect argument");
+                               lua_error(l);
                        }
-               } else if (gh_eq_p(value, gh_symbol2scm("no-cd"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("order"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       if (gh_eq_p(value, 
gh_symbol2scm("all"))) {
+                       subargs = luaL_getn(l, j + 1);
+                       for (k = 0; k < subargs; ++k) {
+                               lua_rawgeti(l, j + 1, k + 1);
+                               value = LuaToString(l, -1);
+                               lua_pop(l, 1);
+                               ++k;
+                               if (!strcmp(value, "order")) {
+                                       lua_rawgeti(l, j + 1, k + 1);
+                                       value = LuaToString(l, -1);
+                                       lua_pop(l, 1);
+                                       if (!strcmp(value, "all")) {
                                                p->FileOrder = 
PlaySectionOrderAll;
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("random"))) {
+                                       } else if (!strcmp(value, "random")) {
                                                p->FileOrder = 
PlaySectionOrderRandom;
                                        } else {
-                                               errl("Unsupported tag", value);
+                                               lua_pushfstring(l, "Unsupported 
tag: %s", value);
+                                               lua_error(l);
                                        }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("files"))) {
-                                       SCM sublist2;
-
-                                       sublist2 = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       i = 0;
-                                       while (!gh_null_p(sublist2)) {
-                                               value = gh_car(sublist2);
-                                               sublist2 = gh_cdr(sublist2);
-                                               ++i;
-                                               p->Files = realloc(p->Files, (i 
+ 1) * sizeof(char*));
-                                               p->Files[i - 1] = 
gh_scm2newstr(value, NULL);
-                                               p->Files[i] = NULL;
+                               } else if (!strcmp(value, "files")) {
+                                       int subsubargs;
+                                       int subk;
+
+                                       lua_rawgeti(l, j + 1, k + 1);
+                                       if (!lua_istable(l, -1)) {
+                                               lua_pushstring(l, "incorrect 
argument");
+                                               lua_error(l);
+                                       }
+                                       subsubargs = luaL_getn(l, -1);
+                                       p->Files = malloc((subsubargs + 1) * 
sizeof(char*));
+                                       p->Files[subsubargs] = NULL;
+                                       for (subk = 0; subk < subsubargs; 
++subk) {
+                                               lua_rawgeti(l, -1, subk + 1);
+                                               p->Files[subk] = 
strdup(LuaToString(l, -1));
+                                               lua_pop(l, 1);
                                        }
+                                       lua_pop(l, 1);
                                } else {
-                                       errl("Unsupported tag", value);
+                                       lua_pushfstring(l, "Unsupported tag: 
%s", value);
+                                       lua_error(l);
                                }
                        }
                } else {
-                       errl("Unsupported tag", value);
+                       lua_pushfstring(l, "Unsupported tag: %s", value);
+                       lua_error(l);
                }
        }
-#endif
        return 0;
 }
-#endif
 
 /**
 **             Turn Off Sound (client side)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSoundOff(void)
-{
-       SoundOff = 1;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSoundOff(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -996,7 +580,6 @@
        SoundOff = 1;
        return 0;
 }
-#endif
 
 /**
 **             Turn On Sound (client side)
@@ -1004,16 +587,6 @@
 **             @return true if and only if the sound is REALLY turned on
 **                             (uses SoundFildes)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSoundOn(void)
-{
-       if (SoundFildes != -1) {
-               return SCM_BOOL_T;
-       }
-       SoundOff = 0;
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclSoundOn(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1029,19 +602,10 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **             Turn Off Music (client side)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMusicOff(void)
-{
-       StopMusic();
-       MusicOff = 1;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclMusicOff(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1053,7 +617,6 @@
        MusicOff = 1;
        return 0;
 }
-#endif
 
 /**
 **             Turn On Music (client side)
@@ -1061,13 +624,6 @@
 **             @return true if and only if the sound is REALLY turned on
 **                             (uses SoundFildes)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMusicOn(void)
-{
-       MusicOff = 0;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclMusicOn(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1078,26 +634,12 @@
        MusicOff = 0;
        return 0;
 }
-#endif
 
 /**
 **             Set the cut off distance.
 **
 **             @param distance new cut off distance for sounds
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGlobalSoundRange(SCM distance)
-{
-       int d;
-
-       // FIXME: check for errors
-       d = gh_scm2int(distance);
-       if (d > 0) {
-               DistanceSilent = d;
-       }
-       return distance;
-}
-#elif defined(USE_LUA)
 local int CclSetGlobalSoundRange(lua_State* l)
 {
        int d;
@@ -1115,20 +657,10 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Ask clone to use a sound thread
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSoundThread(void)
-{
-#ifdef USE_THREAD
-       WithSoundThread = 1;
-#endif
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSoundThread(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1141,7 +673,6 @@
 #endif
        return 0;
 }
-#endif
 
 /**
 **             Set the range of a given sound.
@@ -1149,31 +680,10 @@
 **             @param sound            the sound id or name of the sound
 **             @param range            the new range for this sound
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSoundRange(SCM sound, SCM range) {
-       //FIXME check for errors
-       unsigned char theRange;
-       int tmp;
-       SoundId id;
-
-       tmp = gh_scm2int(range);
-       if (tmp < 0) {
-               theRange = 0;
-       } else if (tmp > 255) {
-               theRange = 255;
-       } else {
-               theRange = (unsigned char)tmp;
-       }
-       DebugLevel3("Range: %u (%d)\n" _C_ TheRange _C_ tmp);
-       id = CclGetSoundId(sound);
-       SetSoundRange(id, theRange);
-       return sound;
-}
-#elif defined(USE_LUA)
 local int CclSetSoundRange(lua_State* l) {
        unsigned char theRange;
        int tmp;
-//     SoundId id;
+       SoundId id;
 
        if (lua_gettop(l) != 2) {
                lua_pushstring(l, "incorrect argument");
@@ -1189,30 +699,17 @@
                theRange = (unsigned char)tmp;
        }
        DebugLevel3("Range: %u (%d)\n" _C_ TheRange _C_ tmp);
-//     id = CclGetSoundId(sound);
-//     SetSoundRange(id, theRange);
-//     return sound;
-       return 0;
+       lua_pushvalue(l, 1);
+       id = CclGetSoundId(l);
+       SetSoundRange(id, theRange);
+       return 1;
 }
-#endif
 
 /**
 **             Play a music file.
 **
 **             @param name             Name of the music file to play.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPlayMusic(SCM name)
-{
-       char* music_name;
-
-       music_name = gh_scm2newstr(name, NULL);
-       PlayMusic(music_name);
-       free(music_name);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPlayMusic(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1224,25 +721,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Play a sound file.
 **
 **             @param name             Name of the sound file to play.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPlayFile(SCM name)
-{
-       char* filename;
-
-       filename = gh_scm2newstr(name, NULL);
-       PlayFile(filename);
-       free(filename);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPlayFile(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1254,19 +738,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Stop playing music.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclStopMusic(void)
-{
-       StopMusic();
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclStopMusic(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1278,41 +753,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for sound.
 */
 global void SoundCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       SiodSoundTag = CclMakeSmobType("Sound");
-
-       gh_new_procedure1_0("set-sound-volume!", CclSetSoundVolume);
-       gh_new_procedure1_0("set-music-volume!", CclSetMusicVolume);
-       gh_new_procedure1_0("set-cd-mode!", CclSetCdMode);
-
-       gh_new_procedureN("define-play-sections", CclDefinePlaySections);
-
-       gh_new_procedure0_0("sound-off", CclSoundOff);
-       gh_new_procedure0_0("sound-on", CclSoundOn);
-       gh_new_procedure0_0("music-off", CclMusicOff);
-       gh_new_procedure0_0("music-on", CclMusicOn);
-       gh_new_procedure0_0("sound-thread", CclSoundThread);
-       gh_new_procedure1_0("set-global-sound-range!", CclSetGlobalSoundRange);
-       gh_new_procedureN("define-game-sounds", CclDefineGameSounds);
-       gh_new_procedure0_0("display-sounds", CclDisplaySounds);
-       gh_new_procedure2_0("map-sound", CclMapSound);
-       gh_new_procedure1_0("sound-for-name", CclSoundForName);
-       gh_new_procedure2_0("set-sound-range!", CclSetSoundRange);
-       gh_new_procedure2_0("make-sound", CclMakeSound);
-       gh_new_procedure3_0("make-sound-group", CclMakeSoundGroup);
-       gh_new_procedure1_0("play-sound", CclPlaySound);
-
-       gh_new_procedure1_0("play-music", CclPlayMusic);
-       gh_new_procedure1_0("play-file", CclPlayFile);
-       gh_new_procedure0_0("stop-music", CclStopMusic);
-#elif defined(USE_LUA)
        lua_register(Lua, "SetSoundVolume", CclSetSoundVolume);
        lua_register(Lua, "SetMusicVolume", CclSetMusicVolume);
        lua_register(Lua, "SetCdMode", CclSetCdMode);
@@ -1337,7 +783,6 @@
        lua_register(Lua, "PlayMusic", CclPlayMusic);
        lua_register(Lua, "PlayFile", CclPlayFile);
        lua_register(Lua, "StopMusic", CclStopMusic);
-#endif
 }
 
 #else          // }{ WITH_SOUND
@@ -1349,12 +794,6 @@
 **
 **             @param volume           new global sound volume
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSoundVolume(SCM volume)
-{
-       return volume;
-}
-#elif defined(USE_LUA)
 local int CclSetSoundVolume(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1364,19 +803,12 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Music volume support
 **
 **             @param volume           new global music volume
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMusicVolume(SCM volume)
-{
-       return volume;
-}
-#elif defined(USE_LUA)
 local int CclSetMusicVolume(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1386,19 +818,12 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Set cd mode
 **
 **             @param mode             cd mode
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetCdMode(SCM mode)
-{
-       return mode;
-}
-#elif defined(USE_LUA)
 local int CclSetCdMode(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1408,22 +833,14 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Turn Off Sound (client side)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSoundOff(void)
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSoundOff(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Turn On Sound (client side)
@@ -1431,33 +848,19 @@
 **             @return true if and only if the sound is REALLY turned on
 **                             (uses SoundFildes)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSoundOn(void)
-{
-       return SCM_BOOL_T;
-}
-#elif defined(USE_LUA)
 local int CclSoundOn(lua_State* l)
 {
        lua_pushboolean(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Turn Off Music (client side)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMusicOff(void)
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclMusicOff(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Turn On Music (client side)
@@ -1465,29 +868,16 @@
 **             @return true if and only if the sound is REALLY turned on
 **                             (uses SoundFildes)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMusicOn(void)
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclMusicOn(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Set the cut off distance.
 **
 **             @param distance new cut off distance for sounds
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGlobalSoundRange(SCM distance)
-{
-       return distance;
-}
-#elif defined(USE_LUA)
 local int CclSetGlobalSoundRange(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1497,7 +887,6 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Set the range of a given sound.
@@ -1505,12 +894,6 @@
 **             @param sound            the sound id or name of the sound
 **             @param range            the new range for this sound
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSoundRange(SCM sound, SCM range __attribute__((unused)))
-{
-       return sound;
-}
-#elif defined(USE_LUA)
 local int CclSetSoundRange(lua_State* l)
 {
        if (lua_gettop(l) != 2) {
@@ -1520,70 +903,41 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Ask clone to use a sound thread
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSoundThread(void)
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSoundThread(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Glue between c and scheme. Ask the sound system to dump on the
 **             standard output the mapping between sound names and sound id.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDisplaySounds(void)
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDisplaySounds(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Glue between c and scheme. Ask the sound system to associate a 
sound
 **             id to a sound name.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSoundForName(SCM name __attribute__((unused)))
-{
-       return NIL;
-}
-#elif defined(USE_LUA)
 local int CclSoundForName(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Glue between c and scheme. Allows to specify some global game 
sounds
 **             in a ccl file.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineGameSounds(SCM list __attribute__((unused)))
-{
-       return NIL;
-}
-#elif defined(USE_LUA)
 local SCM CclDefineGameSounds(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Glue between c and scheme. Ask to the sound system to remap a 
sound id
@@ -1594,12 +948,6 @@
 **
 **             @return                         the sound object
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMapSound(SCM name __attribute__((unused)), SCM sound)
-{
-       return sound;
-}
-#elif defined(USE_LUA)
 local int CclMapSound(lua_State* l)
 {
        if (lua_gettop(l) != 2) {
@@ -1609,66 +957,32 @@
        lua_pushvalue(l, 2);
        return 1;
 }
-#endif
 
 /**
 **             Play a music file.
 **
 **             @param name             Name of the music file to play.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPlayMusic(SCM name __attribute__((unused)))
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPlayMusic(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Play a sound file.
 **
 **             @param name             Name of the sound file to play.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPlayFile(SCM name __attribute__((unused)))
-{
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPlayFile(lua_State* l)
 {
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for sound. Dummy version.
 */
 global void SoundCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure1_0("set-sound-volume!", CclSetSoundVolume);
-       gh_new_procedure1_0("set-music-volume!", CclSetMusicVolume);
-       gh_new_procedure1_0("set-cd-mode!", CclSetCdMode);
-       gh_new_procedure0_0("sound-off", CclSoundOff);
-       gh_new_procedure0_0("sound-on", CclSoundOn);
-       gh_new_procedure0_0("music-off", CclMusicOff);
-       gh_new_procedure0_0("music-on", CclMusicOn);
-       gh_new_procedure0_0("sound-thread", CclSoundThread);
-       gh_new_procedure1_0("set-global-sound-range!", CclSetGlobalSoundRange);
-       gh_new_procedureN("define-game-sounds", CclDefineGameSounds);
-       gh_new_procedure0_0("display-sounds", CclDisplaySounds);
-       gh_new_procedure2_0("map-sound", CclMapSound);
-       gh_new_procedure1_0("sound-for-name", CclSoundForName);
-       gh_new_procedure2_0("set-sound-range!", CclSetSoundRange);
-
-       gh_new_procedure1_0("play-music", CclPlayMusic);
-       gh_new_procedure1_0("play-file", CclPlayFile);
-#elif defined(USE_LUA)
        lua_register(Lua, "SetSoundVolume!", CclSetSoundVolume);
        lua_register(Lua, "SetMusicVolume!", CclSetMusicVolume);
        lua_register(Lua, "SetCdMode!", CclSetCdMode);
@@ -1686,7 +1000,6 @@
 
        lua_register(Lua, "PlayMusic", CclPlayMusic);
        lua_register(Lua, "PlayFile", CclPlayFile);
-#endif
 }
 
 #endif         // } !WITH_SOUND
Index: stratagus/src/stratagus/ccl.c
diff -u stratagus/src/stratagus/ccl.c:1.149 stratagus/src/stratagus/ccl.c:1.150
--- stratagus/src/stratagus/ccl.c:1.149 Tue Dec 23 11:14:15 2003
+++ stratagus/src/stratagus/ccl.c       Fri Jan  2 08:24:14 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl.c,v 1.149 2003/12/23 00:14:15 jsalmon3 Exp $
+//     $Id: ccl.c,v 1.150 2004/01/01 21:24:14 jsalmon3 Exp $
 
 //@{
 
@@ -78,53 +78,20 @@
 /// Uncomment this to enable additionnal check on GC operations
 // #define DEBUG_GC
 
-#ifdef USE_GUILE
-#define GC_PROTECT_VALUE 1
-#endif
-
-#ifdef SIOD_HEAP_GC
-#define GC_PROTECT_VALUE 1
-#endif
-
-#ifdef USE_GUILE
-int siod_verbose_level;
-#endif
-
-#ifdef USE_LUA
 global lua_State* Lua;
-#endif
-
-global char* CclStartFile;                             /// CCL start file
-global char* GameName;                                         /// Game 
Preferences
-global int CclInConfigFile;                            /// True while config 
file parsing
-
-global char*           Tips[MAX_TIPS + 1];             /// Array of tips
-global int             ShowTips;                               /// Show tips 
at start of level
-global int             CurrentTip;                             /// Current tip 
to display
 
-#ifdef DEBUG_GC
-
-#ifdef USE_GUILE
-#define CHECK_GC_VALUES 1
-#else
-#ifdef SIOD_HEAP_GC
-#define CHECK_GC_VALUES 1
-#endif
-#endif
-
-local SCM*   ProtectedCells[16384];
-local int      ProtectedCellCount=0;
-#ifdef CHECK_GC_VALUES
-local SCM      ProtectedCellValues[16384];
-#endif
-
-#endif
+global char* CclStartFile;              /// CCL start file
+global char* GameName;                  /// Game Preferences
+global int   CclInConfigFile;           /// True while config file parsing
+
+global char* Tips[MAX_TIPS + 1];        /// Array of tips
+global int   ShowTips;                  /// Show tips at start of level
+global int   CurrentTip;                /// Current tip to display
 
 /*----------------------------------------------------------------------------
 --             Functions
 ----------------------------------------------------------------------------*/
 
-#ifdef USE_LUA
 /**
 **  FIXME: docu
 */
@@ -266,327 +233,6 @@
        luaL_checktype(l, narg, LUA_TBOOLEAN);
        return lua_toboolean(l, narg);
 }
-#endif
-
-/**
-**             Convert a SCM to a string, SCM must be a symbol or string, else 0
-**             is returned
-**
-**             @param scm the SCM to convert to string
-**
-**             @return a string representing the SCM or 0 in case the 
conversion
-**             failed, caller must free() the returned value
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global char* CclConvertToString(SCM scm)
-{
-#ifdef USE_GUILE
-       if (gh_string_p(scm)) {
-               return gh_scm2newstr(scm, NULL);
-       } else if (gh_symbol_p(scm)) {
-               return gh_symbol2newstr(scm, NULL);
-       } else {
-               return 0;
-       }
-#else
-       char* str;
-
-       str = try_get_c_string(scm);
-       if (str) {
-               return strdup(str);
-       } else {
-               return 0;
-       }
-#endif
-}
-#endif
-
-/**
-**             Return the type of a smob
-**
-**             @param smob
-**
-**             @return type id of the smob
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global ccl_smob_type_t CclGetSmobType(SCM smob)
-{
-#ifdef USE_GUILE
-       if (SCM_NIMP(smob)) {
-               return (ccl_smob_type_t)SCM_CAR(smob);
-       } else {
-               return 0;
-       }
-#else
-       return TYPE(smob);
-#endif
-}
-#endif
-
-/**
-**             Return the pointer that is stored in a smob
-**
-**             @param smob the smob that contains the pointer
-**
-**             @return pointer that was inside the smob
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global void* CclGetSmobData(SCM smob)
-{
-#ifdef USE_GUILE
-       return (void*)SCM_SMOB_DATA(smob);
-#else
-       return smob->storage_as.cons.cdr;
-#endif
-}
-#endif
-
-/**
-**             Store a pointer inside a SMOB, aka convert a pointer to a SCM
-**
-**             @param tag The type of the pointer/smob
-**             @param ptr the pointer that should be converted to a SCM
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global SCM CclMakeSmobObj(ccl_smob_type_t tag, void* ptr)
-{
-#ifdef USE_GUILE
-       SCM_RETURN_NEWSMOB(tag, ptr);
-#else
-       SCM value;
-
-       value = cons(NIL, NIL);
-       value->type = tag;
-       value->storage_as.cons.cdr = (SCM)ptr;
-
-       return value;
-#endif
-}
-#endif
-
-/**
-**             Create a tag for a new type.
-**
-**             @param name
-**
-**             @return The newly generated SMOB type
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global ccl_smob_type_t CclMakeSmobType(const char* name)
-{
-       ccl_smob_type_t new_type;
-
-#ifdef USE_GUILE
-       new_type = scm_make_smob_type((char*)name, 0);
-#else
-       new_type = allocate_user_tc();
-#endif
-
-  return new_type;
-}
-#endif
-
-
-#ifdef DEBUG_GC
-
-/**
-**             Check if a cell is already protected
-**
-**             @param val              the cell to find
-**             @return                 the index of the cell or -1
-*/
-local int FindProtectedCell(SCM * val)
-{
-       int i;
-       for (i = 0; i < ProtectedCellCount; i++) {
-               if (ProtectedCells[i] == val) {
-                       return i;
-               }
-       }
-       return -1;
-}
-
-local void AddProtectedCell(SCM * var)
-{
-       DebugCheck(ProtectedCellCount >= 16384);
-       ProtectedCells[ProtectedCellCount] = var;
-#ifdef CHECK_GC_VALUES
-       ProtectedCellValues[ProtectedCellCount] = *var;
-#endif
-
-       ProtectedCellCount++;
-}
-
-local void DelProtectedCell(int id)
-{
-       ProtectedCellCount--;
-
-       ProtectedCells[id]=ProtectedCells[ProtectedCellCount];
-#ifdef CHECK_GC_VALUES
-       ProtectedCellValues[id]=ProtectedCellValues[ProtectedCellCount];
-#endif
-}
-
-local void CheckProtectedCell(SCM* obj,int id)
-{
-#ifdef CHECK_GC_VALUES
-       int i;
-       DebugCheck(ProtectedCellValues[id] != *obj);
-       for (i = 0; i < ProtectedCellCount; i++) {
-               DebugCheck(ProtectedCellValues[i] != (*ProtectedCells[i]));
-       }
-#endif
-}
-
-local void SetProtectedCell(int id,SCM obj)
-{
-#ifdef CHECK_GC_VALUES
-       ProtectedCellValues[id] = obj;
-#endif
-}
-
-#endif
-
-#ifdef GC_PROTECT_VALUE
-/**
-**             Check if it is usefull to GC-protect a given value
-**
-**             @param val the value to GC-protect
-**             @return 1 if the value is neither SCM_UNSPECIFIED nor NULL
-*/
-local int CclNeedProtect(SCM val)
-{
-       return (val != SCM_UNSPECIFIED) && (val != NULL) && (!gh_null_p(val));
-}
-#endif
-
-/**
-**             Protect SCM object against garbage collector.
-**
-**             @param obj              Scheme object
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global void CclGcProtect(SCM * obj)
-{
-#ifdef DEBUG_GC
-       // Protecting an already protected cell ?
-       DebugCheck(FindProtectedCell(obj) >= 0);
-       AddProtectedCell(obj);
-#endif
-
-#ifdef GC_PROTECT_VALUE
-       if (!CclNeedProtect(*obj)) {
-               return;
-       }
-#endif
-
-#ifdef USE_GUILE
-       scm_gc_protect_object(*obj);
-#else
-#ifdef SIOD_HEAP_GC
-       SCM var;
-
-       var = gh_symbol2scm("*ccl-protect*");
-       setvar(var, cons(obj, symbol_value(var, NIL)), NIL);
-#else
-       gc_protect(obj);
-#endif
-#endif
-}
-#elif defined(USE_LUA)
-#endif
-
-/**
-**             Remove a SCM object from garbage collectors protection list.
-**
-**             @param obj              Scheme object
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global void CclGcUnprotect(SCM * obj)
-{
-#ifdef DEBUG_GC
-       int id;
-
-       // Check if already protected
-       id = FindProtectedCell(obj);
-       DebugCheck( id == -1);
-       CheckProtectedCell(obj,id);
-       DelProtectedCell(id);
-#endif
-
-#ifdef GC_PROTECT_VALUE
-       if (!CclNeedProtect(*obj)) {
-               return;
-       }
-#endif
-#ifdef USE_GUILE
-       scm_gc_unprotect_object(*obj);
-#else
-#ifdef SIOD_HEAP_GC
-       SCM sym;
-       SCM old_lst;
-       SCM new_lst;
-
-       // Remove obj from the list *ccl-protect*
-       sym = gh_symbol2scm("*ccl-protect*");
-       old_lst = symbol_value(sym, NIL);
-       new_lst = NIL;
-
-       // FIXME: Doesn't handle nested protect/unprotects
-       while (!gh_null_p(old_lst)) {
-               SCM el;
-
-               el = gh_car(old_lst);
-               if (el != (*obj)) {
-                       new_lst = cons(el, new_lst);
-               }
-               old_lst = gh_cdr(old_lst);
-       }
-
-       setvar(sym, new_lst, NIL);
-#else
-       gc_unprotect(obj);
-#endif
-#endif
-}
-#elif defined(USE_LUA)
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global void CclGcProtectedAssign(SCM* obj, SCM value)
-{
-       if (*obj == value) {
-               return;
-       }
-
-#ifdef GC_PROTECT_VALUE
-       CclGcUnprotect(obj);
-       (*obj) = value;
-       CclGcProtect(obj);
-#else
-#ifdef DEBUG_GC
-       int id;
-
-       // Check if already protected
-       id = FindProtectedCell(obj);
-       DebugCheck(id == -1);
-       CheckProtectedCell(obj,id);
-       SetProtectedCell(id,value);
-#endif                 // DEBUG_GC
-       (*obj) = value;
-#endif         // GC_PROTECT_VALUE
-}
-#elif defined(USE_LUA)
-#endif
-
-global void CclFlushOutput(void)
-{
-#ifdef USE_GUILE
-       scm_flush_all_ports();
-#else
-       fflush(stdout);
-#endif
-}
 
 /**
 **             Perform CCL garbage collection
@@ -595,36 +241,6 @@
 */
 global void CclGarbageCollect(int fast)
 {
-#if defined(USE_GUILE)
-       if (!fast) {
-               // GUILE handle gc nicely by itself
-                       scm_gc();
-       }
-#elif defined(USE_SIOD)
-#ifdef SIOD_HEAP_GC
-       static int cpt = 0;
-
-       // Very slow, so differ as much as possible...
-       if (!(++cpt & 15)) {
-                       user_gc(SCM_BOOL_F);
-       }
-#else
-       static int default_used_cells=0;
-       int new_used_cells;
-       int cur_used_cells=0;
-
-       // stop and copy iterates only the allocated SCM
-       if (!fast || (cur_used_cells=siod_used_cells()) > default_used_cells + 
10000) {
-                       gc_stop_and_copy();
-               new_used_cells = siod_used_cells();
-               if (fast) {
-                       DebugLevel2Fn("GC reduced %d cells to %d\n" _C_ 
cur_used_cells _C_ new_used_cells);
-               }
-               default_used_cells = new_used_cells;
-       }
-#endif
-#elif defined(USE_LUA)
-#endif
 }
 
 /*............................................................................
@@ -636,36 +252,22 @@
 **
 **             @return                         Current libray path.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclStratagusLibraryPath(void)
-{
-       return gh_str02scm(StratagusLibPath);
-}
-#elif defined(USE_LUA)
 local int CclStratagusLibraryPath(lua_State* l)
 {
        lua_pushstring(l, StratagusLibPath);
        return 1;
 }
-#endif
 
 /**
 **             Return the stratagus game-cycle
 **
 **             @return                         Current game cycle.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGameCycle(void)
-{
-       return gh_int2scm(GameCycle);
-}
-#elif defined(USE_LUA)
 local int CclGameCycle(lua_State* l)
 {
        lua_pushnumber(l, GameCycle);
        return 1;
 }
-#endif
 
 /**
 **       Return of game name.
@@ -674,26 +276,6 @@
 **
 **       @return                               Old game name.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGameName(SCM gamename)
-{
-       SCM old;
-
-       old = NIL;
-       if (GameName) {
-               old = gh_str02scm(GameName);
-       }
-       if (!gh_null_p(gamename)) {
-               if (GameName) {
-                       free(GameName);
-                       GameName = NULL;
-               }
-
-               GameName = gh_scm2newstr(gamename, NULL);
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetGameName(lua_State* l)
 {
        char* old;
@@ -721,18 +303,10 @@
        free(old);
        return 1;
 }
-#endif
 
 /**
 **             Set the stratagus game-cycle
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGameCycle(SCM cycle)
-{
-       GameCycle = gh_scm2int(cycle);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetGameCycle(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -742,22 +316,10 @@
        GameCycle = LuaToNumber(l, 1);
        return 0;
 }
-#endif
 
 /**
 **             Set the game paused or unpaused
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGamePaused(SCM paused)
-{
-       if (gh_boolean_p(paused)) {
-               GamePaused = gh_scm2bool(paused);
-       } else {
-               GamePaused = gh_scm2int(paused);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetGamePaused(lua_State* l)
 {
        if (lua_gettop(l) != 1 || (!lua_isnumber(l, 1) && !lua_isboolean(l, 
1))) {
@@ -771,18 +333,10 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Set the video sync speed
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetVideoSyncSpeed(SCM speed)
-{
-       VideoSyncSpeed = gh_scm2int(speed);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetVideoSyncSpeed(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -792,23 +346,10 @@
        VideoSyncSpeed = LuaToNumber(l, 1);
        return 0;
 }
-#endif
 
 /**
 **             Set the local player name
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetLocalPlayerName(SCM name)
-{
-       char* str;
-
-       str = gh_scm2newstr(name, 0);
-       strncpy(LocalPlayerName, str, sizeof(LocalPlayerName) - 1);
-       LocalPlayerName[sizeof(LocalPlayerName) - 1] = '\0';
-       free(str);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetLocalPlayerName(lua_State* l)
 {
        const char* str;
@@ -822,14 +363,12 @@
        LocalPlayerName[sizeof(LocalPlayerName) - 1] = '\0';
        return 0;
 }
-#endif
 
 /**
 **             Set God mode.
 **
 **             @return                         The old mode.
 */
-#if defined(USE_LUA)
 local int CclSetGodMode(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -840,7 +379,6 @@
        GodMode = LuaToBoolean(l, 1);
        return 0;
 }
-#endif
 
 /**
 **             Enable/disable Showing the tips at the start of a level.
@@ -848,17 +386,6 @@
 **             @param flag             True = turn on, false = off.
 **             @return                         The old state of tips displayed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetShowTips(SCM flag)
-{
-       int old;
-
-       old = ShowTips;
-       ShowTips = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetShowTips(lua_State* l)
 {
        int old;
@@ -873,7 +400,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set the current tip number.
@@ -881,20 +407,6 @@
 **             @param tip              Tip number.
 **             @return                         The old tip number.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetCurrentTip(SCM tip)
-{
-       int old;
-
-       old = CurrentTip;
-       CurrentTip = gh_scm2int(tip);
-       if (CurrentTip >= MAX_TIPS || Tips[CurrentTip] == NULL) {
-               CurrentTip = 0;
-       }
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetCurrentTip(lua_State* l)
 {
        lua_Number old;
@@ -912,7 +424,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Add a new tip to the list of tips.
@@ -922,24 +433,6 @@
 **             @todo           FIXME:          Memory for tips is never freed.
 **                             FIXME:          Make Tips dynamic.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAddTip(SCM tip)
-{
-       int i;
-
-       for (i = 0; i < MAX_TIPS; ++i) {
-               if (Tips[i] && !strcmp(get_c_string(tip), Tips[i])) {
-                       break;
-               }
-               if (Tips[i] == NULL) {
-                       Tips[i] = gh_scm2newstr(tip, NULL);
-                       break;
-               }
-       }
-
-       return tip;
-}
-#elif defined(USE_LUA)
 local int CclAddTip(lua_State* l)
 {
        int i;
@@ -963,7 +456,6 @@
        lua_pushstring(l, str);
        return 1;
 }
-#endif
 
 /**
 **             Set resource harvesting speed.
@@ -971,21 +463,6 @@
 **             @param resource         Name of resource.
 **             @param speed            Speed factor of harvesting resource.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSpeedResourcesHarvest(SCM resource, SCM speed)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts; ++i) {
-               if (gh_eq_p(resource, gh_symbol2scm(DefaultResourceNames[i]))) {
-                       SpeedResourcesHarvest[i] = gh_scm2int(speed);
-                       return SCM_UNSPECIFIED;
-               }
-       }
-       errl("Resource not found", resource);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetSpeedResourcesHarvest(lua_State* l)
 {
        int i;
@@ -1007,7 +484,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Set resource returning speed.
@@ -1015,21 +491,6 @@
 **             @param resource         Name of resource.
 **             @param speed            Speed factor of returning resource.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSpeedResourcesReturn(SCM resource, SCM speed)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts; ++i) {
-               if (gh_eq_p(resource, gh_symbol2scm(DefaultResourceNames[i]))) {
-                       SpeedResourcesReturn[i] = gh_scm2int(speed);
-                       return SCM_UNSPECIFIED;
-               }
-       }
-       errl("Resource not found", resource);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetSpeedResourcesReturn(lua_State* l)
 {
        int i;
@@ -1051,19 +512,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             For debug increase building speed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSpeedBuild(SCM speed)
-{
-       SpeedBuild = gh_scm2int(speed);
-
-       return speed;
-}
-#elif defined(USE_LUA)
 local int CclSetSpeedBuild(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1075,19 +527,10 @@
        lua_pushnumber(l, SpeedBuild);
        return 1;
 }
-#endif
 
 /**
 **             For debug increase training speed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSpeedTrain(SCM speed)
-{
-       SpeedTrain = gh_scm2int(speed);
-
-       return speed;
-}
-#elif defined(USE_LUA)
 local int CclSetSpeedTrain(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1099,19 +542,10 @@
        lua_pushnumber(l, SpeedTrain);
        return 1;
 }
-#endif
 
 /**
 **             For debug increase upgrading speed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSpeedUpgrade(SCM speed)
-{
-       SpeedUpgrade = gh_scm2int(speed);
-
-       return speed;
-}
-#elif defined(USE_LUA)
 local int CclSetSpeedUpgrade(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1123,19 +557,10 @@
        lua_pushnumber(l, SpeedUpgrade);
        return 1;
 }
-#endif
 
 /**
 **             For debug increase researching speed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSpeedResearch(SCM speed)
-{
-       SpeedResearch = gh_scm2int(speed);
-
-       return speed;
-}
-#elif defined(USE_LUA)
 local int CclSetSpeedResearch(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1147,27 +572,10 @@
        lua_pushnumber(l, SpeedResearch);
        return 1;
 }
-#endif
 
 /**
 **             For debug increase all speeds.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSpeeds(SCM speed)
-{
-       int i;
-       int s;
-
-       s = gh_scm2int(speed);
-       for (i = 0; i < MaxCosts; ++i) {
-               SpeedResourcesHarvest[i] = s;
-               SpeedResourcesReturn[i] = s;
-       }
-       SpeedBuild = SpeedTrain = SpeedUpgrade = SpeedResearch = s;
-
-       return speed;
-}
-#elif defined(USE_LUA)
 local int CclSetSpeeds(lua_State* l)
 {
        int i;
@@ -1187,23 +595,10 @@
        lua_pushnumber(l, s);
        return 1;
 }
-#endif
 
 /**
 **             Define default resources for a new player.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDefaultResources(SCM list)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts && !gh_null_p(list); ++i) {
-               DefaultResources[i] = gh_scm2int(gh_car(list));
-               list = gh_cdr(list);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDefaultResources(lua_State* l)
 {
        int i;
@@ -1215,23 +610,10 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Define default resources for a new player with low resources.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDefaultResourcesLow(SCM list)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts && !gh_null_p(list); ++i) {
-               DefaultResourcesLow[i] = gh_scm2int(gh_car(list));
-               list = gh_cdr(list);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDefaultResourcesLow(lua_State* l)
 {
        int i;
@@ -1243,23 +625,10 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Define default resources for a new player with mid resources.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDefaultResourcesMedium(SCM list)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts && !gh_null_p(list); ++i) {
-               DefaultResourcesMedium[i] = gh_scm2int(gh_car(list));
-               list = gh_cdr(list);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDefaultResourcesMedium(lua_State* l)
 {
        int i;
@@ -1271,23 +640,10 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Define default resources for a new player with high resources.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDefaultResourcesHigh(SCM list)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts && !gh_null_p(list); ++i) {
-               DefaultResourcesHigh[i] = gh_scm2int(gh_car(list));
-               list = gh_cdr(list);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDefaultResourcesHigh(lua_State* l)
 {
        int i;
@@ -1299,23 +655,10 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Define default incomes for a new player.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDefaultIncomes(SCM list)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts && !gh_null_p(list); ++i) {
-               DefaultIncomes[i] = gh_scm2int(gh_car(list));
-               list = gh_cdr(list);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDefaultIncomes(lua_State* l)
 {
        int i;
@@ -1327,27 +670,10 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Define default action for the resources.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDefaultActions(SCM list)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts; ++i) {
-               free(DefaultActions[i]);
-               DefaultActions[i] = NULL;
-       }
-       for (i = 0; i < MaxCosts && !gh_null_p(list); ++i) {
-               DefaultActions[i] = gh_scm2newstr(gh_car(list), 0);
-               list = gh_cdr(list);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDefaultActions(lua_State* l)
 {
        int i;
@@ -1363,27 +689,10 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Define default names for the resources.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDefaultResourceNames(SCM list)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts; ++i) {
-               free(DefaultResourceNames[i]);
-               DefaultResourceNames[i] = NULL;
-       }
-       for (i = 0; i < MaxCosts && !gh_null_p(list); ++i) {
-               DefaultResourceNames[i] = gh_scm2newstr(gh_car(list), 0);
-               list = gh_cdr(list);
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDefaultResourceNames(lua_State* l)
 {
        int i;
@@ -1399,36 +708,10 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Define default names for the resources.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDefaultResourceAmounts(SCM list)
-{
-       int i;
-       SCM value;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               for (i = 0; i < MaxCosts; ++i) {
-                       if (gh_eq_p(value, 
gh_symbol2scm(DefaultResourceNames[i]))) {
-                               value = gh_car(list);
-                               list = gh_cdr(list);
-                               DefaultResourceAmounts[i] = gh_scm2int(value);
-                               break;
-                       }
-               }
-               if (i == MaxCosts) {
-                       errl("Resource not found", value);
-               }
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDefaultResourceAmounts(lua_State* l)
 {
        int i;
@@ -1436,74 +719,31 @@
        const char* value;
        int args;
 
-       args = lua_gettop(l);
-       if (args & 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       for (j = 0; j < args; ++j) {
-               value = LuaToString(l, j + 1);
-               for (i = 0; i < MaxCosts; ++i) {
-                       if (!strcmp(value, DefaultResourceNames[i])) {
-                               ++j;
-                               DefaultResourceAmounts[i] = LuaToNumber(l, j + 
1);
-                               break;
-                       }
-               }
-               if (i == MaxCosts) {
-                       lua_pushfstring(l, "Resource not found: %s", value);
-                       lua_error(l);
-               }
-       }
-       return 0;
-}
-#endif
-
-/**
-**             Debug unit slots.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclUnits(void)
-{
-       Unit** slot;
-       int freeslots;
-       int destroyed;
-       int nullrefs;
-       int i;
-       static char buf[80];
-
-       i = 0;
-       slot = UnitSlotFree;
-       while (slot) {                                          // count the 
free slots
-               ++i;
-               slot = (void*)*slot;
-       }
-       freeslots = i;
-
-       //
-       //              Look how many slots are used
-       //
-       destroyed = nullrefs = 0;
-       for (slot = UnitSlots; slot < UnitSlots + MAX_UNIT_SLOTS; ++slot) {
-               if (*slot && (*slot < (Unit*)UnitSlots ||
-                               *slot > (Unit*)(UnitSlots + MAX_UNIT_SLOTS))) {
-                       if ((*slot)->Destroyed) {
-                               ++destroyed;
-                       } else if (!(*slot)->Refs) {
-                               ++nullrefs;
+       args = lua_gettop(l);
+       if (args & 1) {
+               lua_pushstring(l, "incorrect argument");
+               lua_error(l);
+       }
+       for (j = 0; j < args; ++j) {
+               value = LuaToString(l, j + 1);
+               for (i = 0; i < MaxCosts; ++i) {
+                       if (!strcmp(value, DefaultResourceNames[i])) {
+                               ++j;
+                               DefaultResourceAmounts[i] = LuaToNumber(l, j + 
1);
+                               break;
                        }
                }
+               if (i == MaxCosts) {
+                       lua_pushfstring(l, "Resource not found: %s", value);
+                       lua_error(l);
+               }
        }
-
-       sprintf(buf, "%d free, %d(%d) used, %d, destroyed, %d null",
-               freeslots, MAX_UNIT_SLOTS - 1 - freeslots, NumUnits, destroyed, 
nullrefs);
-       SetStatusLine(buf);
-       fprintf(stderr, "%d free, %d(%d) used, %d destroyed, %d null\n",
-               freeslots, MAX_UNIT_SLOTS - 1 - freeslots, NumUnits, destroyed, 
nullrefs);
-
-       return gh_int2scm(destroyed);
+       return 0;
 }
-#elif defined(USE_LUA)
+
+/**
+**             Debug unit slots.
+*/
 local int CclUnits(lua_State* l)
 {
        Unit** slot;
@@ -1549,21 +789,10 @@
        lua_pushnumber(l, destroyed);
        return 1;
 }
-#endif
 
 /**
 **             Compiled with sound.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclWithSound(void)
-{
-#ifdef WITH_SOUND
-       return SCM_BOOL_T;
-#else
-       return SCM_BOOL_F;
-#endif
-}
-#elif defined(USE_LUA)
 local int CclWithSound(lua_State* l)
 {
 #ifdef WITH_SOUND
@@ -1573,28 +802,10 @@
 #endif
        return 1;
 }
-#endif
 
 /**
 **             Get Stratagus home path.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetStratagusHomePath(void)
-{
-       const char* cp;
-       char* buf;
-
-       cp = getenv("HOME");
-       buf = alloca(strlen(cp) + strlen(GameName) + 
sizeof(STRATAGUS_HOME_PATH) + 3);
-       strcpy(buf, cp);
-       strcat(buf, "/");
-       strcat(buf, STRATAGUS_HOME_PATH);
-       strcat(buf, "/");
-       strcat(buf, GameName);
-
-       return gh_str02scm(buf);
-}
-#elif defined(USE_LUA)
 local int CclGetStratagusHomePath(lua_State* l)
 {
        const char* cp;
@@ -1611,23 +822,15 @@
        lua_pushstring(l, buf);
        return 1;
 }
-#endif
 
 /**
 **             Get Stratagus library path.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetStratagusLibraryPath(void)
-{
-       return gh_str02scm(STRATAGUS_LIB_PATH);
-}
-#elif defined(USE_LUA)
 local int CclGetStratagusLibraryPath(lua_State* l)
 {
        lua_pushstring(l, STRATAGUS_LIB_PATH);
        return 1;
 }
-#endif
 
 /*............................................................................
 ..             Tables
@@ -1640,20 +843,6 @@
 **
 **             @return                         FIXME: Nothing.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclLoadPud(SCM file)
-{
-       char* name;
-       char buffer[1024];
-
-       name = gh_scm2newstr(file, NULL);
-       LoadPud(LibraryFileName(name, buffer), &TheMap);
-       free(name);
-
-       // FIXME: LoadPud should return an error
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclLoadPud(lua_State* l)
 {
        const char* name;
@@ -1669,7 +858,6 @@
        // FIXME: LoadPud should return an error
        return 0;
 }
-#endif
 
 /**
 **             Load a map. (Try in library path first)
@@ -1678,22 +866,6 @@
 **
 **             @return                         FIXME: Nothing.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclLoadMap(SCM file)
-{
-       char* name;
-       char buffer[1024];
-
-       name = gh_scm2newstr(file, NULL);
-       if (strcasestr(name, ".pud")) {
-               LoadPud(LibraryFileName(name, buffer), &TheMap);
-       }
-       free(name);
-
-       // FIXME: LoadPud should return an error
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclLoadMap(lua_State* l)
 {
        const char* name;
@@ -1711,7 +883,6 @@
        // FIXME: LoadPud should return an error
        return 0;
 }
-#endif
 
 /*............................................................................
 ..             Commands
@@ -1726,19 +897,12 @@
 {
 #if defined(USE_GUILE) || defined(USE_SIOD)
        char msg[80];
-#ifndef USE_GUILE
-       int retval;
-#endif
 
        strncpy(msg, command, sizeof(msg));
 
        // FIXME: cheat protection
-#ifdef USE_GUILE
-       gh_eval_str(msg);
-#else
        retval = repl_c_string(msg, 0, 0, sizeof(msg));
        DebugLevel3("\n%d=%s\n" _C_ retval _C_ msg);
-#endif
        SetMessage("%s", msg);
 #elif defined(USE_LUA)
 #endif
@@ -1753,38 +917,6 @@
 */
 global void InitCcl(void)
 {
-#if defined(USE_GUILE)
-       scm_init_guile();
-
-       gh_eval_str("(display \"Guile: Enabling debugging...\\n\")"
-               "(debug-enable 'debug)"
-               "(debug-enable 'backtrace)"
-               "(read-enable 'positions)"
-               "(define *scheme* 'guile)");
-#elif defined(USE_SIOD)
-       char* sargv[5];
-       char* buf;
-       char  msg[] = "(define *scheme* 'siod)";
-
-       sargv[0] = "Stratagus";
-       sargv[1] = "-v1";
-#ifdef SIOD_HEAP_GC
-       // Mark & sweep GC : scan the heap entirely
-       sargv[2] = "-g0";
-       sargv[3] = "-h800000:10";
-#else
-       // Stop & copy GC : scan only allocated cells
-       sargv[2] = "-g1";
-       // Cells are allocated in chunck of 40000 cells ( => 160Ko )
-       sargv[3] = "-h40000";
-#endif
-       buf = malloc(strlen(StratagusLibPath) + 4);
-       sprintf(buf, "-l%s", StratagusLibPath);
-       sargv[4] = buf;                                         // never freed
-
-       siod_init(5, sargv);
-       repl_c_string(msg, 0, 0, sizeof(msg));
-#elif defined(USE_LUA)
        Lua = lua_open();
        luaopen_base(Lua);
        luaopen_table(Lua);
@@ -1792,38 +924,7 @@
        luaopen_math(Lua);
        luaopen_debug(Lua);
        lua_settop(Lua, 0);                     // discard any results
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure0_0("library-path", CclStratagusLibraryPath);
-       gh_new_procedure0_0("game-cycle", CclGameCycle);
-       gh_new_procedure1_0("set-game-name!", CclSetGameName);
-       gh_new_procedure1_0("set-game-cycle!", CclSetGameCycle);
-       gh_new_procedure1_0("set-game-paused!", CclSetGamePaused);
-       gh_new_procedure1_0("set-video-sync-speed!", CclSetVideoSyncSpeed);
-       gh_new_procedure1_0("set-local-player-name!", CclSetLocalPlayerName);
-
-       gh_new_procedure1_0("set-show-tips!", CclSetShowTips);
-       gh_new_procedure1_0("set-current-tip!", CclSetCurrentTip);
-       gh_new_procedure1_0("add-tip", CclAddTip);
-
-       gh_new_procedure2_0("set-speed-resources-harvest!", 
CclSetSpeedResourcesHarvest);
-       gh_new_procedure2_0("set-speed-resources-return!", 
CclSetSpeedResourcesReturn);
-       gh_new_procedure1_0("set-speed-build!", CclSetSpeedBuild);
-       gh_new_procedure1_0("set-speed-train!", CclSetSpeedTrain);
-       gh_new_procedure1_0("set-speed-upgrade!", CclSetSpeedUpgrade);
-       gh_new_procedure1_0("set-speed-research!", CclSetSpeedResearch);
-       gh_new_procedure1_0("set-speeds!", CclSetSpeeds);
-
-       gh_new_procedureN("define-default-resources", 
CclDefineDefaultResources);
-       gh_new_procedureN("define-default-resources-low", 
CclDefineDefaultResourcesLow);
-       gh_new_procedureN("define-default-resources-medium", 
CclDefineDefaultResourcesMedium);
-       gh_new_procedureN("define-default-resources-high", 
CclDefineDefaultResourcesHigh);
-       gh_new_procedureN("define-default-incomes", CclDefineDefaultIncomes);
-       gh_new_procedureN("define-default-actions", CclDefineDefaultActions);
-       gh_new_procedureN("define-default-resource-names", 
CclDefineDefaultResourceNames);
-       gh_new_procedureN("define-default-resource-amounts", 
CclDefineDefaultResourceAmounts);
-#elif defined(USE_LUA)
        lua_register(Lua, "LibraryPath", CclStratagusLibraryPath);
        lua_register(Lua, "GameCycle", CclGameCycle);
        lua_register(Lua, "SetGameName", CclSetGameName);
@@ -1855,7 +956,6 @@
        lua_register(Lua, "DefineDefaultResourceAmounts", 
CclDefineDefaultResourceAmounts);
 
        lua_register(Lua, "Load", CclLoad);
-#endif
 
        NetworkCclRegister();
        IconCclRegister();
@@ -1884,88 +984,6 @@
 
        EditorCclRegister();
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-
-#if defined(USE_GUILE)
-       gh_eval_str("(define as-string (lambda (obj) (with-output-to-string 
(lambda () (write obj)))))");
-#endif
-
-       gh_new_procedure1_0("load-pud", CclLoadPud);
-       gh_new_procedure1_0("load-map", CclLoadMap);
-
-       gh_new_procedure0_0("units", CclUnits);
-
-       gh_new_procedure0_0("with-sound", CclWithSound);
-       gh_new_procedure0_0("get-stratagus-home-path", CclGetStratagusHomePath);
-       gh_new_procedure0_0("get-stratagus-library-path",
-               CclGetStratagusLibraryPath);
-
-       //
-       //              Make some sombols for the compile options/features.
-       //
-#ifdef USE_THREAD
-       gh_define("stratagus-feature-thread", SCM_BOOL_T);
-#endif
-#ifdef DEBUG
-       gh_define("stratagus-feature-debug", SCM_BOOL_T);
-#endif
-#ifdef DEBUG_FLAGS
-       gh_define("stratagus-feature-debug-flags", SCM_BOOL_T);
-#endif
-#ifdef USE_ZLIB
-       gh_define("stratagus-feature-zlib", SCM_BOOL_T);
-#endif
-#ifdef USE_BZ2LIB
-       gh_define("stratagus-feature-bz2lib", SCM_BOOL_T);
-#endif
-#ifdef USE_ZZIPLIB
-       gh_define("stratagus-feature-zziplib", SCM_BOOL_T);
-#endif
-#ifdef USE_SDL
-       gh_define("stratagus-feature-sdl", SCM_BOOL_T);
-#endif
-#ifdef USE_SDLA
-       gh_define("stratagus-feature-sdl-audio", SCM_BOOL_T);
-#endif
-#ifdef USE_SDLCD
-       gh_define("stratagus-feature-sdl-cd", SCM_BOOL_T);
-#endif
-#ifdef WITH_SOUND
-       gh_define("stratagus-feature-with-sound", SCM_BOOL_T);
-#endif
-#ifdef UNIT_ON_MAP
-       gh_define("stratagus-feature-unit-on-map", SCM_BOOL_T);
-#endif
-#ifdef UNITS_ON_MAP
-       gh_define("stratagus-feature-units-on-map", SCM_BOOL_T);
-#endif
-#ifdef NEW_MAPDRAW
-       gh_define("stratagus-feature-new-mapdraw", SCM_BOOL_T);
-#endif
-#ifdef HIERARCHIC_PATHFINDER
-       gh_define("stratagus-feature-hierarchic-pathfinder", SCM_BOOL_T);
-#endif
-#ifdef USE_FLAC
-       gh_define("stratagus-feature-flac", SCM_BOOL_T);
-#endif
-#ifdef USE_OGG
-       gh_define("stratagus-feature-ogg", SCM_BOOL_T);
-#endif
-#ifdef USE_MAD
-       gh_define("stratagus-feature-mp3", SCM_BOOL_T);
-#endif
-#ifdef USE_LIBCDA
-       gh_define("stratagus-feature-libcda", SCM_BOOL_T);
-#endif
-
-#ifndef SIOD_HEAP_GC
-#ifndef USE_GUILE
-       gh_define("*ccl-protect*", NIL);
-#endif
-#endif
-
-       print_welcome();
-#elif defined(USE_LUA)
        lua_register(Lua, "LoadPud", CclLoadPud);
        lua_register(Lua, "LoadMap", CclLoadMap);
 
@@ -1975,7 +993,6 @@
        lua_register(Lua, "GetStratagusHomePath", CclGetStratagusHomePath);
        lua_register(Lua, "GetStratagusLibraryPath",
                CclGetStratagusLibraryPath);
-#endif
 }
 
 /**
@@ -1986,28 +1003,16 @@
        FILE* fd;
        char buf[1024];
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-#ifdef USE_WIN32
-       strcpy(buf, "preferences1.ccl");
-#else
-       sprintf(buf, "%s/%s/preferences1.ccl", getenv("HOME"), 
STRATAGUS_HOME_PATH);
-#endif
-#elif defined(USE_LUA)
 #ifdef USE_WIN32
        strcpy(buf, "preferences1.lua");
 #else
        sprintf(buf, "%s/%s/preferences1.lua", getenv("HOME"), 
STRATAGUS_HOME_PATH);
 #endif
-#endif
 
        fd = fopen(buf, "r");
        if (fd) {
                fclose(fd);
-#if defined(USE_GUILE) || defined(USE_SIOD)
-               vload(buf, 0, 1);
-#elif defined(USE_LUA)
                LuaLoadFile(buf);
-#endif
        }
 }
 
@@ -2019,30 +1024,17 @@
        FILE* fd;
        char buf[1024];
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-#ifdef USE_WIN32
-       sprintf(buf, "%s/preferences2.ccl", GameName);
-#else
-       sprintf(buf, "%s/%s/%s/preferences2.ccl", getenv("HOME"),
-               STRATAGUS_HOME_PATH, GameName);
-#endif
-#elif defined(USE_LUA)
 #ifdef USE_WIN32
        sprintf(buf, "%s/preferences2.lua", GameName);
 #else
        sprintf(buf, "%s/%s/%s/preferences2.lua", getenv("HOME"),
                STRATAGUS_HOME_PATH, GameName);
 #endif
-#endif
 
        fd = fopen(buf, "r");
        if (fd) {
                fclose(fd);
-#if defined(USE_GUILE) || defined(USE_SIOD)
-               vload(buf, 0, 1);
-#elif defined(USE_LUA)
                LuaLoadFile(buf);
-#endif
        }
 }
 
@@ -2060,39 +1052,6 @@
        //                      This file is loaded before stratagus.ccl
        //
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-#ifdef USE_WIN32
-       strcpy(buf, "preferences1.ccl");
-#else
-       sprintf(buf, "%s/%s", getenv("HOME"), STRATAGUS_HOME_PATH);
-       mkdir(buf, 0777);
-       strcat(buf, "/preferences1.ccl");
-#endif
-
-       fd = fopen(buf, "w");
-       if (!fd) {
-               return;
-       }
-
-       fprintf(fd, ";;; -----------------------------------------\n");
-       fprintf(fd, ";;; $Id: ccl.c,v 1.149 2003/12/23 00:14:15 jsalmon3 Exp 
$\n");
-
-       fprintf(fd, "(set-video-resolution! %d %d)\n", VideoWidth, VideoHeight);
-       fprintf(fd, "(set-group-keys \"");
-
-       i = 0;
-       while (UiGroupKeys[i]) {
-               if (UiGroupKeys[i] != '"') {
-                       fprintf(fd, "%c", UiGroupKeys[i]);
-               } else {
-                       fprintf(fd, "\\\"");
-               }
-               ++i;
-       }
-       fprintf(fd, "\")\n");
-
-       fclose(fd);
-#elif defined(USE_LUA)
 #ifdef USE_WIN32
        strcpy(buf, "preferences1.lua");
 #else
@@ -2107,7 +1066,7 @@
        }
 
        fprintf(fd, "--- -----------------------------------------\n");
-       fprintf(fd, "--- $Id: ccl.c,v 1.149 2003/12/23 00:14:15 jsalmon3 Exp 
$\n");
+       fprintf(fd, "--- $Id: ccl.c,v 1.150 2004/01/01 21:24:14 jsalmon3 Exp 
$\n");
 
        fprintf(fd, "SetVideoResolution(%d, %d)\n", VideoWidth, VideoHeight);
        fprintf(fd, "SetGroupKeys(\"");
@@ -2124,95 +1083,12 @@
        fprintf(fd, "\")\n");
 
        fclose(fd);
-#endif
 
        //
        //                      preferences2.ccl
        //                      This file is loaded after stratagus.ccl
        //
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-#ifdef USE_WIN32
-       sprintf(buf, "%s/preferences2.ccl", GameName);
-#else
-       sprintf(buf, "%s/%s/%s/preferences2.ccl", getenv("HOME"),
-               STRATAGUS_HOME_PATH, GameName);
-#endif
-
-       fd = fopen(buf, "w");
-       if (!fd) {
-               return;
-       }
-
-       fprintf(fd, ";;; -----------------------------------------\n");
-       fprintf(fd, ";;; $Id: ccl.c,v 1.149 2003/12/23 00:14:15 jsalmon3 Exp 
$\n");
-
-       // Global options
-       if (OriginalFogOfWar) {
-               fprintf(fd, "(original-fog-of-war)\n");
-       } else {
-               fprintf(fd, "(alpha-fog-of-war)\n");
-       }
-       fprintf(fd, "(set-video-fullscreen! #%c)\n", VideoFullScreen ? 't' : 
'f');
-#if 0
-       // FIXME: Uncomment when this is configurable in the menus
-       fprintf(fd, "(set-contrast! %d)\n", TheUI.Contrast);
-       fprintf(fd, "(set-brightness! %d)\n", TheUI.Brightness);
-       fprintf(fd, "(set-saturation! %d)\n", TheUI.Saturation);
-#endif
-       fprintf(fd, "(set-local-player-name! \"%s\")\n", LocalPlayerName);
-
-       // Game options
-       fprintf(fd, "(set-show-tips! #%c)\n", ShowTips ? 't' : 'f');
-       fprintf(fd, "(set-current-tip! %d)\n", CurrentTip);
-
-       fprintf(fd, "(set-fog-of-war! #%c)\n", !TheMap.NoFogOfWar ? 't' : 'f');
-       fprintf(fd, "(set-show-command-key! #%c)\n", ShowCommandKey ? 't' : 
'f');
-
-       // Speeds
-       fprintf(fd, "(set-video-sync-speed! %d)\n", VideoSyncSpeed);
-       fprintf(fd, "(set-mouse-scroll-speed! %d)\n", SpeedMouseScroll);
-       fprintf(fd, "(set-key-scroll-speed! %d)\n", SpeedKeyScroll);
-
-       // Sound options
-       if (!SoundOff) {
-               fprintf(fd, "(sound-on)\n");
-       } else {
-               fprintf(fd, "(sound-off)\n");
-       }
-#ifdef WITH_SOUND
-       fprintf(fd, "(set-sound-volume! %d)\n", GlobalVolume);
-       if (!MusicOff) {
-               fprintf(fd, "(music-on)\n");
-       } else {
-               fprintf(fd, "(music-off)\n");
-       }
-       fprintf(fd, "(set-music-volume! %d)\n", MusicVolume);
-#ifdef USE_CDAUDIO
-       buf[0] = '\0';
-       switch (CDMode) {
-               case CDModeAll:
-                       strcpy(buf, "all");
-                       break;
-               case CDModeRandom:
-                       strcpy(buf, "random");
-                       break;
-               case CDModeDefined:
-                       strcpy(buf, "defined");
-                       break;
-               case CDModeStopped:
-               case CDModeOff:
-                       strcpy(buf, "off");
-                       break;
-               default:
-                       break;
-       }
-       if (buf[0]) {
-               fprintf(fd, "(set-cd-mode! '%s)\n", buf);
-       }
-#endif
-#endif
-#elif defined(USE_LUA)
 #ifdef USE_WIN32
        sprintf(buf, "%s/preferences2.lua", GameName);
 #else
@@ -2226,7 +1102,7 @@
        }
 
        fprintf(fd, "--- -----------------------------------------\n");
-       fprintf(fd, "--- $Id: ccl.c,v 1.149 2003/12/23 00:14:15 jsalmon3 Exp 
$\n");
+       fprintf(fd, "--- $Id: ccl.c,v 1.150 2004/01/01 21:24:14 jsalmon3 Exp 
$\n");
 
        // Global options
        if (OriginalFogOfWar) {
@@ -2293,7 +1169,6 @@
        }
 #endif
 #endif
-#endif
 
        fclose(fd);
 }
@@ -2304,9 +1179,6 @@
 global void LoadCcl(void)
 {
        char* file;
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       char* s;
-#endif
        char buf[1024];
 
        //
@@ -2321,15 +1193,7 @@
 
        ShowLoadProgress("Script %s\n", file);
        LoadPreferences1();
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       if ((s = strrchr(file, '.')) && s[1] == 'C') {
-               fast_load(gh_str02scm(file), NIL);
-       } else {
-               vload(file, 0, 1);
-       }
-#elif defined(USE_LUA)
        LuaLoadFile(file);
-#endif
        LoadPreferences2();
        CclInConfigFile = 0;
        CclGarbageCollect(0);                           // Cleanup memory after 
load
@@ -2342,14 +1206,12 @@
 */
 global void SaveCcl(CLFile* file)
 {
-#ifdef USE_GUILE
-#else
 #if 0
        SCM list;
        extern SCM oblistvar;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.149 2003/12/23 00:14:15 
jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.150 2004/01/01 21:24:14 
jsalmon3 Exp $\n\n");
 
        for (list = oblistvar; gh_list_p(list); list = gh_cdr(list)) {
                SCM sym;
@@ -2368,7 +1230,6 @@
 #endif
                }
        }
-#endif
 #endif
 }
 
Index: stratagus/src/stratagus/ccl_player.c
diff -u stratagus/src/stratagus/ccl_player.c:1.51 
stratagus/src/stratagus/ccl_player.c:1.52
--- stratagus/src/stratagus/ccl_player.c:1.51   Sat Dec 20 16:33:16 2003
+++ stratagus/src/stratagus/ccl_player.c        Fri Jan  2 08:24:14 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_player.c,v 1.51 2003/12/20 05:33:16 jsalmon3 Exp $
+//     $Id: ccl_player.c,v 1.52 2004/01/01 21:24:14 jsalmon3 Exp $
 
 //@{
 
@@ -60,250 +60,16 @@
 **
 **             @return                         The player pointer
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local Player* CclGetPlayer(SCM value)
-{
-       return &Players[gh_scm2int(value)];
-}
-#elif defined(USE_LUA)
 local Player* CclGetPlayer(lua_State* l)
 {
        return &Players[(int)LuaToNumber(l, -1)];
 }
-#endif
 
 /**
 **             Parse the player configuration.
 **
 **             @param list             Tagged list of all informations.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPlayer(SCM list)
-{
-       SCM value;
-       SCM sublist;
-       Player* player;
-       int i;
-       char* str;
-       char* s;
-
-       i = gh_scm2int(gh_car(list));
-       player = &Players[i];
-       if (NumPlayers <= i) {
-               NumPlayers = i + 1;
-       }
-       player->Player = i;
-       player->Color = PlayerColors[i];
-       if (!(player->Units = (Unit**)calloc(UnitMax, sizeof(Unit*)))) {
-               DebugLevel0("Not enough memory to create player %d.\n" _C_ i);
-               return SCM_UNSPECIFIED;
-       }
-       list = gh_cdr(list);
-
-       //
-       //              Parse the list:         (still everything could be 
changed!)
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("name"))) {
-                       player->Name = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("type"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("neutral"))) {
-                               player->Type = PlayerNeutral;
-                       } else if (gh_eq_p(value, gh_symbol2scm("nobody"))) {
-                               player->Type = PlayerNobody;
-                       } else if (gh_eq_p(value, gh_symbol2scm("computer"))) {
-                               player->Type = PlayerComputer;
-                       } else if (gh_eq_p(value, gh_symbol2scm("person"))) {
-                               player->Type = PlayerPerson;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("rescue-passive"))) {
-                               player->Type = PlayerRescuePassive;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("rescue-active"))) {
-                               player->Type = PlayerRescueActive;
-                       } else {
-                               // FIXME: this leaves a half initialized player
-                               errl("Unsupported tag", value);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("race"))) {
-                       str = gh_scm2newstr(gh_car(list),NULL);
-                       for (i = 0; i < PlayerRaces.Count; ++i) {
-                               if (!strcmp(str, PlayerRaces.Name[i])) {
-                                       player->RaceName = PlayerRaces.Name[i];
-                                       player->Race = i;
-                                       break;
-                               }
-                       }
-                       free(str);
-                       if (i == PlayerRaces.Count) {
-                          // FIXME: this leaves a half initialized player
-                          errl("Unsupported race", gh_car(list));
-                       }
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("ai"))) {
-                       player->AiNum = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("team"))) {
-                       player->Team = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("enemy"))) {
-                       s = str = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-                       for (i = 0; i < PlayerMax && *str; ++i, ++str) {
-                               if (*str == '-' || *str == '_' || *str == ' ') {
-                                       player->Enemy &= ~(1 << i);
-                               } else {
-                                       player->Enemy |= (1 << i);
-                               }
-                       }
-                       free(s);
-               } else if (gh_eq_p(value, gh_symbol2scm("allied"))) {
-                       s = str = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-                       for (i = 0; i < PlayerMax && *str; ++i, ++str) {
-                               if (*str == '-' || *str == '_' || *str == ' ') {
-                                       player->Allied &= ~(1 << i);
-                               } else {
-                                       player->Allied |= (1 << i);
-                               }
-                       }
-                       free(s);
-               } else if (gh_eq_p(value, gh_symbol2scm("shared-vision"))) {
-                       s = str = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-                       for (i = 0; i < PlayerMax && *str; ++i, ++str) {
-                               if (*str == '-' || *str == '_' || *str == ' ') {
-                                       player->SharedVision &= ~(1 << i);
-                               } else {
-                                       player->SharedVision |= (1 << i);
-                               }
-                       }
-                       free(s);
-               } else if (gh_eq_p(value, gh_symbol2scm("start"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       player->StartX = gh_scm2int(gh_car(value));
-                       player->StartY = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(value, gh_symbol2scm("resources"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               for (i = 0; i < MaxCosts; ++i) {
-                                       if (gh_eq_p(value, 
gh_symbol2scm((char*)DefaultResourceNames[i]))) {
-                                               player->Resources[i] = 
gh_scm2int(gh_car(sublist));
-                                               break;
-                                       }
-                               }
-                               if (i == MaxCosts) {
-                                  // FIXME: this leaves a half initialized 
player
-                                  errl("Unsupported tag", value);
-                               }
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("incomes"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               for (i = 0; i < MaxCosts; ++i) {
-                                       if (gh_eq_p(value, 
gh_symbol2scm((char*)DefaultResourceNames[i]))) {
-                                               player->Incomes[i] = 
gh_scm2int(gh_car(sublist));
-                                               break;
-                                       }
-                               }
-                               if (i == MaxCosts) {
-                                  // FIXME: this leaves a half initialized 
player
-                                  errl("Unsupported tag", value);
-                               }
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("ai-enabled"))) {
-                       player->AiEnabled = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("ai-disabled"))) {
-                       player->AiEnabled = 0;
-               } else if (gh_eq_p(value, gh_symbol2scm("supply"))) {
-                       player->Supply = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("demand"))) {
-                       player->Demand = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("unit-limit"))) {
-                       player->UnitLimit = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("building-limit"))) {
-                       player->BuildingLimit = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("total-unit-limit"))) {
-                       player->TotalUnitLimit = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("score"))) {
-                       player->Score = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("total-units"))) {
-                       player->TotalUnits = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("total-buildings"))) {
-                       player->TotalBuildings = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("total-razings"))) {
-                       player->TotalRazings = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("total-kills"))) {
-                       player->TotalKills = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("total-resources"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       i = gh_length(sublist);
-                       if (i != MaxCosts) {
-                               fprintf(stderr, "Wrong number of 
total-resources %d\n", i);
-                       }
-                       i = 0;
-                       while (!gh_null_p(sublist)) {
-                               if (i < MaxCosts) {
-                                       player->TotalResources[i] = 
gh_scm2int(gh_car(sublist));
-                               }
-                               sublist = gh_cdr(sublist);
-                               ++i;
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("total-units"))) {
-                       player->TotalUnits = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("timers"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       i = gh_length(sublist);
-                       if (i != UpgradeMax) {
-                               fprintf(stderr, "Wrong upgrade timer length 
%d\n", i);
-                       }
-
-                       i = 0;
-                       while (!gh_null_p(sublist)) {
-                               if (i < UpgradeMax) {
-                                       player->UpgradeTimers.Upgrades[i] =
-                                               gh_scm2int(gh_car(sublist));
-                               }
-                               sublist = gh_cdr(sublist);
-                               ++i;
-                       }
-               } else {
-                  // FIXME: this leaves a half initialized player
-                  errl("Unsupported tag", value);
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclPlayer(lua_State* l)
 {
        const char* value;
@@ -528,7 +294,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Change unit owner
@@ -538,27 +303,6 @@
 **             @param oldplayer old player number
 **             @param newplayer new player number
 **/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclChangeUnitsOwner(SCM pos1, SCM pos2, SCM oldplayer, SCM newplayer)
-{
-       Unit* table[UnitMax];
-       int n;
-       int oldp;
-       int newp;
-
-       n = SelectUnits(gh_scm2int(gh_car(pos1)), gh_scm2int(gh_cadr(pos1)),
-               gh_scm2int(gh_car(pos2)), gh_scm2int(gh_cadr(pos2)), table);
-       oldp = gh_scm2int(oldplayer);
-       newp = gh_scm2int(newplayer);
-       while (n) {
-               if (table[n - 1]->Player->Player == oldp) {
-                       ChangeUnitOwner(table[n - 1], &Players[newp]);
-               }
-               --n;
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclChangeUnitsOwner(lua_State* l)
 {
        Unit* table[UnitMax];
@@ -608,19 +352,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Get ThisPlayer.
 **
 **             @return                         This player number.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetThisPlayer(void)
-{
-       return gh_int2scm(ThisPlayer - Players);
-}
-#elif defined(USE_LUA)
 local int CclGetThisPlayer(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -630,21 +367,12 @@
        lua_pushnumber(l, ThisPlayer - Players);
        return 1;
 }
-#endif
 
 /**
 **             Set ThisPlayer.
 **
 **             @param plynr            This player number.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetThisPlayer(SCM plynr)
-{
-       ThisPlayer = &Players[gh_scm2int(plynr)];
-
-       return plynr;
-}
-#elif defined(USE_LUA)
 local int CclSetThisPlayer(lua_State* l)
 {
        int plynr;
@@ -659,20 +387,12 @@
        lua_pushnumber(l, plynr);
        return 1;
 }
-#endif
 
 /**
 **             Set MaxSelectable
 **
 **             @param                          Max number of selectable units.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMaxSelectable(SCM max)
-{
-       MaxSelectable = gh_scm2int(max);
-       return max;
-}
-#elif defined(USE_LUA)
 local int CclSetMaxSelectable(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -684,25 +404,12 @@
        lua_pushnumber(l, MaxSelectable);
        return 1;
 }
-#endif
 
 /**
 **             Set player unit limit.
 **
 **             @param limit            Unit limit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetAllPlayersUnitLimit(SCM limit)
-{
-       int i;
-
-       for (i = 0; i < PlayerMax; ++i) {
-               Players[i].UnitLimit = gh_scm2int(limit);
-       }
-
-       return limit;
-}
-#elif defined(USE_LUA)
 local int CclSetAllPlayersUnitLimit(lua_State* l)
 {
        int i;
@@ -718,25 +425,12 @@
        lua_pushnumber(l, lua_tonumber(l, 1));
        return 1;
 }
-#endif
 
 /**
 **             Set player unit limit.
 **
 **             @param limit            Unit limit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetAllPlayersBuildingLimit(SCM limit)
-{
-       int i;
-
-       for (i = 0; i < PlayerMax; ++i) {
-               Players[i].BuildingLimit = gh_scm2int(limit);
-       }
-
-       return limit;
-}
-#elif defined(USE_LUA)
 local int CclSetAllPlayersBuildingLimit(lua_State* l)
 {
        int i;
@@ -752,25 +446,12 @@
        lua_pushnumber(l, lua_tonumber(l, 1));
        return 1;
 }
-#endif
 
 /**
 **             Set player unit limit.
 **
 **             @param limit            Unit limit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetAllPlayersTotalUnitLimit(SCM limit)
-{
-       int i;
-
-       for (i = 0; i < PlayerMax; ++i) {
-               Players[i].TotalUnitLimit = gh_scm2int(limit);
-       }
-
-       return limit;
-}
-#elif defined(USE_LUA)
 local int CclSetAllPlayersTotalUnitLimit(lua_State* l)
 {
        int i;
@@ -786,7 +467,6 @@
        lua_pushnumber(l, lua_tonumber(l, 1));
        return 1;
 }
-#endif
 
 /**
 **             Change the diplomacy from player to another player.
@@ -799,29 +479,6 @@
 **
 **             @todo FIXME: should return old state.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetDiplomacy(SCM player, SCM state, SCM opponent)
-{
-       int plynr;
-       int base;
-
-       base = gh_scm2int(player);
-       plynr = gh_scm2int(opponent);
-
-       if (gh_eq_p(state, gh_symbol2scm("allied"))) {
-               SendCommandDiplomacy(base, DiplomacyAllied, plynr);
-       } else if (gh_eq_p(state, gh_symbol2scm("neutral"))) {
-               SendCommandDiplomacy(base, DiplomacyNeutral, plynr);
-       } else if (gh_eq_p(state, gh_symbol2scm("crazy"))) {
-               SendCommandDiplomacy(base, DiplomacyCrazy, plynr);
-       } else if (gh_eq_p(state, gh_symbol2scm("enemy"))) {
-               SendCommandDiplomacy(base, DiplomacyEnemy, plynr);
-       }
-
-       // FIXME: we can return the old state
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetDiplomacy(lua_State* l)
 {
        int plynr;
@@ -848,7 +505,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Change the diplomacy from ThisPlayer to another player.
@@ -856,19 +512,12 @@
 **             @param state            To which state this should be changed.
 **             @param player           Player number to change.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDiplomacy(SCM state, SCM player)
-{
-       return CclSetDiplomacy(gh_int2scm(ThisPlayer->Player), state, player);
-}
-#elif defined(USE_LUA)
 local int CclDiplomacy(lua_State* l)
 {
        lua_pushnumber(l, ThisPlayer->Player);
        lua_insert(l, 1);
        return CclSetDiplomacy(l);
 }
-#endif
 
 /**
 **             Change the shared vision from player to another player.
@@ -881,23 +530,6 @@
 **
 **             @todo FIXME: should return old state.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSharedVision(SCM player, SCM state, SCM opponent)
-{
-       int plynr;
-       int base;
-       int shared;
-
-       base = gh_scm2int(player);
-       shared = gh_scm2bool(state);
-       plynr = gh_scm2int(opponent);
-
-       SendCommandSharedVision(base, shared, plynr);
-
-       // FIXME: we can return the old state
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetSharedVision(lua_State* l)
 {
        int plynr;
@@ -917,7 +549,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Change the shared vision from ThisPlayer to another player.
@@ -925,71 +556,18 @@
 **             @param state            To which state this should be changed.
 **             @param player           Player number to change.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSharedVision(SCM state, SCM player)
-{
-       return CclSetSharedVision(gh_int2scm(ThisPlayer->Player), state, 
player);
-}
-#elif defined(USE_LUA)
 local int CclSharedVision(lua_State* l)
 {
        lua_pushnumber(l, ThisPlayer->Player);
        lua_insert(l, 1);
        return CclSetSharedVision(l);
 }
-#endif
 
 /**
 **             Define race names
 **
 **             @param list             List of all races.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineRaceNames(SCM list)
-{
-       SCM sublist;
-       SCM value;
-       int i;
-
-       PlayerRaces.Count = 0;
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("race"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       i = PlayerRaces.Count++;
-                       PlayerRaces.Race[i] = 0;
-                       PlayerRaces.Name[i] = NULL;
-                       PlayerRaces.Display[i] = NULL;
-                       PlayerRaces.Visible[i] = 0;
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("race"))) {
-                                       PlayerRaces.Race[i] = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("name"))) {
-                                       PlayerRaces.Name[i] = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("display"))) {
-                                       PlayerRaces.Display[i] = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("visible"))) {
-                                       PlayerRaces.Visible[i] = 1;
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineRaceNames(lua_State* l)
 {
        int i;
@@ -1049,19 +627,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Make new player colors
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclNewPlayerColors(void)
-{
-       SetPlayersPalette();
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclNewPlayerColors(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -1072,7 +641,6 @@
 
        return 0;
 }
-#endif
 
 // ----------------------------------------------------------------------------
 
@@ -1084,31 +652,6 @@
 **
 **             @return                         Player resource
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetPlayerResource(SCM player, SCM resource)
-{
-       int i;
-       Player* plyr;
-       char* res;
-       SCM ret;
-
-       plyr = CclGetPlayer(player);
-       res = gh_scm2newstr(resource, NULL);
-
-       for (i = 0; i < MaxCosts; ++i) {
-               if (!strcmp(res, DefaultResourceNames[i])) {
-                       break;
-               }
-       }
-       if (i == MaxCosts) {
-               // FIXME: this leaves a half initialized player
-               errl("Invalid resource", resource);
-       }
-       ret = gh_int2scm(plyr->Resources[i]);
-       free(res);
-       return ret;
-}
-#elif defined(USE_LUA)
 local int CclGetPlayerResource(lua_State* l)
 {
        int i;
@@ -1137,42 +680,12 @@
        lua_pushnumber(l, plyr->Resources[i]);
        return 1;
 }
-#endif
 
 /**
 **             Set player resource.
 **
 **             @param list             Resource list
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetPlayerResource(SCM list)
-{
-       int i;
-       Player* player;
-       SCM value;
-
-       player = CclGetPlayer(gh_car(list));
-       list = gh_cdr(list);
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               for (i = 0; i < MaxCosts; ++i) {
-                       if (gh_eq_p(value, 
gh_symbol2scm(DefaultResourceNames[i]))) {
-                               break;
-                       }
-               }
-               if (i == MaxCosts) {
-                  // FIXME: this leaves a half initialized player
-                  errl("Unsupported tag", value);
-               }
-               value = gh_car(list);
-               list = gh_cdr(list);
-               player->Resources[i] = gh_scm2int(value);
-       }
-       MustRedraw |= RedrawResources;
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetPlayerResource(lua_State* l)
 {
        int i;
@@ -1202,7 +715,6 @@
        MustRedraw |= RedrawResources;
        return 0;
 }
-#endif
 
 // ----------------------------------------------------------------------------
 
@@ -1211,34 +723,6 @@
 */
 global void PlayerCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("player", CclPlayer);
-       gh_new_procedure4_0("change-units-owner", CclChangeUnitsOwner);
-       gh_new_procedure0_0("get-this-player", CclGetThisPlayer);
-       gh_new_procedure1_0("set-this-player!", CclSetThisPlayer);
-
-       gh_new_procedure1_0("set-max-selectable!", CclSetMaxSelectable);
-
-       gh_new_procedure1_0("set-all-players-unit-limit!",
-               CclSetAllPlayersUnitLimit);
-       gh_new_procedure1_0("set-all-players-building-limit!",
-               CclSetAllPlayersBuildingLimit);
-       gh_new_procedure1_0("set-all-players-total-unit-limit!",
-               CclSetAllPlayersTotalUnitLimit);
-
-       gh_new_procedure3_0("set-diplomacy!", CclSetDiplomacy);
-       gh_new_procedure2_0("diplomacy", CclDiplomacy);
-       gh_new_procedure3_0("set-shared-vision!", CclSetSharedVision);
-       gh_new_procedure2_0("shared-vision", CclSharedVision);
-
-       gh_new_procedureN("define-race-names", CclDefineRaceNames);
-
-       gh_new_procedure0_0("new-colors", CclNewPlayerColors);
-
-       // player member access functions
-       gh_new_procedure2_0("get-player-resource", CclGetPlayerResource);
-       gh_new_procedureN("set-player-resource!", CclSetPlayerResource);
-#elif defined(USE_LUA)
        lua_register(Lua, "Player", CclPlayer);
        lua_register(Lua, "ChangeUnitsOwner", CclChangeUnitsOwner);
        lua_register(Lua, "GetThisPlayer", CclGetThisPlayer);
@@ -1265,7 +749,6 @@
        // player member access functions
        lua_register(Lua, "GetPlayerResource", CclGetPlayerResource);
        lua_register(Lua, "SetPlayerResource", CclSetPlayerResource);
-#endif
 }
 
 //@}
Index: stratagus/src/stratagus/ccl_spell.c
diff -u stratagus/src/stratagus/ccl_spell.c:1.32 
stratagus/src/stratagus/ccl_spell.c:1.33
--- stratagus/src/stratagus/ccl_spell.c:1.32    Sat Dec 20 16:33:17 2003
+++ stratagus/src/stratagus/ccl_spell.c Fri Jan  2 08:24:15 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_spell.c,v 1.32 2003/12/20 05:33:17 jsalmon3 Exp $
+//     $Id: ccl_spell.c,v 1.33 2004/01/01 21:24:15 jsalmon3 Exp $
 //@{
 
 /*----------------------------------------------------------------------------
@@ -60,45 +60,6 @@
 **             @note           This is only here to avoid code duplication. 
You don't have
 **             any reason to USE this:)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclSpellMissileLocation(SCM list, SpellActionMissileLocation* 
location)
-{
-       SCM value;
-
-       DebugCheck(location == NULL);
-       memset(location, 0, sizeof(*location));
-       //list = gh_cdr(list);
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("base"))) {
-                       if (gh_eq_p(gh_car(list), gh_symbol2scm("caster"))) {
-                               location->Base = LocBaseCaster;
-                       } else if (gh_eq_p(gh_car(list), 
gh_symbol2scm("target"))) {
-                               location->Base = LocBaseTarget;
-                       } else {
-                               errl("Unsupported missile location base flag", 
gh_car(list));
-                       }
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("add-x"))) {
-                       location->AddX = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("add-y"))) {
-                       location->AddY = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("add-rand-x"))) {
-                       location->AddRandX = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("add-rand-y"))) {
-                       location->AddRandY = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else {
-                       errl("Unsupported missile location description flag", 
value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclSpellMissileLocation(lua_State* l, SpellActionMissileLocation* 
location)
 {
        const char* value;
@@ -107,7 +68,6 @@
 
        DebugCheck(location == NULL);
        memset(location, 0, sizeof(*location));
-       //list = gh_cdr(list);
 
        if (!lua_istable(l, -1)) {
                lua_pushstring(l, "incorrect argument");
@@ -155,7 +115,6 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse the action for spell.
@@ -163,210 +122,6 @@
 **             @param list                             SCM list object, with 
something like (action-type params).
 **             @param spellaction              Pointer to spellactopm.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclSpellAction(SCM list, SpellActionType* spellaction)
-{
-       char* str;
-       SCM             value;
-
-       DebugCheck(spellaction == NULL);
-
-       value = gh_car(list);
-       list = gh_cdr(list);
-
-       if (gh_eq_p(value, gh_symbol2scm("spawn-missile"))) {
-               spellaction->CastFunction = CastSpawnMissile;
-               spellaction->Data.SpawnMissile.StartPoint.Base = LocBaseCaster;
-               spellaction->Data.SpawnMissile.EndPoint.Base = LocBaseTarget;
-               spellaction->Data.SpawnMissile.TTL = -1;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("damage"))) {
-                               spellaction->Data.SpawnMissile.Damage = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, gh_symbol2scm("delay"))) {
-                               spellaction->Data.SpawnMissile.Delay = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, gh_symbol2scm("ttl"))) {
-                               spellaction->Data.SpawnMissile.TTL = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("start-point"))) {
-                               CclSpellMissileLocation(gh_car(list), 
&spellaction->Data.SpawnMissile.StartPoint);
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, gh_symbol2scm("end-point"))) {
-                               CclSpellMissileLocation(gh_car(list), 
&spellaction->Data.SpawnMissile.EndPoint);
-                               list = gh_cdr(list);
-                       } else {
-                               errl("Unsupported spawn-missile tag", value);
-                       }
-               }
-       } else if (gh_eq_p(value, gh_symbol2scm("area-adjust-vitals"))) {
-               spellaction->CastFunction = CastAreaAdjustVitals;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("hit-points"))) {
-                               spellaction->Data.AreaAdjustVitals.HP = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("mana-points"))) {
-                               spellaction->Data.AreaAdjustVitals.Mana = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else {
-                               errl("Unsupported area-adjust-vitals tag", 
value);
-                       }
-               }
-       } else if (gh_eq_p(value, gh_symbol2scm("area-bombardment"))) {
-               spellaction->CastFunction = CastAreaBombardment;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("fields"))) {
-                               spellaction->Data.AreaBombardment.Fields = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, gh_symbol2scm("shards"))) {
-                               spellaction->Data.AreaBombardment.Shards = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, gh_symbol2scm("damage"))) {
-                               spellaction->Data.AreaBombardment.Damage = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("start-offset-x"))) {
-                               spellaction->Data.AreaBombardment.StartOffsetX 
= gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("start-offset-y"))) {
-                               spellaction->Data.AreaBombardment.StartOffsetY 
= gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else {
-                               errl("Unsupported area-bombardment tag", value);
-                       }
-               }
-       } else if (gh_eq_p(value, gh_symbol2scm("demolish"))) {
-               spellaction->CastFunction = CastDemolish;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("range"))) {
-                               spellaction->Data.Demolish.Range = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, gh_symbol2scm("damage"))) {
-                               spellaction->Data.Demolish.Damage = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else {
-                               errl("Unsupported demolish tag", value);
-                       }
-               }
-       } else if (gh_eq_p(value, gh_symbol2scm("adjust-buffs"))) {
-               spellaction->CastFunction = CastAdjustBuffs;
-               spellaction->Data.AdjustBuffs.HasteTicks = BUFF_NOT_AFFECTED;
-               spellaction->Data.AdjustBuffs.SlowTicks = BUFF_NOT_AFFECTED;
-               spellaction->Data.AdjustBuffs.BloodlustTicks = 
BUFF_NOT_AFFECTED;
-               spellaction->Data.AdjustBuffs.InvisibilityTicks = 
BUFF_NOT_AFFECTED;
-               spellaction->Data.AdjustBuffs.InvincibilityTicks = 
BUFF_NOT_AFFECTED;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("haste-ticks"))) {
-                               spellaction->Data.AdjustBuffs.HasteTicks = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, gh_symbol2scm("slow-ticks"))) 
{
-                               spellaction->Data.AdjustBuffs.SlowTicks = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("bloodlust-ticks"))) {
-                               spellaction->Data.AdjustBuffs.BloodlustTicks = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("invisibility-ticks"))) {
-                               spellaction->Data.AdjustBuffs.InvisibilityTicks 
= gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("invincibility-ticks"))) {
-                               
spellaction->Data.AdjustBuffs.InvincibilityTicks = gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else {
-                               errl("Unsupported adjust-buffs tag", value);
-                       }
-               }
-       } else if (gh_eq_p(value, gh_symbol2scm("summon"))) {
-               spellaction->CastFunction = CastSummon;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("unit-type"))) {
-                               str = gh_scm2newstr(gh_car(list), 0);
-                               spellaction->Data.Summon.UnitType = 
UnitTypeByIdent(str);
-                               if (!spellaction->Data.Summon.UnitType) {
-                                       spellaction->Data.Summon.UnitType = 0;
-                                       DebugLevel0("unit type \"%s\" not found 
for summon spell.\n" _C_ str);
-                               }
-                               free(str);
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("time-to-live"))) {
-                               spellaction->Data.Summon.TTL = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("require-corpse"))) {
-                               spellaction->Data.Summon.RequireCorpse = 1;
-                       } else {
-                               errl("Unsupported summon tag", value);
-                       }
-               }
-       } else if (gh_eq_p(value, gh_symbol2scm("spawn-portal"))) {
-               spellaction->CastFunction = CastSpawnPortal;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("portal-type"))) {
-                               str = gh_scm2newstr(gh_car(list), 0);
-                               spellaction->Data.SpawnPortal.PortalType = 
UnitTypeByIdent(str);
-                               if (!spellaction->Data.SpawnPortal.PortalType) {
-                                       
spellaction->Data.SpawnPortal.PortalType = 0;
-                                       DebugLevel0("unit type \"%s\" not found 
for spawn-portal.\n" _C_ str);
-                               }
-                               free(str);
-                               list = gh_cdr(list);
-                       } else {
-                               errl("Unsupported spawn-portal tag", value);
-                       }
-               }
-       } else if (gh_eq_p(value, gh_symbol2scm("polymorph"))) {
-               spellaction->CastFunction = CastPolymorph;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("new-form"))) {
-                               str = gh_scm2newstr(gh_car(list),0);
-                               spellaction->Data.Summon.UnitType = 
UnitTypeByIdent(str);
-                               if (!spellaction->Data.Summon.UnitType) {
-                                       spellaction->Data.Summon.UnitType = 0;
-                                       DebugLevel0("unit type \"%s\" not found 
for polymorph spell.\n" _C_ str);
-                               }
-                               free(str);
-                               list = gh_cdr(list);
-                               // FIXME: temp polymorphs? hard to do.
-                       } else {
-                               errl("Unsupported polymorph tag", value);
-                       }
-               }
-       } else if (gh_eq_p(value, gh_symbol2scm("adjust-vitals"))) {
-               spellaction->CastFunction = CastAdjustVitals;
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("hit-points"))) {
-                               spellaction->Data.AdjustVitals.HP = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("mana-points"))) {
-                               spellaction->Data.AdjustVitals.Mana = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("max-multi-cast"))) {
-                               spellaction->Data.AdjustVitals.MaxMultiCast = 
gh_scm2int(gh_car(list));
-                               list = gh_cdr(list);
-                       } else {
-                               errl("Unsupported adjust-vitals tag", value);
-                       }
-               }
-       } else {
-               errl("Unsupported action type", value);
-       }
-}
-#elif defined(USE_LUA)
 local void CclSpellAction(lua_State* l, SpellActionType* spellaction)
 {
        const char* value;
@@ -629,7 +384,6 @@
                lua_error(l);
        }
 }
-#endif
 
 /**
 **             Get a condition value from a scm object.
@@ -640,21 +394,6 @@
 **             @note           This is a helper function to make 
CclSpellCondition shorter
 **                             and easier to understand.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global char Scm2Condition(SCM value)
-{
-       if (gh_eq_p(value, gh_symbol2scm("true"))) {
-               return CONDITION_TRUE;
-       } else if (gh_eq_p(value, gh_symbol2scm("false"))) {
-               return CONDITION_FALSE;
-       } else if (gh_eq_p(value, gh_symbol2scm("only"))) {
-               return CONDITION_ONLY;
-       } else {
-               errl("Bad condition result", value);
-               return -1;
-       }
-}
-#elif defined(USE_LUA)
 global char Ccl2Condition(lua_State* l, const char* value)
 {
        if (!strcmp(value, "true")) {
@@ -669,7 +408,6 @@
                return -1;
        }
 }
-#endif
 
 /**
 **             Parse the Condition for spell.
@@ -679,90 +417,6 @@
 **
 **             @notes: conditions must be allocated. All data already in is 
LOST.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclSpellCondition(SCM list, ConditionInfo* condition)
-{
-       SCM value;
-       int i;
-
-       //
-       //              Initializations:
-       //
-
-       //              Set everything to 0:
-       memset(condition, 0, sizeof(ConditionInfo));
-       //              Flags are defaulted to 0(CONDITION_TRUE)
-       condition->BoolFlag = calloc(NumberBoolFlag, sizeof 
(*condition->BoolFlag));
-       //              Initialize min/max stuff to values with no effect.
-       condition->MinHpPercent = -10;
-       condition->MaxHpPercent = 1000;
-       condition->MinManaPercent = -10;
-       condition->MaxManaPercent = 1000;
-       //  Buffs too.
-       condition->MaxHasteTicks = 0xFFFFFFF;
-       condition->MaxSlowTicks = 0xFFFFFFF;
-       condition->MaxBloodlustTicks = 0xFFFFFFF;
-       condition->MaxInvisibilityTicks = 0xFFFFFFF;
-       condition->MaxInvincibilityTicks = 0xFFFFFFF;
-       //  Now parse the list and set values.
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("coward"))) {
-                       condition->Coward = Scm2Condition(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("alliance"))) {
-                       condition->Alliance = Scm2Condition(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("building"))) {
-                       condition->Building = Scm2Condition(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("self"))) {
-                       condition->TargetSelf = Scm2Condition(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("min-hp-percent"))) {
-                       condition->MinHpPercent = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("max-hp-percent"))) {
-                       condition->MaxHpPercent = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("min-mana-percent"))) {
-                       condition->MinManaPercent = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("max-mana-percent"))) {
-                       condition->MaxManaPercent = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("max-slow-ticks"))) {
-                       condition->MaxSlowTicks = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("max-haste-ticks"))) {
-                       condition->MaxHasteTicks = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, 
gh_symbol2scm("max-bloodlust-ticks"))) {
-                       condition->MaxBloodlustTicks = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, 
gh_symbol2scm("max-invisibility-ticks"))) {
-                       condition->MaxInvisibilityTicks = 
gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, 
gh_symbol2scm("max-invincibility-ticks"))) {
-                       condition->MaxInvincibilityTicks = 
gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else {
-                       for (i = 0; i < NumberBoolFlag; i++) { // User defined 
flags
-                               if (gh_eq_p(value, 
gh_symbol2scm(BoolFlagName[i]))) {
-                                       condition->BoolFlag[i] = 
Scm2Condition(gh_car(list));
-                                       list = gh_cdr(list);
-                                       break;
-                               }
-                       }
-                       if (i != NumberBoolFlag) {
-                               continue;
-                       }
-                       errl("Unsuported condition tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclSpellCondition(lua_State* l, ConditionInfo* condition)
 {
        const char* value;
@@ -869,7 +523,6 @@
                }
        }
 }
-#endif
 
 /*
 **             Parse the Condition for spell.
@@ -879,35 +532,6 @@
 **
 **             @notes: autocast must be allocated. All data already in is LOST.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclSpellAutocast(SCM list, AutoCastInfo* autocast)
-{
-       SCM value;
-
-       DebugCheck(!list);
-       DebugCheck(!autocast);
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("range"))) {
-                       autocast->Range = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("combat"))) {
-                       autocast->Combat = Scm2Condition(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("condition"))) {
-                       if (!autocast->Condition) {
-                               autocast->Condition = 
(ConditionInfo*)malloc(sizeof(ConditionInfo));
-                       }
-                       CclSpellCondition(gh_car(list), autocast->Condition);
-                       list = gh_cdr(list);
-               } else {
-                       errl("Unsupported autocast tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclSpellAutocast(lua_State* l, AutoCastInfo* autocast)
 {
        const char* value;
@@ -945,142 +569,12 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse Spell.
 **
 **             @param list             List describing Spell.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineSpell(SCM list)
-{
-       char* identname;
-       char* str;
-       SpellType* spell;
-       SCM value;
-       SCM sublist;
-       SpellActionType* act;
-
-       identname = gh_scm2newstr(gh_car(list), NULL);
-       list = gh_cdr(list);
-       spell = SpellTypeByIdent(identname);
-       if (spell != NULL) {
-                       DebugLevel0Fn("Redefining spell-type `%s'\n" _C_ 
identname);
-               free(identname);
-       } else {
-               SpellTypeTable = realloc(SpellTypeTable, (1 + SpellTypeCount) * 
sizeof(SpellType));
-               spell = &SpellTypeTable[SpellTypeCount++];
-               memset(spell, 0, sizeof(SpellType));
-               spell->Ident = SpellTypeCount - 1;
-               spell->IdentName = identname;
-               spell->DependencyId = -1;
-       }
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("showname"))) {
-                       if (spell->Name) {
-                                       free(spell->Name);
-                       }
-                       spell->Name = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("manacost"))) {
-                       spell->ManaCost = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("range"))) {
-                       if (gh_eq_p(gh_car(list), gh_symbol2scm("infinite"))) {
-                               spell->Range = INFINITE_RANGE;
-                       } else {
-                               spell->Range = gh_scm2int(gh_car(list));
-                       }
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("repeat-cast"))) {
-                       spell->RepeatCast = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("target"))) {
-                       value = gh_car(list);
-                       if (gh_eq_p(value, gh_symbol2scm("self"))) {
-                               spell->Target = TargetSelf;
-                       } else if (gh_eq_p(value, gh_symbol2scm("unit"))) {
-                               spell->Target = TargetUnit;
-                       } else if (gh_eq_p(value, gh_symbol2scm("position"))) {
-                               spell->Target = TargetPosition;
-                       } else {
-                               errl("Unsupported spell target type tag", 
value);
-                       }
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("action"))) {
-                       spell->Action = 
(SpellActionType*)malloc(sizeof(SpellActionType));
-                       act = spell->Action;
-                       memset(act, 0, sizeof(SpellActionType));
-                       sublist = gh_car(list);
-                       CclSpellAction(gh_car(sublist), act);
-                       sublist = gh_cdr(sublist);
-                       while (!gh_null_p(sublist)) {
-                               act->Next = 
(SpellActionType*)malloc(sizeof(SpellActionType));
-                               act = act->Next;
-                               memset(act, 0, sizeof(SpellActionType));
-                               CclSpellAction(gh_car(sublist), act);
-                               sublist = gh_cdr(sublist);
-                       }
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("condition"))) {
-                       if (!spell->Condition) {
-                               spell->Condition = 
(ConditionInfo*)malloc(sizeof(ConditionInfo));
-                       }
-                       CclSpellCondition(gh_car(list), spell->Condition);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("autocast"))) {
-                       if (!spell->AutoCast) {
-                               spell->AutoCast = 
(AutoCastInfo*)malloc(sizeof(AutoCastInfo));
-                               memset(spell->AutoCast, 0, 
sizeof(AutoCastInfo));
-                       }
-                       CclSpellAutocast(gh_car(list), spell->AutoCast);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("ai-cast"))) {
-                       if (!spell->AICast) {
-                               spell->AICast = 
(AutoCastInfo*)malloc(sizeof(AutoCastInfo));
-                               memset(spell->AICast, 0, sizeof(AutoCastInfo));
-                       }
-                       CclSpellAutocast(gh_car(list), spell->AICast);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("sound-when-cast"))) {
-                       //  Free the old name, get the new one
-                       if (spell->SoundWhenCast.Name) {
-                               free(spell->SoundWhenCast.Name);
-                       }
-                       spell->SoundWhenCast.Name = gh_scm2newstr(gh_car(list), 
0);
-                       spell->SoundWhenCast.Sound = 
SoundIdForName(spell->SoundWhenCast.Name);
-                       //  Check for sound.
-                       if (!spell->SoundWhenCast.Sound) {
-                               free(spell->SoundWhenCast.Name);
-                               spell->SoundWhenCast.Name = 0;
-                       }
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("missile-when-cast"))) {
-                       str = gh_scm2newstr(gh_car(list), NULL);
-                       spell->Missile = MissileTypeByIdent(str);
-                       if (spell->Missile == NULL) {
-                               DebugLevel0Fn("in spell-type '%s' : missile %s 
does not exist\n" _C_
-                                       spell->Name _C_ str);
-                       }
-                       free(str);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("depend-upgrade"))) {
-                       str = gh_scm2newstr(gh_car(list), NULL);
-                       spell->DependencyId = UpgradeIdByIdent(str);
-                       free(str);
-                       if (spell->DependencyId == -1) {
-                               errl("Bad upgrade name", gh_car(list));
-                       }
-                       list = gh_cdr(list);
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineSpell(lua_State* l)
 {
        char* identname;
@@ -1224,29 +718,25 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for Spell.
 */
 global void SpellCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-spell", CclDefineSpell);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineSpell", CclDefineSpell);
-#endif
 }
 
-/*
+/**
 **             Save a spell action to a file.
 **
 **             @param file             File pointer to save to
 **             @param action           Pointer to action to save.
 */
-local void SaveSpellAction(CLFile *file,SpellActionType* action)
+local void SaveSpellAction(CLFile* file, SpellActionType* action)
 {
-       SpellActionMissileLocation * loc;
+       SpellActionMissileLocation* loc;
+
        if (action->CastFunction == CastAreaBombardment) {
                CLprintf(file, "(area-bombardment fields %d shards %d damage %d 
start-offset-x %d start-offset-y %d)",
                                action->Data.AreaBombardment.Fields,
@@ -1344,15 +834,15 @@
        }
 }
 
-/*
+/**
 **             Save a spell action to a file.
 **
 **             @param file             File pointer to save to
 **             @param action           Pointer to action to save.
 */
-local void SaveSpellCondition(CLFile *file, ConditionInfo* condition)
+local void SaveSpellCondition(CLFile* file, ConditionInfo* condition)
 {
-       char condstrings [3][10] = {
+       char condstrings[3][10] = {
                "true",                                         /// 
CONDITION_TRUE
                "false",                                /// CONDITION_FALSE
                "only"                                          /// 
CONDITION_ONLY
@@ -1405,7 +895,7 @@
        CLprintf(file, ")\n");
 }
 
-/*
+/**
 **             Save autocast info to a CCL file
 **
 **             @param file             The file to save to.
@@ -1413,7 +903,7 @@
 */
 void SaveSpellAutoCast(CLFile* file, AutoCastInfo* autocast)
 {
-       char condstrings [3][10] = {
+       char condstrings[3][10] = {
                "true",                                         /// 
CONDITION_TRUE
                "false",                                /// CONDITION_FALSE
                "only"                                          /// 
CONDITION_ONLY
@@ -1430,7 +920,7 @@
        CLprintf(file, " )\n");
 }
 
-/*
+/**
 **             Save spells to a CCL file.
 **
 **             @param file             The file to save to.
Index: stratagus/src/stratagus/construct.c
diff -u stratagus/src/stratagus/construct.c:1.42 
stratagus/src/stratagus/construct.c:1.43
--- stratagus/src/stratagus/construct.c:1.42    Sat Dec 20 16:33:17 2003
+++ stratagus/src/stratagus/construct.c Fri Jan  2 08:24:15 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: construct.c,v 1.42 2003/12/20 05:33:17 jsalmon3 Exp $
+//     $Id: construct.c,v 1.43 2004/01/01 21:24:15 jsalmon3 Exp $
 
 //@{
 
@@ -147,7 +147,7 @@
        ConstructionFrame* cframe;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: constructions $Id: construct.c,v 1.42 
2003/12/20 05:33:17 jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: constructions $Id: construct.c,v 1.43 
2004/01/01 21:24:15 jsalmon3 Exp $\n\n");
 
        // FIXME: needed?
 
@@ -313,33 +313,6 @@
 **
 **             @param list             List of all names.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineConstructionWcNames(SCM list)
-{
-       int i;
-       char** cp;
-
-       if ((cp = ConstructionWcNames)) {                               // Free 
all old names
-               while (*cp) {
-                       free(*cp++);
-               }
-               free(ConstructionWcNames);
-       }
-
-       //
-       //              Get new table.
-       //
-       i = gh_length(list);
-       ConstructionWcNames = cp = malloc((i + 1) * sizeof(char*));
-       while (i--) {
-               *cp++ = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-       }
-       *cp = NULL;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineConstructionWcNames(lua_State* l)
 {
        int i;
@@ -370,7 +343,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Parse the construction.
@@ -379,168 +351,6 @@
 **
 **             @note make this more flexible
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineConstruction(SCM list)
-{
-       SCM value;
-       SCM sublist;
-       char* str;
-       Construction* construction;
-       Construction** cop;
-       int i;
-
-       //              Slot identifier
-
-       str = gh_scm2newstr(gh_car(list), NULL);
-       list = gh_cdr(list);
-
-       if ((cop = Constructions) == NULL) {
-               Constructions = malloc(2 * sizeof(Construction*));
-               Constructions[0] = calloc(1, sizeof(Construction));
-               Constructions[1] = NULL;
-               construction = Constructions[0];
-       } else {
-               for (i = 0; *cop; ++i, ++cop) {
-               }
-               Constructions = realloc(Constructions, (i + 2) * 
sizeof(Construction*));
-               Constructions[i] = calloc(1, sizeof(Construction));
-               Constructions[i + 1] = NULL;
-               construction = Constructions[i];
-       }
-       construction->OType = ConstructionType;
-       construction->Ident = str;
-
-       //
-       //              Parse the arguments, in tagged format.
-       //
-       while (!gh_null_p(list)) {
-               int files;
-
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if ((files = gh_eq_p(value, gh_symbol2scm("file"))) ||
-                               gh_eq_p(value, gh_symbol2scm("shadow-file"))) {
-                       int tileset;
-                       char* file;
-                       int w;
-                       int h;
-
-                       tileset = 0;
-                       file = NULL;
-                       w = 0;
-                       h = 0;
-
-                       sublist = gh_car(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               if (gh_eq_p(value, gh_symbol2scm("tileset"))) {
-                                       str = gh_scm2newstr(gh_car(sublist), 
NULL);
-                                       sublist = gh_cdr(sublist);
-
-                                       // FIXME: use a general get tileset 
function here!
-                                       i = 0;
-                                       if (strcmp(str, "default")) {
-                                               for (; i < NumTilesets; ++i) {
-                                                       if (!strcmp(str, 
Tilesets[i]->Ident)) {
-                                                               break;
-                                                       }
-                                                       if (!strcmp(str, 
Tilesets[i]->Class)) {
-                                                               break;
-                                                       }
-                                               }
-                                               if (i == NumTilesets) {
-                                                       fprintf(stderr, 
"Tileset `%s' not available\n", str);
-                                                       errl("tileset not 
available", gh_car(sublist));
-                                               }
-                                       }
-                                       tileset = i;
-                                       free(str);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("file"))) {
-                                       file = gh_scm2newstr(gh_car(sublist), 
NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       w = gh_scm2int(gh_car(value));
-                                       value = gh_cdr(value);
-                                       h = gh_scm2int(gh_car(value));
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-                       if (files) {
-                               free(construction->File[tileset].File);
-                               construction->File[tileset].File = file;
-                               construction->File[tileset].Width = w;
-                               construction->File[tileset].Height = h;
-                       } else {
-                               free(construction->ShadowFile[tileset].File);
-                               construction->ShadowFile[tileset].File = file;
-                               construction->ShadowFile[tileset].Width = w;
-                               construction->ShadowFile[tileset].Height = h;
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("constructions"))) {
-                       sublist = gh_car(list);
-                       while (!gh_null_p(sublist)) {
-                               SCM slist;
-                               int percent;
-                               int file;
-                               int frame;
-                               ConstructionFrame** cframe;
-
-                               percent = 0;
-                               file = 0;
-                               frame = 0;
-
-                               slist = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               while (!gh_null_p(slist)) {
-                                       value = gh_car(slist);
-                                       slist = gh_cdr(slist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("percent"))) {
-                                               percent = 
gh_scm2int(gh_car(slist));
-                                               slist = gh_cdr(slist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("file"))) {
-                                               value = gh_car(slist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("construction"))) {
-                                                       file = 
ConstructionFileConstruction;
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("main"))) {
-                                                       file = 
ConstructionFileMain;
-                                               } else {
-                                                       errl("Unsupported tag", 
value);
-                                               }
-                                               slist = gh_cdr(slist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("frame"))) {
-                                               frame = 
gh_scm2int(gh_car(slist));
-                                               slist = gh_cdr(slist);
-                                       } else {
-                                               errl("Unsupported tag", value);
-                                       }
-                               }
-                               cframe = &construction->Frames;
-                               while (*cframe) {
-                                       cframe = &((*cframe)->Next);
-                               }
-                               (*cframe) = malloc(sizeof(ConstructionFrame));
-                               (*cframe)->Percent = percent;
-                               (*cframe)->File = file;
-                               (*cframe)->Frame = frame;
-                               (*cframe)->Next = NULL;
-                       }
-               } else {
-                       // FIXME: this leaves a half initialized construction
-                       errl("Unsupported tag", value);
-               }
-               list = gh_cdr(list);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineConstruction(lua_State* l)
 {
        const char* value;
@@ -722,7 +532,6 @@
 
        return 0;
 }
-#endif
 
 // ----------------------------------------------------------------------------
 
@@ -731,14 +540,8 @@
 */
 global void ConstructionCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-construction-wc-names",
-               CclDefineConstructionWcNames);
-       gh_new_procedureN("define-construction", CclDefineConstruction);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineConstructionWcNames",
                CclDefineConstructionWcNames);
        lua_register(Lua, "DefineConstruction", CclDefineConstruction);
-#endif
 }
 //@}
Index: stratagus/src/stratagus/groups.c
diff -u stratagus/src/stratagus/groups.c:1.29 
stratagus/src/stratagus/groups.c:1.30
--- stratagus/src/stratagus/groups.c:1.29       Sat Dec 20 16:33:17 2003
+++ stratagus/src/stratagus/groups.c    Fri Jan  2 08:24:15 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: groups.c,v 1.29 2003/12/20 05:33:17 jsalmon3 Exp $
+//     $Id: groups.c,v 1.30 2004/01/01 21:24:15 jsalmon3 Exp $
 
 //@{
 
@@ -89,7 +89,7 @@
        char* ref;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: groups $Id: groups.c,v 1.29 2003/12/20 
05:33:17 jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: groups $Id: groups.c,v 1.30 2004/01/01 
21:24:15 jsalmon3 Exp $\n\n");
 
        for (g = 0; g < NUM_GROUPS; ++g) {
                CLprintf(file, "(group %d %d '(", g, Groups[g].NumUnits);
@@ -235,30 +235,6 @@
 **             @param num              Number of units in group
 **             @param units            Units in group
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGroup(SCM group, SCM num, SCM units)
-{
-       int i;
-       UnitGroup* grp;
-
-       grp = &Groups[gh_scm2int(group)];
-       grp->NumUnits = gh_scm2int(num);
-       if (!grp->Units) {
-               InitGroups();
-       }
-       i = 0;
-       while (!gh_null_p(units)) {
-               char* str;
-
-               str = gh_scm2newstr(gh_car(units), NULL);
-               grp->Units[i++] = (Unit*)strtol(str + 1, NULL, 16);
-               free(str);
-               units = gh_cdr(units);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclGroup(lua_State* l)
 {
        int i;
@@ -286,18 +262,13 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for groups.
 */
 global void GroupCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure3_0("group", CclGroup);
-#elif defined(USE_LUA)
        lua_register(Lua, "Group", CclGroup);
-#endif
 }
 
 //@}
Index: stratagus/src/stratagus/selection.c
diff -u stratagus/src/stratagus/selection.c:1.63 
stratagus/src/stratagus/selection.c:1.64
--- stratagus/src/stratagus/selection.c:1.63    Sat Dec 20 16:33:19 2003
+++ stratagus/src/stratagus/selection.c Fri Jan  2 08:24:15 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: selection.c,v 1.63 2003/12/20 05:33:19 jsalmon3 Exp $
+//     $Id: selection.c,v 1.64 2004/01/01 21:24:15 jsalmon3 Exp $
 
 //@{
 
@@ -978,7 +978,7 @@
        char* ref;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: selection $Id: selection.c,v 1.63 
2003/12/20 05:33:19 jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: selection $Id: selection.c,v 1.64 
2004/01/01 21:24:15 jsalmon3 Exp $\n\n");
 
        CLprintf(file, "(set-group-id! %d)\n", GroupId);
        CLprintf(file, "(selection %d '(", NumSelected);
@@ -1010,17 +1010,6 @@
 **             @param id               New group identifier
 **             @return                         old value
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGroupId(SCM id)
-{
-       SCM old;
-
-       old = gh_int2scm(GroupId);
-       GroupId = gh_scm2int(id);
-
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetGroupId(lua_State* l)
 {
        int old;
@@ -1035,7 +1024,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Define the current selection.
@@ -1043,26 +1031,6 @@
 **             @param num              Number of units in selection
 **             @param units            Units in selection
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSelection(SCM num, SCM units)
-{
-       int i;
-
-       InitSelections();
-       NumSelected = gh_scm2int(num);
-       i = 0;
-       while (!gh_null_p(units)) {
-               char* str;
-
-               str = gh_scm2newstr(gh_car(units), NULL);
-               Selected[i++] = UnitSlots[strtol(str + 1, NULL, 16)];
-               free(str);
-               units = gh_cdr(units);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSelection(lua_State* l)
 {
        int i;
@@ -1088,20 +1056,14 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for selections.
 */
 global void SelectionCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure1_0("set-group-id!", CclSetGroupId);
-       gh_new_procedure2_0("selection", CclSelection);
-#elif defined(USE_LUA)
        lua_register(Lua, "SetGroupId", CclSetGroupId);
        lua_register(Lua, "Selection", CclSelection);
-#endif
 }
 
 //@}
Index: stratagus/src/stratagus/spells.c
diff -u stratagus/src/stratagus/spells.c:1.134 
stratagus/src/stratagus/spells.c:1.135
--- stratagus/src/stratagus/spells.c:1.134      Sat Dec 20 16:33:19 2003
+++ stratagus/src/stratagus/spells.c    Fri Jan  2 08:24:15 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: spells.c,v 1.134 2003/12/20 05:33:19 jsalmon3 Exp $
+//     $Id: spells.c,v 1.135 2004/01/01 21:24:15 jsalmon3 Exp $
 
 /*
 **             And when we cast our final spell
@@ -1033,19 +1033,6 @@
 /**
 **             FIXME: docu
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global unsigned CclGetSpellByIdent(SCM value)
-{
-       int i;
-
-       for (i = 0; i < SpellTypeCount; ++i) {
-               if (gh_eq_p(value, gh_symbol2scm(SpellTypeTable[i].IdentName))) 
{
-                       return i;
-               }
-       }
-       return -1;
-}
-#elif defined(USE_LUA)
 global unsigned CclGetSpellByIdent(lua_State* l)
 {
        int i;
@@ -1059,7 +1046,6 @@
        }
        return -1;
 }
-#endif
 
 /**
 **             Get spell-type struct ptr by id
Index: stratagus/src/stratagus/stratagus.c
diff -u stratagus/src/stratagus/stratagus.c:1.239 
stratagus/src/stratagus/stratagus.c:1.240
--- stratagus/src/stratagus/stratagus.c:1.239   Tue Dec 23 16:30:16 2003
+++ stratagus/src/stratagus/stratagus.c Fri Jan  2 08:24:15 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: stratagus.c,v 1.239 2003/12/23 05:30:16 jsalmon3 Exp $
+//     $Id: stratagus.c,v 1.240 2004/01/01 21:24:15 jsalmon3 Exp $
 
 //@{
 
@@ -227,10 +227,7 @@
 #include "pathfinder.h"
 
 #ifdef DEBUG
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern SCM CclUnits(void);
-#elif defined(USE_LUA)
-#endif
+extern int CclUnits(lua_State* l);
 #endif
 
 /*----------------------------------------------------------------------------
@@ -1200,7 +1197,6 @@
        // vvv---- looks wired, but is needed for GNU brain damage
        fprintf(stdout, "%s\n  written by Lutz Sammer, Fabrice Rossi, Vladi 
Shabanski, Patrice Fortier,\n  Jon Gabrielson, Andreas Arens, Nehal Mistry, 
Jimmy Salmon and others.\n"
        "\t(http://Stratagus.Org)"
-       "\n  SIOD Copyright by George J. Carrette."
 #ifdef USE_LIBMODPLUG
        "\n  libmodplug Copyright by Kenton Varda & Olivier Lapique."
 #endif
@@ -1209,15 +1205,6 @@
        "\n  SDL Copyright by Sam Lantinga."
 #endif
        "\nCompile options "
-#ifdef USE_SIOD
-       "SIOD "
-#endif
-#ifdef USE_GUILE
-       "GUILE "
-#endif
-#ifdef USE_LUA
-       "LUA "
-#endif
 #ifdef USE_THREAD
        "THREAD "
 #endif
@@ -1394,15 +1381,11 @@
                FrameCounter _C_ SlowFrameCounter _C_
                (SlowFrameCounter * 100) / (FrameCounter ? FrameCounter : 1));
        UnitCacheStatistic();
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       CclUnits();
-#endif
+       CclUnits(Lua);
        CleanModules();
        CleanFonts();
-#ifdef USE_LUA
        lua_close(Lua);
 #endif
-#endif
 
        CleanMovie();
 
@@ -1476,13 +1459,8 @@
 #ifndef __APPLE__
        StratagusLibPath = STRATAGUS_LIB_PATH;
 #endif
-#ifndef USE_LUA
-       CclStartFile = "ccl/stratagus.ccl";
-       EditorStartFile = "ccl/editor.ccl";
-#else
        CclStartFile = "ccl/stratagus.lua";
        EditorStartFile = "ccl/editor.lua";
-#endif
 
        memset(LocalPlayerName, 0, 16);
        strcpy(LocalPlayerName, "Anonymous");
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.178 stratagus/src/ui/ccl_ui.c:1.179
--- stratagus/src/ui/ccl_ui.c:1.178     Thu Jan  1 13:50:14 2004
+++ stratagus/src/ui/ccl_ui.c   Fri Jan  2 08:24:17 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl_ui.c,v 1.178 2004/01/01 02:50:14 jsalmon3 Exp $
+//      $Id: ccl_ui.c,v 1.179 2004/01/01 21:24:17 jsalmon3 Exp $
 
 //@{
 
@@ -75,21 +75,6 @@
 **
 **  @return      The old state of color cylce all.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetColorCycleAll(SCM flag)
-{
-       int old;
-
-       old = ColorCycleAll;
-       if (gh_boolean_p(flag)) {
-               ColorCycleAll = gh_scm2bool(flag);
-       } else {
-               ColorCycleAll = gh_scm2int(flag);
-       }
-
-       return old < 0 ? gh_int2scm(old) : gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetColorCycleAll(lua_State* l)
 {
        lua_Number old;
@@ -108,7 +93,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **  Set speed of middle-mouse scroll
@@ -117,17 +101,6 @@
 **
 **  @return       The old value.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMouseScrollSpeedDefault(SCM speed)
-{
-       int old;
-
-       old = TheUI.MouseScrollSpeedDefault;
-       TheUI.MouseScrollSpeedDefault = gh_scm2int(speed);
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetMouseScrollSpeedDefault(lua_State* l)
 {
        lua_Number old;
@@ -142,7 +115,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **  Set speed of ctrl-middle-mouse scroll
@@ -151,17 +123,6 @@
 **
 **  @return       The old value.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMouseScrollSpeedControl(SCM speed)
-{
-       int old;
-
-       old = TheUI.MouseScrollSpeedControl;
-       TheUI.MouseScrollSpeedControl = gh_scm2int(speed);
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetMouseScrollSpeedControl(lua_State* l)
 {
        lua_Number old;
@@ -176,7 +137,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **  Set which missile is used for right click
@@ -185,25 +145,6 @@
 **
 **  @return         old value
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetClickMissile(SCM missile)
-{
-       SCM old;
-
-       old = NIL;
-
-       if (ClickMissile) {
-               old = gh_str02scm(ClickMissile);
-               free(ClickMissile);
-               ClickMissile = NULL;
-       }
-
-       if (!gh_null_p(missile)) {
-               ClickMissile = gh_scm2newstr(missile, NULL);
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetClickMissile(lua_State* l)
 {
        char* old;
@@ -228,7 +169,6 @@
        free(old);
        return 1;
 }
-#endif
 
 /**
 **             Set which missile shows Damage
@@ -236,25 +176,6 @@
 **             @param missile          missile name to use
 **             @return                         old value
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetDamageMissile(SCM missile)
-{
-       SCM old;
-
-       old = NIL;
-
-       if (DamageMissile) {
-               old = gh_str02scm(DamageMissile);
-               free(DamageMissile);
-               DamageMissile = NULL;
-       }
-
-       if (!gh_null_p(missile)) {
-               DamageMissile = gh_scm2newstr(missile, NULL);
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetDamageMissile(lua_State* l)
 {
        char* old;
@@ -279,7 +200,6 @@
        free(old);
        return 1;
 }
-#endif
 
 /**
 **             Game contrast.
@@ -287,30 +207,6 @@
 **             @param contrast         New contrast 0 - 400.
 **             @return                         Old contrast.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetContrast(SCM contrast)
-{
-       int i;
-       SCM old;
-
-       old = gh_int2scm(TheUI.Contrast);
-       i = gh_scm2int(contrast);
-       if (i < 0 || i > 400) {
-               PrintFunction();
-               fprintf(stdout, "Contrast should be 0 - 400\n");
-               i = 100;
-       }
-       TheUI.Contrast = i;
-#ifdef USE_SDL_SURFACE
-       // FIXME
-#else
-       VideoCreatePalette(GlobalPalette);              // rebuild palette
-#endif
-       MustRedraw = RedrawEverything;
-
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetContrast(lua_State* l)
 {
        int i;
@@ -337,7 +233,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Game brightness.
@@ -345,30 +240,6 @@
 **             @param brightness               New brightness -100 - 100.
 **             @return                                         Old brightness.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetBrightness(SCM brightness)
-{
-       int i;
-       SCM old;
-
-       old = gh_int2scm(TheUI.Brightness);
-       i = gh_scm2int(brightness);
-       if (i < -100 || i > 100) {
-               PrintFunction();
-               fprintf(stdout, "Brightness should be -100 - 100\n");
-               i = 0;
-       }
-       TheUI.Brightness = i;
-#ifdef USE_SDL_SURFACE
-       // FIXME:
-#else
-       VideoCreatePalette(GlobalPalette);              // rebuild palette
-#endif
-       MustRedraw = RedrawEverything;
-
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetBrightness(lua_State* l)
 {
        int i;
@@ -395,7 +266,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Game saturation.
@@ -403,30 +273,6 @@
 **             @param saturation               New saturation -100 - 200.
 **             @return                                         Old saturation.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSaturation(SCM saturation)
-{
-       int i;
-       SCM old;
-
-       old = gh_int2scm(TheUI.Saturation);
-       i = gh_scm2int(saturation);
-       if (i < -100 || i > 200) {
-               PrintFunction();
-               fprintf(stdout, "Saturation should be -100 - 200\n");
-               i = 0;
-       }
-       TheUI.Saturation = i;
-#ifdef USE_SDL_SURFACE
-       // FIXME
-#else
-       VideoCreatePalette(GlobalPalette);              // rebuild palette
-#endif
-       MustRedraw = RedrawEverything;
-
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetSaturation(lua_State* l)
 {
        int i;
@@ -453,7 +299,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set the video resolution.
@@ -461,19 +306,6 @@
 **             @param width            Resolution width.
 **             @param height           Resolution height.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetVideoResolution(SCM width,SCM height)
-{
-       if (CclInConfigFile) {
-               // May have been set from the command line
-               if (!VideoWidth || !VideoHeight) {
-                       VideoWidth = gh_scm2int(width);
-                       VideoHeight = gh_scm2int(height);
-               }
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetVideoResolution(lua_State* l)
 {
        if (lua_gettop(l) != 2) {
@@ -489,7 +321,6 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Set the video fullscreen mode.
@@ -498,18 +329,6 @@
 **
 **             @return                                         Old fullscreen 
mode
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetVideoFullScreen(SCM fullscreen)
-{
-       SCM old;
-
-       old = gh_int2scm(VideoFullScreen);
-       if (CclInConfigFile) {
-               VideoFullScreen = gh_scm2bool(fullscreen);
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetVideoFullScreen(lua_State* l)
 {
        int old;
@@ -526,7 +345,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **  Default title screens.
@@ -535,116 +353,6 @@
 **
 **  @return      None
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetTitleScreens(SCM list)
-{
-       int i;
-       int j;
-       SCM value;
-       SCM labelvalue;
-       SCM labellist;
-       SCM poslist;
-       SCM flagslist;
-       char* s1;
-
-       if (TitleScreens) {
-               for (i = 0; TitleScreens[i]; ++i) {
-                       free(TitleScreens[i]->File);
-                       free(TitleScreens[i]->Music);
-                       if (TitleScreens[i]->Labels) {
-                               for (j = 0; TitleScreens[i]->Labels[j]; ++j) {
-                                       free(TitleScreens[i]->Labels[j]->Text);
-                                       free(TitleScreens[i]->Labels[j]);
-                               }
-                               free(TitleScreens[i]->Labels);
-                       }
-                       free(TitleScreens[i]);
-               }
-               free(TitleScreens);
-               TitleScreens = NULL;
-       }
-       if (!gh_null_p(list)) {
-               i = 0;
-               TitleScreens = calloc(gh_length(list) + 1, 
sizeof(*TitleScreens));
-               while (!gh_null_p(list)) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       TitleScreens[i] = calloc(1, sizeof(**TitleScreens));
-                       TitleScreens[i]->Timeout = 20; // Default timeout
-                       while (!gh_null_p(value)) {
-                               if (gh_eq_p(gh_car(value), 
gh_symbol2scm("image"))) {
-                                       value = gh_cdr(value);
-                       TitleScreens[i]->File = gh_scm2newstr(gh_car(value), 
NULL);
-                       value = gh_cdr(value);
-                               } else if (gh_eq_p(gh_car(value), 
gh_symbol2scm("music"))) {
-                                       value = gh_cdr(value);
-                               TitleScreens[i]->Music = 
gh_scm2newstr(gh_car(value), NULL);
-                                       value = gh_cdr(value);
-                               } else if (gh_eq_p(gh_car(value), 
gh_symbol2scm("timeout"))) {
-                                       value = gh_cdr(value);
-                                       TitleScreens[i]->Timeout = 
gh_scm2int(gh_car(value));
-                                       value = gh_cdr(value);
-                               } else if (gh_eq_p(gh_car(value), 
gh_symbol2scm("label"))) {
-                                       value = gh_cdr(value);
-                                       labellist = gh_car (value);
-                                       value = gh_cdr (value);
-
-                                       j = 0;
-                                       TitleScreens[i]->Labels = 
calloc(gh_length(labellist) + 1, sizeof(*TitleScreens[i]->Labels));
-                                       while (!gh_null_p(labellist)) {
-                                               labelvalue = gh_car(labellist);
-                                               labellist = gh_cdr(labellist);
-                                               TitleScreens[i]->Labels[j] = 
calloc(1, sizeof(**TitleScreens[i]->Labels));
-                                               while (!gh_null_p(labelvalue)) {
-                                                       if 
(gh_eq_p(gh_car(labelvalue), gh_symbol2scm("text"))) {
-                                                               labelvalue = 
gh_cdr(labelvalue);
-                                                               
TitleScreens[i]->Labels[j]->Text = gh_scm2newstr(gh_car(labelvalue), NULL);
-                                                               labelvalue = 
gh_cdr(labelvalue);
-                                                       } else if 
(gh_eq_p(gh_car(labelvalue), gh_symbol2scm("pos"))) {
-                                                               labelvalue = 
gh_cdr(labelvalue);
-                                                               poslist = 
gh_car(labelvalue);
-                                                               labelvalue = 
gh_cdr(labelvalue);
-                                                               
TitleScreens[i]->Labels[j]->Xofs = gh_scm2int(gh_car(poslist));
-                                                               poslist = 
gh_cdr(poslist);
-                                                               
TitleScreens[i]->Labels[j]->Yofs = gh_scm2int(gh_car(poslist));
-                                                       } else if 
(gh_eq_p(gh_car(labelvalue), gh_symbol2scm("flags"))) {
-                                                               labelvalue = 
gh_cdr(labelvalue);
-                                                               flagslist = 
gh_car(labelvalue);
-                                                               labelvalue = 
gh_cdr(labelvalue);
-                                                               while 
(!gh_null_p(flagslist)) {
-                                                                       if 
(gh_eq_p(gh_car(flagslist), gh_symbol2scm("center"))) {
-                                                                               
TitleScreens[i]->Labels[j]->Flags |= TitleFlagCenter;
-                                                                               
flagslist = gh_cdr(flagslist);
-                                                                       } else {
-                                                                               
s1 = gh_scm2newstr(gh_car(flagslist), NULL);
-                                                                               
fprintf(stderr, "Unsupported flag %s\n", s1);
-                                                                               
free(s1);
-                                                                               
flagslist = gh_cdr(flagslist);
-                                                                       }
-                                                               }
-                                                       } else {
-                                                               s1 = 
gh_scm2newstr(gh_car(labelvalue), NULL);
-                                                               fprintf(stderr, 
"Unsupported tag %s\n", s1);
-                                                               free(s1);
-                                                               labelvalue = 
gh_cdr(labelvalue);
-                                                       }
-                                               }
-                                               ++j;
-                                       }
-                               } else {
-                                       s1 = gh_scm2newstr(gh_car(value), NULL);
-                                       fprintf(stderr, "Unsupported tag %s\n", 
s1);
-                                       free(s1);
-                                       value = gh_cdr(value);
-                               }
-                       }
-                       ++i;
-               }
-       }
-       return SCM_UNSPECIFIED;
-
-}
-#elif defined(USE_LUA)
 local int CclSetTitleScreens(lua_State* l)
 {
        const char* value;
@@ -760,7 +468,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Default menu background.
@@ -769,26 +476,6 @@
 **
 **             @return                         Old menu background.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMenuBackground(SCM background)
-{
-       SCM old;
-
-       old = NIL;
-       if (MenuBackground) {
-               old = gh_str02scm(MenuBackground);
-       }
-       if (!gh_null_p(background)) {
-               if (MenuBackground) {
-                       free(MenuBackground);
-                       MenuBackground = NULL;
-               }
-
-               MenuBackground = gh_scm2newstr(background, NULL);
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetMenuBackground(lua_State* l)
 {
        char* old;
@@ -811,7 +498,6 @@
        free(old);
        return 1;
 }
-#endif
 
 /**
 **             Default menu background with title.
@@ -820,26 +506,6 @@
 **
 **             @return                         Old menu background.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMenuBackgroundWithTitle(SCM background)
-{
-       SCM old;
-
-       old = NIL;
-       if (MenuBackgroundWithTitle) {
-               old = gh_str02scm(MenuBackgroundWithTitle);
-       }
-       if (!gh_null_p(background)) {
-               if (MenuBackgroundWithTitle) {
-                       free(MenuBackgroundWithTitle);
-                       MenuBackgroundWithTitle = NULL;
-               }
-
-               MenuBackgroundWithTitle = gh_scm2newstr(background, NULL);
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetMenuBackgroundWithTitle(lua_State* l)
 {
        char* old;
@@ -862,7 +528,6 @@
        free(old);
        return 1;
 }
-#endif
 
 /**
 **             Default menu music.
@@ -871,26 +536,6 @@
 **
 **             @return                         Old menu music.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMenuMusic(SCM music)
-{
-       SCM old;
-
-       old = NIL;
-       if (MenuMusic) {
-               old = gh_str02scm(MenuMusic);
-       }
-       if (!gh_null_p(music)) {
-               if (MenuMusic) {
-                       free(MenuMusic);
-                       MenuMusic = NULL;
-               }
-
-               MenuMusic = gh_scm2newstr(music, NULL);
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetMenuMusic(lua_State* l)
 {
        char* old;
@@ -913,7 +558,6 @@
        free(old);
        return 1;
 }
-#endif
 
 /**
 **             Display a picture.
@@ -922,20 +566,6 @@
 **
 **             @return                         Nothing.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDisplayPicture(SCM file)
-{
-       char* name;
-
-       name = gh_scm2newstr(file, NULL);
-       SetClipping(0, 0, VideoWidth - 1, VideoHeight - 1);
-       DisplayPicture(name);
-       Invalidate();
-       free(name);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDisplayPicture(lua_State* l)
 {
        char* name;
@@ -952,7 +582,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Process a menu.
@@ -961,20 +590,6 @@
 **
 **             @return                         Nothing.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclProcessMenu(SCM id)
-{
-       char* mid;
-
-       mid = gh_scm2newstr(id, NULL);
-       if (FindMenu(mid)) {
-               ProcessMenu(mid, 1);
-       }
-       free(mid);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclProcessMenu(lua_State* l)
 {
        char* mid;
@@ -991,108 +606,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define a cursor.
 **
 **             FIXME: need some general data structure to make this parsing 
easier.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineCursor(SCM list)
-{
-       SCM value;
-       char* s1;
-       char* s2;
-       int i;
-       CursorType* ct;
-
-       //              Get identifier
-       value = gh_car(list);
-       list = gh_cdr(list);
-       s1 = gh_scm2newstr(value, NULL);
-       value = gh_car(list);
-       list = gh_cdr(list);
-       s2 = gh_scm2newstr(value, NULL);
-       if (!strcmp(s2, "any")) {
-               free(s2);
-               s2 = NULL;
-       }
-
-       //
-       //              Look if this kind of cursor already exists.
-       //
-       ct = NULL;
-       i = 0;
-       if (Cursors) {
-               for (; Cursors[i].OType; ++i) {
-                       //
-                       //              Race not same, not found.
-                       //
-                       if (Cursors[i].Race && s2) {
-                               if (strcmp(Cursors[i].Race, s2)) {
-                                       continue;
-                               }
-                       } else if (Cursors[i].Race != s2) {
-                               continue;
-                       }
-                       if (!strcmp(Cursors[i].Ident, s1)) {
-                               ct = &Cursors[i];
-                               break;
-                       }
-               }
-       }
-       //
-       //              Not found, make a new slot.
-       //
-       if (ct) {
-               free(s1);
-               free(s2);
-       } else {
-               ct = calloc(i + 2, sizeof(CursorType));
-               memcpy(ct, Cursors, sizeof(CursorType) * i);
-               free(Cursors);
-               Cursors = ct;
-               ct = &Cursors[i];
-               ct->OType = CursorTypeType;
-               ct->Ident = s1;
-               ct->Race = s2;
-               ct->FrameRate = 200;
-       }
-
-       //
-       //              Parse the arguments, already the new tagged format.
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("image"))) {
-                       free(ct->File);
-                       ct->File = gh_scm2newstr(gh_car(list), NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("hot-spot"))) {
-                       value = gh_car(list);
-                       ct->HotX = gh_scm2int(gh_car(value));
-                       value = gh_cdr(value);
-                       ct->HotY = gh_scm2int(gh_car(value));
-               } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
-                       value = gh_car(list);
-                       ct->Width = gh_scm2int(gh_car(value));
-                       value = gh_cdr(value);
-                       ct->Height = gh_scm2int(gh_car(value));
-               } else if (gh_eq_p(value, gh_symbol2scm("rate"))) {
-                       value = gh_car(list);
-                       ct->FrameRate = gh_scm2int(value);
-               } else {
-                       s1 = gh_scm2newstr(value, NULL);
-                       fprintf(stderr, "Unsupported tag %s\n", s1);
-                       free(s1);
-               }
-               list = gh_cdr(list);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineCursor(lua_State* l)
 {
        const char* value;
@@ -1196,25 +715,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Set the current game cursor.
 **
 **             @param ident            Cursor identifier.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGameCursor(SCM ident)
-{
-       char* str;
-
-       str = gh_scm2newstr(ident, NULL);
-       GameCursor = CursorTypeByIdent(str);
-       free(str);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetGameCursor(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -1224,7 +730,6 @@
        GameCursor = CursorTypeByIdent(LuaToString(l, 1));
        return 0;
 }
-#endif
 
 /**
 **             Define a menu item
@@ -1233,100 +738,7 @@
 **
 **             @param value            Button type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local MenuButtonId scm2buttonid(SCM value)
-{
-       MenuButtonId id;
-
-       if (gh_eq_p(value, gh_symbol2scm("main"))) {
-               id = MBUTTON_MAIN;
-       } else if (gh_eq_p(value, gh_symbol2scm("network"))) {
-               id = MBUTTON_NETWORK;
-       } else if (gh_eq_p(value, gh_symbol2scm("gm-half"))) {
-               id = MBUTTON_GM_HALF;
-       } else if (gh_eq_p(value, gh_symbol2scm("132"))) {
-               id = MBUTTON_132;
-       } else if (gh_eq_p(value, gh_symbol2scm("gm-full"))) {
-               id = MBUTTON_GM_FULL;
-       } else if (gh_eq_p(value, gh_symbol2scm("gem-round"))) {
-               id = MBUTTON_GEM_ROUND;
-       } else if (gh_eq_p(value, gh_symbol2scm("gem-square"))) {
-               id = MBUTTON_GEM_SQUARE;
-       } else if (gh_eq_p(value, gh_symbol2scm("up-arrow"))) {
-               id = MBUTTON_UP_ARROW;
-       } else if (gh_eq_p(value, gh_symbol2scm("down-arrow"))) {
-               id = MBUTTON_DOWN_ARROW;
-       } else if (gh_eq_p(value, gh_symbol2scm("left-arrow"))) {
-               id = MBUTTON_LEFT_ARROW;
-       } else if (gh_eq_p(value, gh_symbol2scm("right-arrow"))) {
-               id = MBUTTON_RIGHT_ARROW;
-       } else if (gh_eq_p(value, gh_symbol2scm("s-knob"))) {
-               id = MBUTTON_S_KNOB;
-       } else if (gh_eq_p(value, gh_symbol2scm("s-vcont"))) {
-               id = MBUTTON_S_VCONT;
-       } else if (gh_eq_p(value, gh_symbol2scm("s-hcont"))) {
-               id = MBUTTON_S_HCONT;
-       } else if (gh_eq_p(value, gh_symbol2scm("pulldown"))) {
-               id = MBUTTON_PULLDOWN;
-       } else if (gh_eq_p(value, gh_symbol2scm("vthin"))) {
-               id = MBUTTON_VTHIN;
-       } else if (gh_eq_p(value, gh_symbol2scm("folder"))) {
-               id = MBUTTON_FOLDER;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-gem-round"))) {
-               id = MBUTTON_SC_GEM_ROUND;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-gem-square"))) {
-               id = MBUTTON_SC_GEM_SQUARE;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-up-arrow"))) {
-               id = MBUTTON_SC_UP_ARROW;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-down-arrow"))) {
-               id = MBUTTON_SC_DOWN_ARROW;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-left-arrow"))) {
-               id = MBUTTON_SC_LEFT_ARROW;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-right-arrow"))) {
-               id = MBUTTON_SC_RIGHT_ARROW;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-s-knob"))) {
-               id = MBUTTON_SC_S_KNOB;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-s-vcont"))) {
-               id = MBUTTON_SC_S_VCONT;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-s-hcont"))) {
-               id = MBUTTON_SC_S_HCONT;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-pulldown"))) {
-               id = MBUTTON_SC_PULLDOWN;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-button-left"))) {
-               id = MBUTTON_SC_BUTTON_LEFT;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-button"))) {
-               id = MBUTTON_SC_BUTTON;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-button-right"))) {
-               id = MBUTTON_SC_BUTTON_RIGHT;
-       } else {
-               char* s1;
-               s1 = gh_scm2newstr(value, NULL);
-               fprintf(stderr, "Unsupported button %s\n", s1);
-               free(s1);
-               return 0;
-       }
-       return id;
-}
-
-/// Get an integer value from a list.
-local int SCM_PopInt(SCM* list)
-{
-       SCM value;
-       value = gh_car(*list);
-       *list = gh_cdr(*list);
-       return gh_scm2int(value);
-}
-
-/// Get a string value from a list.
-local char* SCM_PopNewStr(SCM* list)
-{
-       SCM value;
-       value = gh_car(*list);
-       *list = gh_cdr(*list);
-       return gh_scm2newstr(value, NULL);
-}
-#elif defined(USE_LUA)
-local MenuButtonId scm2buttonid(lua_State* l, const char* value)
+local MenuButtonId scm2buttonid(lua_State* l, const char* value)
 {
        MenuButtonId id;
 
@@ -1397,40 +809,10 @@
        }
        return id;
 }
-#endif
 
 /**
 **             Parse info panel text
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseInfoText(SCM list, InfoText* text)
-{
-       SCM value;
-
-       memset(text, 0, sizeof(*text));
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       text->Text = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("font"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       text->Font = CclFontByIdentifier(value);
-               } else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       text->X = gh_scm2int(gh_car(value));
-                       text->Y = gh_scm2int(gh_car(gh_cdr(value)));
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseInfoText(lua_State* l, InfoText* text)
 {
        const char* value;
@@ -1476,35 +858,10 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse icon
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseIcon(SCM list, Button* icon)
-{
-       SCM value;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("pos"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       icon->X = gh_scm2int(gh_car(value));
-                       icon->Y = gh_scm2int(gh_car(gh_cdr(value)));
-               } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       icon->Width = gh_scm2int(gh_car(value));
-                       icon->Height = gh_scm2int(gh_car(gh_cdr(value)));
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseIcon(lua_State* l, Button* icon)
 {
        const char* value;
@@ -1553,90 +910,10 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse info panel selected section
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseSelected(SCM list, UI* ui)
-{
-       SCM value;
-       SCM sublist;
-       InfoText text;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("single"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseInfoText(value, &text);
-                                       ui->SingleSelectedText = text.Text;
-                                       ui->SingleSelectedFont = text.Font;
-                                       ui->SingleSelectedTextX = text.X;
-                                       ui->SingleSelectedTextY = text.Y;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("icon"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->SingleSelectedButton = calloc(1, 
sizeof(Button));
-                                       CclParseIcon(value, 
ui->SingleSelectedButton);
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("multiple"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseInfoText(value, &text);
-                                       ui->SelectedText = text.Text;
-                                       ui->SelectedFont = text.Font;
-                                       ui->SelectedTextX = text.X;
-                                       ui->SelectedTextY = text.Y;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("icons"))) {
-                                       SCM slist;
-                                       int i;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->NumSelectedButtons = 
gh_length(slist);
-                                       ui->SelectedButtons = 
calloc(ui->NumSelectedButtons,
-                                               sizeof(Button));
-                                       i = 0;
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               CclParseIcon(value, 
&ui->SelectedButtons[i++]);
-                                       }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("max-text"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseInfoText(value, &text);
-                                       ui->MaxSelectedFont = text.Font;
-                                       ui->MaxSelectedTextX = text.X;
-                                       ui->MaxSelectedTextY = text.Y;
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseSelected(lua_State* l, UI* ui)
 {
        const char* value;
@@ -1742,83 +1019,10 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse info panel training section
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseTraining(SCM list, UI* ui)
-{
-       SCM value;
-       SCM sublist;
-       InfoText text;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("single"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseInfoText(value, &text);
-                                       ui->SingleTrainingText = text.Text;
-                                       ui->SingleTrainingFont = text.Font;
-                                       ui->SingleTrainingTextX = text.X;
-                                       ui->SingleTrainingTextY = text.Y;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("icon"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->SingleTrainingButton = calloc(1, 
sizeof(Button));
-                                       CclParseIcon(value, 
ui->SingleTrainingButton);
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("multiple"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseInfoText(value, &text);
-                                       ui->TrainingText = text.Text;
-                                       ui->TrainingFont = text.Font;
-                                       ui->TrainingTextX = text.X;
-                                       ui->TrainingTextY = text.Y;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("icons"))) {
-                                       SCM slist;
-                                       int i;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->NumTrainingButtons = 
gh_length(slist);
-                                       ui->TrainingButtons = 
calloc(ui->NumTrainingButtons,
-                                               sizeof(Button));
-                                       i = 0;
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               CclParseIcon(value, 
&ui->TrainingButtons[i++]);
-                                       }
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseTraining(lua_State* l, UI* ui)
 {
        const char* value;
@@ -1917,39 +1121,10 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse info panel upgrading section
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseUpgrading(SCM list, UI* ui)
-{
-       SCM value;
-       InfoText text;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseInfoText(value, &text);
-                       ui->UpgradingText = text.Text;
-                       ui->UpgradingFont = text.Font;
-                       ui->UpgradingTextX = text.X;
-                       ui->UpgradingTextY = text.Y;
-               } else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->UpgradingButton = calloc(1, sizeof(Button));
-                       CclParseIcon(value, ui->UpgradingButton);
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseUpgrading(lua_State* l, UI* ui)
 {
        const char* value;
@@ -1986,39 +1161,10 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse info panel researching section
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseResearching(SCM list, UI* ui)
-{
-       SCM value;
-       InfoText text;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseInfoText(value, &text);
-                       ui->ResearchingText = text.Text;
-                       ui->ResearchingFont = text.Font;
-                       ui->ResearchingTextX = text.X;
-                       ui->ResearchingTextY = text.Y;
-               } else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->ResearchingButton = calloc(1, sizeof(Button));
-                       CclParseIcon(value, ui->ResearchingButton);
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseResearching(lua_State* l, UI* ui)
 {
        const char* value;
@@ -2055,49 +1201,10 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse info panel transporting section
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseTransporting(SCM list, UI* ui)
-{
-       SCM value;
-       InfoText text;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseInfoText(value, &text);
-                       ui->TransportingText = text.Text;
-                       ui->TransportingFont = text.Font;
-                       ui->TransportingTextX = text.X;
-                       ui->TransportingTextY = text.Y;
-               } else if (gh_eq_p(value, gh_symbol2scm("icons"))) {
-                       SCM sublist;
-                       int i;
-
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->NumTransportingButtons = gh_length(sublist);
-                       ui->TransportingButtons = 
calloc(ui->NumTransportingButtons,
-                               sizeof(Button));
-                       i = 0;
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               CclParseIcon(value, 
&ui->TransportingButtons[i++]);
-                       }
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseTransporting(lua_State* l, UI* ui)
 {
        const char* value;
@@ -2146,698 +1253,29 @@
                }
        }
 }
-#endif
-
-/**
-**             Parse button panel icons section
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseButtonIcons(SCM list, UI* ui)
-{
-       SCM value;
-       int i;
-
-       ui->NumButtonButtons = gh_length(list);
-       ui->ButtonButtons = calloc(ui->NumButtonButtons, sizeof(Button));
-       i = 0;
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               CclParseIcon(value, &ui->ButtonButtons[i++]);
-       }
-}
-#elif defined(USE_LUA)
-local void CclParseButtonIcons(lua_State* l, UI* ui)
-{
-       int i;
-
-       ui->NumButtonButtons = luaL_getn(l, -1);
-       ui->ButtonButtons = calloc(ui->NumButtonButtons, sizeof(Button));
-       for (i = 0; i < ui->NumButtonButtons; ++i) {
-               lua_rawgeti(l, -1, i + 1);
-               CclParseIcon(l, &ui->ButtonButtons[i]);
-               lua_pop(l, 1);
-       }
-}
-#endif
-
-/**
-**             Define the look+feel of the user interface.
-**
-**             FIXME: need some general data structure to make this parsing 
easier.
-**             FIXME: use the new tagged config format.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineUI(SCM list)
-{
-       SCM value;
-       SCM sublist;
-       char* str;
-       char* s1;
-       int             x;
-       int             y;
-       int i;
-       UI* ui;
-       void* v;
-
-       //              Get identifier
-       value = gh_car(list);
-       list = gh_cdr(list);
-       str = gh_scm2newstr(value, NULL);
-       value = gh_car(list);
-       list = gh_cdr(list);
-       x = gh_scm2int(value);
-       value = gh_car(list);
-       list = gh_cdr(list);
-       y = gh_scm2int(value);
-
-       // Find slot: new or redefinition
-       ui = NULL;
-       i = 0;
-       if (UI_Table) {
-               for (; UI_Table[i]; ++i) {
-                       if (UI_Table[i]->Width == x && UI_Table[i]->Height == y 
&&
-                                       !strcmp(UI_Table[i]->Name, str)) {
-                               CleanUI(UI_Table[i]);
-                               ui = calloc(1, sizeof(UI));
-                               UI_Table[i] = ui;
-                               break;
-                       }
-               }
-       }
-       if (!ui) {
-               ui = calloc(1, sizeof(UI));
-               v = malloc(sizeof(UI*) * (i + 2));
-               memcpy(v, UI_Table, i * sizeof(UI*));
-               free(UI_Table);
-               UI_Table = v;
-               UI_Table[i] = ui;
-               UI_Table[i + 1] = NULL;
-       }
-
-       ui->Name = str;
-       ui->Width = x;
-       ui->Height = y;
-
-       //
-       //              Some value defaults
-       //
-
-       // This save the setup values FIXME: They are set by CCL.
-
-       ui->Contrast = TheUI.Contrast;
-       ui->Brightness = TheUI.Brightness;
-       ui->Saturation = TheUI.Saturation;
-
-       ui->MouseScroll = TheUI.MouseScroll;
-       ui->KeyScroll = TheUI.KeyScroll;
-       ui->MouseScrollSpeedDefault = TheUI.MouseScrollSpeedDefault;
-       ui->MouseScrollSpeedControl = TheUI.MouseScrollSpeedControl;
-
-       ui->MouseWarpX = -1;
-       ui->MouseWarpY = -1;
-
-       ui->Resource.File = NULL;
-       ui->ResourceX = -1;
-       ui->ResourceY = -1;
-
-       ui->InfoPanel.File = NULL;
-       ui->InfoPanelX = -1;
-       ui->InfoPanelY = -1;
-
-       ui->ButtonPanel.File = NULL;
-       ui->ButtonPanelX = -1;
-       ui->ButtonPanelY = -1;
-
-       ui->MenuPanel.File = NULL;
-       ui->MenuPanelX = -1;
-       ui->MenuPanelY = -1;
-
-       ui->MinimapPanel.File = NULL;
-       ui->MinimapPanelX = -1;
-       ui->MinimapPanelY = -1;
-       ui->MinimapTransparent = 0;
-
-       ui->MinimapPosX = -1;
-       ui->MinimapPosY = -1;
-       for (i = 0; i < MaxCosts + 2; ++i) {
-               ui->Resources[i].TextX = -1;
-       }
-       //
-       //              Parse the arguments, already the new tagged format.
-       //  maxy: this could be much simpler
-       //
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("normal-font-color"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->NormalFontColor = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("reverse-font-color"))) 
{
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->ReverseFontColor = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("filler"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->NumFillers++;
-                       ui->Filler = realloc(ui->Filler, ui->NumFillers * 
sizeof(*ui->Filler));
-                       ui->FillerX = realloc(ui->FillerX, ui->NumFillers * 
sizeof(*ui->FillerX));
-                       ui->FillerY = realloc(ui->FillerY, ui->NumFillers * 
sizeof(*ui->FillerY));
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("file"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->Filler[ui->NumFillers - 1].File = 
gh_scm2newstr(value, NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->FillerX[ui->NumFillers - 1] = 
gh_scm2int(gh_car(value));
-                                       ui->FillerY[ui->NumFillers - 1] = 
gh_scm2int(gh_car(gh_cdr(value)));
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("resource-line"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->Resource.File = SCM_PopNewStr(&sublist);
-                       ui->ResourceX = SCM_PopInt(&sublist);
-                       ui->ResourceY = SCM_PopInt(&sublist);
-               } else if (gh_eq_p(value, gh_symbol2scm("resources"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               SCM slist;
-                               int res;
-                               char* name;
-
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               name = gh_scm2newstr(value, NULL);
-                               for (res = 0; res < MaxCosts; ++res) {
-                                       if (!strcmp(name, 
DefaultResourceNames[res])) {
-                                               break;
-                                       }
-                               }
-                               if (res == MaxCosts) {
-                                       if (!strcmp(name, "food")) {
-                                               res = FoodCost;
-                                       } else if (!strcmp(name, "score")) {
-                                               res = ScoreCost;
-                                       } else {
-                                               errl("Resource not found", 
value);
-                                       }
-                               }
-                               free(name);
-                               slist = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               while (!gh_null_p(slist)) {
-                                       value = gh_car(slist);
-                                       slist = gh_cdr(slist);
-                                       if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               ui->Resources[res].IconX = 
gh_scm2int(gh_car(value));
-                                               ui->Resources[res].IconY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("file"))) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               ui->Resources[res].Icon.File = 
gh_scm2newstr(value, NULL);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("row"))) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               ui->Resources[res].IconRow = 
gh_scm2int(value);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               ui->Resources[res].IconW = 
gh_scm2int(gh_car(value));
-                                               ui->Resources[res].IconH = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("text-pos"))) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               ui->Resources[res].TextX = 
gh_scm2int(gh_car(value));
-                                               ui->Resources[res].TextY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                       } else {
-                                               errl("Unsupported tag", value);
-                                       }
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("info-panel"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("panel"))) {
-                                       SCM slist;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("file"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->InfoPanel.File = 
gh_scm2newstr(value, NULL);
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->InfoPanelX = 
gh_scm2int(gh_car(value));
-                                                       ui->InfoPanelY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->InfoPanelW = 
gh_scm2int(gh_car(value));
-                                                       ui->InfoPanelH = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else {
-                                                       errl("Unsupported tag", 
value);
-                                               }
-                                       }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("selected"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseSelected(value, ui);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("training"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseTraining(value, ui);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("upgrading"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseUpgrading(value, ui);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("researching"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseResearching(value, ui);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("transporting"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseTransporting(value, ui);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("completed-bar"))) {
-                                       SCM slist;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("color"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-#ifdef USE_SDL_SURFACE
-                                                       
ui->CompletedBarColorRGB.r = gh_scm2int(gh_car(value));
-                                                       
ui->CompletedBarColorRGB.g = gh_scm2int(gh_car(gh_cdr(value)));
-                                                       
ui->CompletedBarColorRGB.b = gh_scm2int(gh_car(gh_cdr(gh_cdr(value))));
-#else
-                                                       
ui->CompletedBarColorRGB.D24.a = gh_scm2int(gh_car(value));
-                                                       
ui->CompletedBarColorRGB.D24.b = gh_scm2int(gh_car(gh_cdr(value)));
-                                                       
ui->CompletedBarColorRGB.D24.c = gh_scm2int(gh_car(gh_cdr(gh_cdr(value))));
-#endif
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->CompletedBarX = 
gh_scm2int(gh_car(value));
-                                                       ui->CompletedBarY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->CompletedBarW = 
gh_scm2int(gh_car(value));
-                                                       ui->CompletedBarH = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("text"))) {
-                                                       InfoText text;
-
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       CclParseInfoText(value, 
&text);
-                                                       ui->CompletedBarText = 
text.Text;
-                                                       ui->CompletedBarFont = 
text.Font;
-                                                       ui->CompletedBarTextX = 
text.X;
-                                                       ui->CompletedBarTextY = 
text.Y;
-                                               } else {
-                                                       errl("Unsupported tag", 
value);
-                                               }
-                                       }
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("button-panel"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("panel"))) {
-                                       SCM slist;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("file"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->ButtonPanel.File = 
gh_scm2newstr(value, NULL);
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->ButtonPanelX = 
gh_scm2int(gh_car(value));
-                                                       ui->ButtonPanelY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else {
-                                                       errl("Unsupported tag", 
value);
-                                               }
-                                       }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("icons"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       CclParseButtonIcons(value, ui);
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("map-area"))) {
-                       int w;
-                       int h;
-
-                       w = 0;
-                       h = 0;
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("pos"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->MapArea.X = 
gh_scm2int(gh_car(value));
-                                       ui->MapArea.Y = 
gh_scm2int(gh_car(gh_cdr(value)));
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       w = gh_scm2int(gh_car(value));
-                                       h = gh_scm2int(gh_car(gh_cdr(value)));
-                                       DebugLevel3Fn("Map are size is %d %d\n" 
_C_ w _C_ h);
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-                       ui->MapArea.EndX = ui->MapArea.X + w - 1;
-                       ui->MapArea.EndY = ui->MapArea.Y + h - 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("menu-panel"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("panel"))) {
-                                       SCM slist;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("file"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->MenuPanel.File = 
gh_scm2newstr(value, NULL);
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->MenuPanelX = 
gh_scm2int(gh_car(value));
-                                                       ui->MenuPanelY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else {
-                                                       errl("Unsupported tag", 
value);
-                                               }
-                                       }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("menu-button"))) {
-                                       SCM slist;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->MenuButton.X = 
gh_scm2int(gh_car(value));
-                                                       ui->MenuButton.Y = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->MenuButton.Width = 
gh_scm2int(gh_car(value));
-                                                       ui->MenuButton.Height = 
gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("caption"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->MenuButton.Text = 
gh_scm2newstr(value, NULL);
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->MenuButton.Button = 
scm2buttonid(value);
-                                               } else {
-                                                       errl("Unsupported tag", 
value);
-                                               }
-                                       }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("network-menu-button"))) {
-                                       SCM slist;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       ui->NetworkMenuButton.X 
= gh_scm2int(gh_car(value));
-                                                       ui->NetworkMenuButton.Y 
= gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       
ui->NetworkMenuButton.Width = gh_scm2int(gh_car(value));
-                                                       
ui->NetworkMenuButton.Height = gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("caption"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       
ui->NetworkMenuButton.Text = gh_scm2newstr(value, NULL);
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       
ui->NetworkMenuButton.Button = scm2buttonid(value);
-                                               } else {
-                                                       errl("Unsupported tag", 
value);
-                                               }
-                                       }
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("network-diplomacy-button"))) {
-                                       SCM slist;
-
-                                       slist = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       while (!gh_null_p(slist)) {
-                                               value = gh_car(slist);
-                                               slist = gh_cdr(slist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       
ui->NetworkDiplomacyButton.X = gh_scm2int(gh_car(value));
-                                                       
ui->NetworkDiplomacyButton.Y = gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       
ui->NetworkDiplomacyButton.Width = gh_scm2int(gh_car(value));
-                                                       
ui->NetworkDiplomacyButton.Height = gh_scm2int(gh_car(gh_cdr(value)));
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("caption"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       
ui->NetworkDiplomacyButton.Text = gh_scm2newstr(value, NULL);
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-                                                       
ui->NetworkDiplomacyButton.Button = scm2buttonid(value);
-                                               } else {
-                                                       errl("Unsupported tag", 
value);
-                                               }
-                                       }
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("minimap"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("file"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->MinimapPanel.File = 
gh_scm2newstr(value, NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("panel-pos"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->MinimapPanelX = 
gh_scm2int(gh_car(value));
-                                       ui->MinimapPanelY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->MinimapPosX = 
gh_scm2int(gh_car(value));
-                                       ui->MinimapPosY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->MinimapW = 
gh_scm2int(gh_car(value));
-                                       ui->MinimapH = 
gh_scm2int(gh_car(gh_cdr(value)));
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("transparent"))) {
-                                       ui->MinimapTransparent = 1;
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("status-line"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("file"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->StatusLine.File = 
gh_scm2newstr(value, NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("pos"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->StatusLineX = 
gh_scm2int(gh_car(value));
-                                       ui->StatusLineY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("text-pos"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->StatusLineTextX = 
gh_scm2int(gh_car(value));
-                                       ui->StatusLineTextY = 
gh_scm2int(gh_car(gh_cdr(value)));
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("font"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->StatusLineFont = 
CclFontByIdentifier(value);
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("cursors"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, gh_symbol2scm("point"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->Point.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("glass"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->Glass.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("cross"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->Cross.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("yellow"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->YellowHair.Name = 
gh_scm2newstr(value, NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("green"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->GreenHair.Name = 
gh_scm2newstr(value, NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("red"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->RedHair.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("scroll"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->Scroll.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("arrow-e"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->ArrowE.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("arrow-ne"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->ArrowNE.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("arrow-n"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->ArrowN.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("arrow-nw"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->ArrowNW.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("arrow-w"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->ArrowW.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("arrow-sw"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->ArrowSW.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("arrow-s"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->ArrowS.Name = gh_scm2newstr(value, 
NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("arrow-se"))) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-                                       ui->ArrowSE.Name = gh_scm2newstr(value, 
NULL);
-                               } else {
-                                       errl("Unsupported tag", value);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("menu-panels"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               MenuPanel** menupanel;
-
-                               menupanel = &ui->MenuPanels;
-                               while (*menupanel) {
-                                       menupanel = &(*menupanel)->Next;
-                               }
-                               *menupanel = calloc(1, sizeof(**menupanel));
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               (*menupanel)->Ident = gh_scm2newstr(value, 
NULL);
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               (*menupanel)->Panel.File = gh_scm2newstr(value, 
NULL);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("victory-background"))) 
{
-                       //              Backgrounds
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->VictoryBackground.File = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("defeat-background"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ui->DefeatBackground.File = gh_scm2newstr(value, NULL);
-               } else {
-                       s1 = gh_scm2newstr(value, NULL);
-                       fprintf(stderr, "Unsupported tag %s\n", s1);
-                       free(s1);
-               }
-       }
 
-       return SCM_UNSPECIFIED;
+/**
+**             Parse button panel icons section
+*/
+local void CclParseButtonIcons(lua_State* l, UI* ui)
+{
+       int i;
+
+       ui->NumButtonButtons = luaL_getn(l, -1);
+       ui->ButtonButtons = calloc(ui->NumButtonButtons, sizeof(Button));
+       for (i = 0; i < ui->NumButtonButtons; ++i) {
+               lua_rawgeti(l, -1, i + 1);
+               CclParseIcon(l, &ui->ButtonButtons[i]);
+               lua_pop(l, 1);
+       }
 }
-#elif defined(USE_LUA)
+
+/**
+**             Define the look+feel of the user interface.
+**
+**             FIXME: need some general data structure to make this parsing 
easier.
+**             FIXME: use the new tagged config format.
+*/
 local int CclDefineUI(lua_State* l)
 {
        const char* value;
@@ -3800,49 +2238,15 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define the viewports.
 **
 **             @param list             List of the viewports.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineViewports(SCM list)
-{
-       SCM value;
-       SCM sublist;
-       UI* ui;
-       int i;
-
-       i = 0;
-       ui = &TheUI;
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("mode"))) {
-                       ui->ViewportMode = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("viewport"))) {
-                       sublist = gh_car(list);
-                       ui->Viewports[i].MapX = gh_scm2int(gh_car(sublist));
-                       sublist = gh_cdr(sublist);
-                       ui->Viewports[i].MapY = gh_scm2int(gh_car(sublist));
-                       ++i;
-                       list = gh_cdr(list);
-               } else {
-                       errl("Unsupported tag", value);
-               }
-       }
-       ui->NumViewports = i;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineViewports(lua_State* l)
 {
        const char* value;
-//     SCM sublist;
        UI* ui;
        int i;
        int args;
@@ -3877,7 +2281,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable/disable scrolling with the mouse.
@@ -3885,17 +2288,6 @@
 **             @param flag             True = turn on, false = off.
 **             @return                         The old state of scrolling.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMouseScroll(SCM flag)
-{
-       int old;
-
-       old = TheUI.MouseScroll;
-       TheUI.MouseScroll = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetMouseScroll(lua_State* l)
 {
        int old;
@@ -3910,7 +2302,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set speed of mouse scrolling
@@ -3918,22 +2309,6 @@
 **             @param num              Mouse scroll speed in frames.
 **             @return                         old scroll speed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetMouseScrollSpeed(SCM num)
-{
-       int speed;
-       int old;
-
-       old = SpeedMouseScroll;
-       speed = gh_scm2int(num);
-       if (speed < 1 || speed > FRAMES_PER_SECOND) {
-               SpeedMouseScroll = MOUSE_SCROLL_SPEED;
-       } else {
-               SpeedMouseScroll = speed;
-       }
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetMouseScrollSpeed(lua_State* l)
 {
        int speed;
@@ -3954,7 +2329,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Enable/disable grabbing the mouse.
@@ -3962,19 +2336,6 @@
 **             @param flag             True = grab on, false = grab off.
 **             @return                         FIXME: not supported: The old 
state of grabbing.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGrabMouse(SCM flag)
-{
-       if (gh_scm2bool(flag)) {
-               ToggleGrabMouse(1);
-       } else {
-               ToggleGrabMouse(-1);
-       }
-
-       //return gh_bool2scm(old);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetGrabMouse(lua_State* l)
 {
        if (lua_gettop(l) != 1 || !lua_isboolean(l, 1)) {
@@ -3989,7 +2350,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable/disable leaving the window stops scrolling.
@@ -3997,17 +2357,6 @@
 **             @param flag             True = stop on, false = stop off.
 **             @return                         The old state of stopping.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetLeaveStops(SCM flag)
-{
-       int old;
-
-       old = LeaveStops;
-       LeaveStops = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetLeaveStops(lua_State* l)
 {
        int old;
@@ -4022,7 +2371,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Enable/disable scrolling with the keyboard.
@@ -4030,17 +2378,6 @@
 **             @param flag             True = turn on, false = off.
 **             @return                         The old state of scrolling.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetKeyScroll(SCM flag)
-{
-       int old;
-
-       old = TheUI.KeyScroll;
-       TheUI.KeyScroll = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetKeyScroll(lua_State* l)
 {
        int old;
@@ -4055,7 +2392,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set speed of keyboard scrolling
@@ -4063,22 +2399,6 @@
 **             @param num              Keyboard scroll speed in frames.
 **             @return                         old scroll speed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetKeyScrollSpeed(SCM num)
-{
-       int speed;
-       int old;
-
-       old = SpeedKeyScroll;
-       speed = gh_scm2int(num);
-       if (speed < 1 || speed > FRAMES_PER_SECOND) {
-               SpeedKeyScroll = KEY_SCROLL_SPEED;
-       } else {
-               SpeedKeyScroll = speed;
-       }
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetKeyScrollSpeed(lua_State* l)
 {
        int speed;
@@ -4099,7 +2419,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Enable/disable display of command keys in panels.
@@ -4107,18 +2426,6 @@
 **             @param flag             True = turn on, false = off.
 **             @return                         The old state of scrolling.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetShowCommandKey(SCM flag)
-{
-       int old;
-
-       old = ShowCommandKey;
-       ShowCommandKey = gh_scm2bool(flag);
-       UpdateButtonPanel();
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetShowCommandKey(lua_State* l)
 {
        int old;
@@ -4134,19 +2441,10 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Fighter right button attacks as default.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclRightButtonAttacks(void)
-{
-       RightButtonAttacks = 1;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclRightButtonAttacks(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -4157,19 +2455,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Fighter right button moves as default.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclRightButtonMoves(void)
-{
-       RightButtonAttacks = 0;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclRightButtonMoves(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -4180,219 +2469,35 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable/disable the fancy buildings.
 **
 **             @param flag             True = turn on, false = off.
 **             @return                         The old state of fancy 
buildings flag.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetFancyBuildings(SCM flag)
-{
-       int old;
-
-       old = FancyBuildings;
-       FancyBuildings = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
-local int CclSetFancyBuildings(lua_State* l)
-{
-       int old;
-
-       if (lua_gettop(l) != 1) {
-               lua_pushstring(l, "incorrect argument");
-               lua_error(l);
-       }
-       old = FancyBuildings;
-       FancyBuildings = LuaToBoolean(l, 1);
-
-       lua_pushnumber(l, old);
-       return 1;
-}
-#endif
-
-/**
-**             Define a menu
-**
-**             FIXME: need some general data structure to make this parsing 
easier.
-**
-**             @param list             List describing the menu.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineMenu(SCM list)
-{
-       SCM value;
-       Menu* menu;
-       Menu item;
-       char* name;
-       char* s1;
-       void** func;
-
-       DebugLevel3Fn("Define menu\n");
-
-       name = NULL;
-       TheUI.Offset640X = (VideoWidth - 640) / 2;
-       TheUI.Offset480Y = (VideoHeight - 480) / 2;
-
-       //
-       //              Parse the arguments, already the new tagged format.
-       //
-       memset(&item, 0, sizeof(Menu));
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("geometry"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-
-                       item.X = gh_scm2int(gh_car(value));
-                       value = gh_cdr(value);
-                       item.Y = gh_scm2int(gh_car(value));
-                       value = gh_cdr(value);
-                       item.Width = gh_scm2int(gh_car(value));
-                       value = gh_cdr(value);
-                       item.Height = gh_scm2int(gh_car(value));
-
-               } else if (gh_eq_p(value, gh_symbol2scm("name"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       name = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("panel"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (!gh_eq_p(value, gh_symbol2scm("none"))) {
-                               item.Panel = gh_scm2newstr(value, NULL);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("default"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       item.DefSel = gh_scm2int(value);
-/*
-               } else if (gh_eq_p(value, gh_symbol2scm("nitems"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       item.nitems = gh_scm2int(value);
-*/
-               } else if (gh_eq_p(value, gh_symbol2scm("netaction"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       s1 = gh_scm2newstr(value, NULL);
-                       func = (void**)hash_find(MenuFuncHash, s1);
-                       if (func != NULL) {
-                               item.NetAction = (void*)*func;
-                       } else {
-                               fprintf(stderr, "Can't find function: %s\n", 
s1);
-                       }
-                       free(s1);
-               } else {
-                       s1 = gh_scm2newstr(value, NULL);
-                       fprintf(stderr, "Unsupported tag %s\n", s1);
-                       free(s1);
-               }
-       }
-
-       if (name) {
-               menu = FindMenu(name);
-               if (!menu) {
-                       menu = malloc(sizeof(Menu));
-                       *(Menu**)hash_add(MenuHash, name) = menu;
-               } else {
-                       int i;
-                       int mitype;
-
-                       free(menu->Panel);
-                       for (i = 0; i < menu->NumItems; ++i) {
-                               mitype = menu->Items[i].mitype;
-                               if (mitype == MI_TYPE_TEXT) {
-                                       if (menu->Items[i].d.text.text) {
-                                               
free(menu->Items[i].d.text.text);
-                                       }
-                                       if (menu->Items[i].d.text.normalcolor) {
-                                               
free(menu->Items[i].d.text.normalcolor);
-                                       }
-                                       if (menu->Items[i].d.text.reversecolor) 
{
-                                               
free(menu->Items[i].d.text.normalcolor);
-                                       }
-                               } else if (mitype == MI_TYPE_BUTTON) {
-                                       if (menu->Items[i].d.button.text) {
-                                               
free(menu->Items[i].d.button.text);
-                                       }
-                                       if 
(menu->Items[i].d.button.normalcolor) {
-                                               
free(menu->Items[i].d.button.normalcolor);
-                                       }
-                                       if 
(menu->Items[i].d.button.reversecolor) {
-                                               
free(menu->Items[i].d.button.normalcolor);
-                                       }
-                               } else if (mitype == MI_TYPE_PULLDOWN) {
-                                       int j;
-                                       j = 
menu->Items[i].d.pulldown.noptions-1;
-                                       for (; j >= 0; --j) {
-                                               
free(menu->Items[i].d.pulldown.options[j]);
-                                       }
-                                       free(menu->Items[i].d.pulldown.options);
-                                       if 
(menu->Items[i].d.pulldown.normalcolor) {
-                                               
free(menu->Items[i].d.pulldown.normalcolor);
-                                       }
-                                       if 
(menu->Items[i].d.pulldown.reversecolor) {
-                                               
free(menu->Items[i].d.pulldown.normalcolor);
-                                       }
-                               } else if (mitype == MI_TYPE_LISTBOX) {
-                                       if 
(menu->Items[i].d.listbox.normalcolor) {
-                                               
free(menu->Items[i].d.listbox.normalcolor);
-                                       }
-                                       if 
(menu->Items[i].d.listbox.reversecolor) {
-                                               
free(menu->Items[i].d.listbox.normalcolor);
-                                       }
-                               } else if (mitype == MI_TYPE_INPUT) {
-                                       if (menu->Items[i].d.input.normalcolor) 
{
-                                               
free(menu->Items[i].d.input.normalcolor);
-                                       }
-                                       if 
(menu->Items[i].d.input.reversecolor) {
-                                               
free(menu->Items[i].d.input.normalcolor);
-                                       }
-                               } else if (mitype == MI_TYPE_GEM) {
-                                       if (menu->Items[i].d.gem.normalcolor) {
-                                               
free(menu->Items[i].d.gem.normalcolor);
-                                       }
-                                       if (menu->Items[i].d.gem.reversecolor) {
-                                               
free(menu->Items[i].d.gem.normalcolor);
-                                       }
-                               }
-                       }
-                       free(menu->Items);
-                       menu->Items = NULL;
-               }
-               menu->NumItems = 0; // reset to zero
-               memcpy(menu, &item, sizeof(Menu));
-               //move the buttons for different resolutions..
-               if (VideoWidth != 640) {
-                       if (VideoWidth == 0) {
-                               if (DEFAULT_VIDEO_WIDTH != 640) {
-                                       menu->X += (DEFAULT_VIDEO_WIDTH - 640) 
/ 2;
-                               }
-                               if (DEFAULT_VIDEO_HEIGHT != 480) {
-                                       menu->Y += (DEFAULT_VIDEO_HEIGHT - 480) 
/ 2;
-                               }
-                       } else {
-                               //printf("VideoWidth = %d\n", VideoWidth);
-                               menu->X += TheUI.Offset640X;
-                               menu->Y += TheUI.Offset480Y;
-                       }
-               }
-               //printf("Me:%s\n", name);
-               free(name);
-       } else {
-               fprintf(stderr, "Name of menu is missed, skip definition\n");
+*/
+local int CclSetFancyBuildings(lua_State* l)
+{
+       int old;
+
+       if (lua_gettop(l) != 1) {
+               lua_pushstring(l, "incorrect argument");
+               lua_error(l);
        }
+       old = FancyBuildings;
+       FancyBuildings = LuaToBoolean(l, 1);
 
-       return SCM_UNSPECIFIED;
+       lua_pushnumber(l, old);
+       return 1;
 }
-#elif defined(USE_LUA)
+
+/**
+**             Define a menu
+**
+**             FIXME: need some general data structure to make this parsing 
easier.
+**
+**             @param list             List describing the menu.
+*/
 local int CclDefineMenu(lua_State* l)
 {
        const char* value;
@@ -4559,58 +2664,7 @@
 
        return 0;
 }
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local int scm2hotkey(SCM value)
-{
-       char* s;
-       int l;
-       int key;
-       int f;
-
-       key = 0;
-       s = gh_scm2newstr(value, NULL);
-       l = strlen(s);
-
-       if (l == 0) {
-               key = 0;
-       } else if (l == 1) {
-               key = s[0];
-       } else if (!strcmp(s, "esc")) {
-               key = 27;
-       } else if (s[0] == 'f' && l > 1 && l < 4) {
-               f = atoi(s + 1);
-               if (f > 0 && f < 13) {
-                       key = KeyCodeF1 + f - 1; // if key-order in 
include/interface.h is linear
-               } else {
-                       printf("Unknown key '%s'\n", s);
-               }
-       } else {
-               printf("Unknown key '%s'\n", s);
-       }
-       free(s);
-       return key;
-}
-
-local int scm2style(SCM value)
-{
-       int id;
 
-       if (gh_eq_p(value, gh_symbol2scm("sc-vslider"))) {
-               id = MI_STYLE_SC_VSLIDER;
-       } else if (gh_eq_p(value, gh_symbol2scm("sc-hslider"))) {
-               id = MI_STYLE_SC_HSLIDER;
-       } else {
-               char* s1;
-               s1 = gh_scm2newstr(value, NULL);
-               fprintf(stderr, "Unsupported style %s\n", s1);
-               free(s1);
-               return 0;
-       }
-       return id;
-}
-#elif defined(USE_LUA)
 local int scm2hotkey(lua_State* l, const char* value)
 {
        int len;
@@ -4656,637 +2710,10 @@
        }
        return id;
 }
-#endif
-
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineMenuItem(SCM list)
-{
-       SCM value;
-       SCM sublist;
-       char* s1;
-       char* name;
-       Menuitem *item;
-       Menu** tmp;
-       Menu* menu;
-       void** func;
-
-       DebugLevel3Fn("Define menu-item\n");
-
-       name = NULL;
-       item = (Menuitem*)calloc(1, sizeof(Menuitem));
-
-       //
-       //              Parse the arguments, already the new tagged format.
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("pos"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-
-                       item->xofs = gh_scm2int(gh_car(value));
-                       value = gh_cdr(value);
-                       item->yofs = gh_scm2int(gh_car(value));
-               } else if (gh_eq_p(value, gh_symbol2scm("transparent"))) {
-                       item->transparent = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("menu"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       name = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("flags"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-
-                       while (!gh_null_p(sublist)) {
-
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               if (gh_eq_p(value, gh_symbol2scm("active"))) {
-                                       item->flags |= MenuButtonActive;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("clicked"))) {
-                                       item->flags |= MenuButtonClicked;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("selected"))) {
-                                       item->flags |= MenuButtonSelected;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("disabled"))) {
-                                       item->flags |= MenuButtonDisabled;
-                               } else {
-                                       s1 = gh_scm2newstr(gh_car(value), NULL);
-                                       fprintf(stderr, "Unknown flag %s\n", 
s1);
-                                       free(s1);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("font"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       item->font = CclFontByIdentifier(value);
-               } else if (gh_eq_p(value, gh_symbol2scm("init"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-
-                       s1 = gh_scm2newstr(value, NULL);
-                       func = (void**)hash_find(MenuFuncHash, s1);
-                       if (func != NULL) {
-                               item->initfunc = (void*)*func;
-                       } else {
-                               fprintf(stderr, "Can't find function: %s\n", 
s1);
-                       }
-                       free(s1);
-               } else if (gh_eq_p(value, gh_symbol2scm("exit"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-
-                       s1 = gh_scm2newstr(value, NULL);
-                       func = (void**)hash_find(MenuFuncHash, s1);
-                       if (func != NULL) {
-                               item->exitfunc=(void*)*func;
-                       } else {
-                               fprintf(stderr, "Can't find function: %s\n", 
s1);
-                       }
-                       free(s1);
-/* Menu types */
-               } else if (!item->mitype) {
-                       if (gh_eq_p(value, gh_symbol2scm("text"))) {
-                               sublist = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype = MI_TYPE_TEXT;
-                               item->d.text.text = NULL;
-
-                               while (!gh_null_p(sublist)) {
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("align"))) {
-                                               value = gh_car(sublist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("left"))) {
-                                                       item->d.text.align = 
MI_TFLAGS_LALIGN;
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("right"))) {
-                                                       item->d.text.align = 
MI_TFLAGS_RALIGN;
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("center"))) {
-                                                       item->d.text.align = 
MI_TFLAGS_CENTERED;
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("caption"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       item->d.text.text = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("func"))) {
-                                               value = gh_car(sublist);
-                                                       s1 = 
gh_scm2newstr(value, NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                               
item->d.text.action = (void*)*func;
-                                               } else {
-                                                               fprintf(stderr, 
"Can't find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-normal"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.text.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-reverse"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.text.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else {
-                                               //s1 = gh_scm2newstr(value, 
NULL);
-                                               //fprintf(stderr, "Unsupported 
property %s\n", s1);
-                                               //free(s1);
-                                       }
-                               }
-                       } else if (gh_eq_p(value, gh_symbol2scm("button"))) {
-                               sublist = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype = MI_TYPE_BUTTON;
-
-                               while (!gh_null_p(sublist)) {
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                               item->d.button.xsize = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                               value = gh_cdr(gh_car(sublist));
-                                               item->d.button.ysize = 
gh_scm2int(gh_car(value));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("caption"))) {
-                                               item->d.button.text = NULL;
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       item->d.button.text = 
gh_scm2newstr(
-                                                               
gh_car(sublist), NULL);
-                                               }
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("hotkey"))) {
-                                               item->d.button.hotkey = 
scm2hotkey(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("func"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               
//item->d.button.handler=hash_mini_get(MenuHndlrHash, s1);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.button.handler 
= (void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                               value = gh_car(sublist);
-                                               item->d.button.button = 
scm2buttonid(value);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-normal"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.button.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-reverse"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.button.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else {
-                                               //s1 = gh_scm2newstr(value, 
NULL);
-                                               //fprintf(stderr, "Unsupported 
property %s\n", s1);
-                                               //free(s1);
-                                       }
-                               }
-                       } else if (gh_eq_p(value, gh_symbol2scm("pulldown"))) {
-                               sublist = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype=MI_TYPE_PULLDOWN;
-
-                               while (!gh_null_p(sublist)) {
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                               item->d.pulldown.xsize = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                               value = gh_cdr(gh_car(sublist));
-                                               item->d.pulldown.ysize = 
gh_scm2int(gh_car(value));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("options"))) {
-                                               value = gh_car(sublist);
-                                               if (gh_list_p(value)) {
-                                                       int n;
-                                                       int i;
-
-                                                       n = 
item->d.pulldown.noptions = gh_length(value);
-                                                       if 
(item->d.pulldown.options) {
-                                                                       
free(item->d.pulldown.options);
-                                                       }
-                                                       
item->d.pulldown.options = (unsigned char**)malloc(sizeof(unsigned char*)*n);
-                                                       for (i = 0; i < n; ++i) 
{
-                                                               
item->d.pulldown.options[i] = gh_scm2newstr(gh_car(value), NULL);
-                                                               value = 
gh_cdr(value);
-                                                       }
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("func"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.pulldown.action 
= (void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                               value = gh_car(sublist);
-                                               item->d.pulldown.button = 
scm2buttonid(value);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("state"))) {
-                                               value = gh_car(sublist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("passive"))) {
-                                                       item->d.pulldown.state 
= MI_PSTATE_PASSIVE;
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("default"))) {
-                                               item->d.pulldown.defopt = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("current"))) {
-                                               item->d.pulldown.curopt = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-normal"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.pulldown.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-reverse"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.pulldown.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else {
-                                               //s1 = gh_scm2newstr(value, 
NULL);
-                                               //fprintf(stderr, "Unsupported 
property %s\n", s1);
-                                               //free(s1);
-                                       }
-                               }
-                       } else if (gh_eq_p(value, gh_symbol2scm("listbox"))) {
-                               sublist = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype = MI_TYPE_LISTBOX;
-
-                               while (!gh_null_p(sublist)) {
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                               item->d.listbox.xsize = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                               value = gh_cdr(gh_car(sublist));
-                                               item->d.listbox.ysize = 
gh_scm2int(gh_car(value));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("func"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.listbox.action 
= (void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("handler"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.listbox.handler 
= (void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("retopt"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       
item->d.listbox.retrieveopt = (void*)(*func);
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                               value = gh_car(sublist);
-                                               item->d.listbox.button = 
scm2buttonid(value);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("default"))) {
-                                               item->d.listbox.defopt = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("startline"))) {
-                                               item->d.listbox.startline = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("nlines"))) {
-                                               item->d.listbox.nlines = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("current"))) {
-                                               item->d.listbox.curopt = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-normal"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.listbox.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-reverse"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.listbox.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else {
-                                               //s1 = gh_scm2newstr(value, 
NULL);
-                                               //fprintf(stderr, "Unsupported 
property %s\n", s1);
-                                               //free(s1);
-                                       }
-                               }
-                       } else if (gh_eq_p(value, gh_symbol2scm("vslider"))) {
-                               sublist = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype = MI_TYPE_VSLIDER;
-                               item->d.vslider.defper = -1;
-
-                               while (!gh_null_p(sublist)) {
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                               item->d.vslider.xsize = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                               value = gh_cdr(gh_car(sublist));
-                                               item->d.vslider.ysize = 
gh_scm2int(gh_car(value));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("flags"))) {
-                                               SCM slist;
-
-                                               slist = gh_car(sublist);
-                                               while (!gh_null_p(slist)) {
-
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-
-                                                       if (gh_eq_p(value, 
gh_symbol2scm("up"))) {
-                                                               
item->d.vslider.cflags |= MI_CFLAGS_UP;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("down"))) {
-                                                               
item->d.vslider.cflags |= MI_CFLAGS_DOWN;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("left"))) {
-                                                               
item->d.vslider.cflags |= MI_CFLAGS_LEFT;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("right"))) {
-                                                               
item->d.vslider.cflags |= MI_CFLAGS_RIGHT;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("knob"))) {
-                                                               
item->d.vslider.cflags |= MI_CFLAGS_KNOB;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("cont"))) {
-                                                               
item->d.vslider.cflags |= MI_CFLAGS_CONT;
-                                                       } else {
-                                                               s1 = 
gh_scm2newstr(gh_car(value), NULL);
-                                                               fprintf(stderr, 
"Unknown flag %s\n", s1);
-                                                               free(s1);
-                                                       }
-                                               }
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("func"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.vslider.action 
= (void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("handler"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.vslider.handler 
= (void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("default"))) {
-                                               item->d.vslider.defper = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("current"))) {
-                                               item->d.vslider.percent = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                               value = gh_car(sublist);
-                                               item->d.vslider.style = 
scm2style(value);
-                                       } else {
-                                               //s1 = gh_scm2newstr(value, 
NULL);
-                                               //fprintf(stderr, "Unsupported 
property %s\n", s1);
-                                               //free(s1);
-                                       }
-                               }
-                       } else if (gh_eq_p(value, gh_symbol2scm("drawfunc"))) {
-                               value = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype = MI_TYPE_DRAWFUNC;
-
-                               s1 = gh_scm2newstr(value, NULL);
-                               func = (void**)hash_find(MenuFuncHash, s1);
-                               if (func != NULL) {
-                                       item->d.drawfunc.draw = (void*)*func;
-                               } else {
-                                       fprintf(stderr, "Can't find function: 
%s\n", s1);
-                               }
-                               free(s1);
-                       } else if (gh_eq_p(value, gh_symbol2scm("input"))) {
-                               sublist = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype = MI_TYPE_INPUT;
-
-                               while (!gh_null_p(sublist)) {
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                               item->d.input.xsize = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                               value = gh_cdr(gh_car(sublist));
-                                               item->d.input.ysize = 
gh_scm2int(gh_car(value));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("func"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.input.action = 
(void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                               value = gh_car(sublist);
-                                               item->d.input.button = 
scm2buttonid(value);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("maxch"))) {
-                                               value = gh_car(sublist);
-                                               item->d.input.maxch = 
gh_scm2int(value);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-normal"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.input.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-reverse"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.input.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else {
-                                               //s1 = gh_scm2newstr(value, 
NULL);
-                                               //fprintf(stderr, "Unsupported 
property %s\n", s1);
-                                               //free(s1);
-                                       }
-                               }
-                       } else if (gh_eq_p(value, gh_symbol2scm("gem"))) {
-                               sublist = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype = MI_TYPE_GEM;
-
-                               while (!gh_null_p(sublist)) {
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                               item->d.gem.xsize = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                               value = gh_cdr(gh_car(sublist));
-                                               item->d.gem.ysize = 
gh_scm2int(gh_car(value));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("state"))) {
-                                               value = gh_car(sublist);
-                                               if (gh_eq_p(value, 
gh_symbol2scm("unchecked"))) {
-                                                       item->d.gem.state = 
MI_GSTATE_UNCHECKED;
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("passive"))) {
-                                                       item->d.gem.state = 
MI_GSTATE_PASSIVE;
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("invisible"))) {
-                                                       item->d.gem.state = 
MI_GSTATE_INVISIBLE;
-                                               } else if (gh_eq_p(value, 
gh_symbol2scm("checked"))) {
-                                                       item->d.gem.state = 
MI_GSTATE_CHECKED;
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("func"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.gem.action = 
(void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                               value = gh_car(sublist);
-                                               item->d.gem.button = 
scm2buttonid(value);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("text"))) {
-                                               value = gh_car(sublist);
-                                               item->d.gem.text = 
gh_scm2newstr(value, NULL);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-normal"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       item->d.gem.normalcolor 
= gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("color-reverse"))) {
-                                               if 
(!gh_null_p(gh_car(sublist))) {
-                                                       
item->d.gem.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
-                                               }
-                                       } else {
-                                               //s1 = gh_scm2newstr(value, 
NULL);
-                                               //fprintf(stderr, "Unsupported 
property %s\n", s1);
-                                               //free(s1);
-                                       }
-                               }
-                       } else if (gh_eq_p(value, gh_symbol2scm("hslider"))) {
-                               sublist = gh_car(list);
-                               list = gh_cdr(list);
-                               item->mitype = MI_TYPE_HSLIDER;
-                               item->d.hslider.defper = -1;
-
-                               while (!gh_null_p(sublist)) {
-
-                                       value = gh_car(sublist);
-                                       sublist = gh_cdr(sublist);
-
-                                       if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                               item->d.hslider.xsize = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                               value = gh_cdr(gh_car(sublist));
-                                               item->d.hslider.ysize = 
gh_scm2int(gh_car(value));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("flags"))) {
-                                               SCM slist;
-
-                                               slist = gh_car(sublist);
-                                               while (!gh_null_p(slist)) {
-
-                                                       value = gh_car(slist);
-                                                       slist = gh_cdr(slist);
-
-                                                       if (gh_eq_p(value, 
gh_symbol2scm("up"))) {
-                                                               
item->d.hslider.cflags |= MI_CFLAGS_UP;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("down"))) {
-                                                               
item->d.hslider.cflags |= MI_CFLAGS_DOWN;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("left"))) {
-                                                               
item->d.hslider.cflags |= MI_CFLAGS_LEFT;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("right"))) {
-                                                               
item->d.hslider.cflags |= MI_CFLAGS_RIGHT;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("knob"))) {
-                                                               
item->d.hslider.cflags |= MI_CFLAGS_KNOB;
-                                                       } else if 
(gh_eq_p(value, gh_symbol2scm("cont"))) {
-                                                               
item->d.hslider.cflags |= MI_CFLAGS_CONT;
-                                                       } else {
-                                                               s1 = 
gh_scm2newstr(gh_car(value), NULL);
-                                                               fprintf(stderr, 
"Unknown flag %s\n",s1);
-                                                               free(s1);
-                                                       }
-                                               }
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("func"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.hslider.action 
= (void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("handler"))) {
-                                                       s1 = 
gh_scm2newstr(gh_car(sublist), NULL);
-                                               func = 
(void**)hash_find(MenuFuncHash, s1);
-                                               if (func != NULL) {
-                                                       item->d.hslider.handler 
= (void*)*func;
-                                               } else {
-                                                       fprintf(stderr, "Can't 
find function: %s\n", s1);
-                                               }
-                                               free(s1);
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("default"))) {
-                                               item->d.hslider.defper = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("current"))) {
-                                               item->d.hslider.percent = 
gh_scm2int(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                       } else if (gh_eq_p(value, 
gh_symbol2scm("style"))) {
-                                               value = gh_car(sublist);
-                                               item->d.hslider.style = 
scm2style(value);
-                                       } else {
-                                               //s1 = gh_scm2newstr(value, 
NULL);
-                                               //fprintf(stderr, "Unsupported 
property %s\n", s1);
-                                               //free(s1);
-                                       }
-                               }
-                       }
-               } else {
-                       s1 = gh_scm2newstr(value, NULL);
-                       fprintf(stderr, "Unsupported tag %s\n", s1);
-                       free(s1);
-               }
-       }
-
-       if ((tmp = (Menu**)hash_find(MenuHash, name))) {
-               menu = *tmp;
-               if (menu->Items) {
-                       menu->Items = (Menuitem*)realloc(menu->Items, 
sizeof(Menuitem) * (menu->NumItems + 1));
-               } else {
-                       menu->Items = (Menuitem*)malloc(sizeof(Menuitem));
-               }
-               item->menu = menu;
-               memcpy(menu->Items + menu->NumItems, item, sizeof(Menuitem));
-               menu->NumItems++;
-       }
-       free(name);
-       free(item);
 
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
+/**
+**  FIXME: docu
+*/
 local int CclDefineMenuItem(lua_State* l)
 {
        const char* value;
@@ -6246,51 +3673,14 @@
        free(item);
 
 
-       return 0;
-}
-#endif
-
-/**
-**             Define menu graphics
-**
-**             @param list             List describing the menu.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineMenuGraphics(SCM list)
-{
-       SCM sublist;
-       SCM value;
-       int i;
-
-       i = 0;
-       while (!gh_null_p(list)) {
-               sublist = gh_car(list);
-               list = gh_cdr(list);
-               while (!gh_null_p(sublist)) {
-                       value = gh_car(sublist);
-                       sublist = gh_cdr(sublist);
-                       if (gh_eq_p(value, gh_symbol2scm("file"))) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (MenuButtonGfx.File[i]) {
-                                       free(MenuButtonGfx.File[i]);
-                               }
-                               MenuButtonGfx.File[i] = gh_scm2newstr(value, 
NULL);
-                       } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
-                               SCM sublist2;
-
-                               sublist2 = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               MenuButtonGfx.Width[i] = 
gh_scm2int(gh_car(sublist2));
-                               sublist2 = gh_cdr(sublist2);
-                               MenuButtonGfx.Height[i] = 
gh_scm2int(gh_car(sublist2));
-                       }
-               }
-               ++i;
-       }
-       return SCM_UNSPECIFIED;
+       return 0;
 }
-#elif defined(USE_LUA)
+
+/**
+**             Define menu graphics
+**
+**             @param list             List describing the menu.
+*/
 local int CclDefineMenuGraphics(lua_State* l)
 {
        int i;
@@ -6352,7 +3742,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define a button.
@@ -6361,193 +3750,6 @@
 **
 **             @param list             List describing the button.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineButton(SCM list)
-{
-       char buf[64];
-       SCM value;
-       char* s1;
-       char* s2;
-       ButtonAction ba;
-
-       DebugLevel3Fn("Define button\n");
-
-       memset(&ba, 0, sizeof(ba));
-       //
-       //              Parse the arguments
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("pos"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ba.Pos = gh_scm2int(value);
-               } else if (gh_eq_p(value, gh_symbol2scm("level"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ba.Level = gh_scm2int(value);
-               } else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ba.Icon.Name = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("action"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("move"))) {
-                               ba.Action = ButtonMove;
-                       } else if (gh_eq_p(value, gh_symbol2scm("stop"))) {
-                               ba.Action = ButtonStop;
-                       } else if (gh_eq_p(value, gh_symbol2scm("attack"))) {
-                               ba.Action = ButtonAttack;
-                       } else if (gh_eq_p(value, gh_symbol2scm("repair"))) {
-                               ba.Action = ButtonRepair;
-                       } else if (gh_eq_p(value, gh_symbol2scm("harvest"))) {
-                               ba.Action = ButtonHarvest;
-                       } else if (gh_eq_p(value, gh_symbol2scm("button"))) {
-                               ba.Action = ButtonButton;
-                       } else if (gh_eq_p(value, gh_symbol2scm("build"))) {
-                               ba.Action = ButtonBuild;
-                       } else if (gh_eq_p(value, gh_symbol2scm("train-unit"))) 
{
-                               ba.Action = ButtonTrain;
-                       } else if (gh_eq_p(value, gh_symbol2scm("patrol"))) {
-                               ba.Action = ButtonPatrol;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("stand-ground"))) {
-                               ba.Action = ButtonStandGround;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("attack-ground"))) {
-                               ba.Action = ButtonAttackGround;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("return-goods"))) {
-                               ba.Action = ButtonReturn;
-                       } else if (gh_eq_p(value, gh_symbol2scm("cast-spell"))) 
{
-                               ba.Action = ButtonSpellCast;
-                       } else if (gh_eq_p(value, gh_symbol2scm("research"))) {
-                               ba.Action = ButtonResearch;
-                       } else if (gh_eq_p(value, gh_symbol2scm("upgrade-to"))) 
{
-                               ba.Action = ButtonUpgradeTo;
-                       } else if (gh_eq_p(value, gh_symbol2scm("unload"))) {
-                               ba.Action = ButtonUnload;
-                       } else if (gh_eq_p(value, gh_symbol2scm("cancel"))) {
-                               ba.Action = ButtonCancel;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("cancel-upgrade"))) {
-                               ba.Action = ButtonCancelUpgrade;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("cancel-train-unit"))) {
-                               ba.Action = ButtonCancelTrain;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("cancel-build"))) {
-                               ba.Action = ButtonCancelBuild;
-                       } else {
-                               errl("Unsupported button action ",value);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("value"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_exact_p(value)) {
-                               sprintf(buf, "%ld", gh_scm2long(value));
-                               s1 = strdup(buf);
-                       } else {
-                               s1 = gh_scm2newstr(value, NULL);
-                       }
-                       ba.ValueStr = s1;
-               } else if (gh_eq_p(value, gh_symbol2scm("allowed"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_eq_p(value, gh_symbol2scm("check-true"))) {
-                               ba.Allowed = ButtonCheckTrue;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-false"))) {
-                               ba.Allowed = ButtonCheckFalse;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-upgrade"))) {
-                               ba.Allowed = ButtonCheckUpgrade;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-units-or"))) {
-                               ba.Allowed = ButtonCheckUnitsOr;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-units-and"))) {
-                               ba.Allowed = ButtonCheckUnitsAnd;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-network"))) {
-                               ba.Allowed = ButtonCheckNetwork;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-no-network"))) {
-                               ba.Allowed = ButtonCheckNoNetwork;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-no-work"))) {
-                               ba.Allowed = ButtonCheckNoWork;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-no-research"))) {
-                               ba.Allowed = ButtonCheckNoResearch;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-attack"))) {
-                               ba.Allowed = ButtonCheckAttack;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-upgrade-to"))) {
-                               ba.Allowed = ButtonCheckUpgradeTo;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-research"))) {
-                               ba.Allowed = ButtonCheckResearch;
-                       } else if (gh_eq_p(value, 
gh_symbol2scm("check-single-research"))) {
-                               ba.Allowed = ButtonCheckSingleResearch;
-                       } else {
-                               s1 = gh_scm2newstr(value, NULL);
-                               fprintf(stderr, "Unsupported action %s\n", s1);
-                               free(s1);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("allow-arg"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       s1 = strdup("");
-                       while (!gh_null_p(value)) {
-                               s2 = gh_scm2newstr(gh_car(value), NULL);
-                               s1 = realloc(s1, strlen(s1) + strlen(s2) + 2);
-                               strcat(s1, s2);
-                               free(s2);
-                               value = gh_cdr(value);
-                               if (!gh_null_p(value)) {
-                                       strcat(s1, ",");
-                               }
-                       }
-                       ba.AllowStr = s1;
-               } else if (gh_eq_p(value, gh_symbol2scm("key"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       s1 = gh_scm2newstr(value, NULL);
-                       ba.Key = *s1;
-                       free(s1);
-               } else if (gh_eq_p(value, gh_symbol2scm("hint"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       ba.Hint = gh_scm2newstr(value, NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("for-unit"))) {
-                       // FIXME: ba.UnitMask shouldn't be a string
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       s1 = strdup(",");
-                       while (!gh_null_p(value)) {
-                               s2 = gh_scm2newstr(gh_car(value), NULL);
-                               s1 = realloc(s1, strlen(s1) + strlen(s2) + 2);
-                               strcat(s1, s2);
-                               strcat(s1, ",");
-                               value = gh_cdr(value);
-                               free(s2);
-                       }
-                       ba.UnitMask = s1;
-                       if (!strncmp(ba.UnitMask, ",*,", 3)) {
-                               free(ba.UnitMask);
-                               ba.UnitMask = strdup("*");
-                       }
-               } else {
-                       s1 = gh_scm2newstr(value, NULL);
-                       fprintf(stderr, "Unsupported tag %s\n", s1);
-                       free(s1);
-               }
-       }
-       AddButton(ba.Pos, ba.Level, ba.Icon.Name, ba.Action, ba.ValueStr,
-               ba.Allowed, ba.AllowStr, ba.Key, ba.Hint, ba.UnitMask);
-       if (ba.ValueStr) {
-               free(ba.ValueStr);
-       }
-       if (ba.AllowStr) {
-               free(ba.AllowStr);
-       }
-       if (ba.Hint) {
-               free(ba.Hint);
-       }
-       if (ba.UnitMask) {
-               free(ba.UnitMask);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineButton(lua_State* l)
 {
        char buf[64];
@@ -6738,7 +3940,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Run the set-selection-changed-hook.
@@ -6763,13 +3964,6 @@
 **             @param index            index
 **
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetColorWaterCycleStart(SCM index)
-{
-       ColorWaterCycleStart = gh_scm2int(index);
-       return index;
-}
-#elif defined(USE_LUA)
 local int CclSetColorWaterCycleStart(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -6781,15 +3975,10 @@
        lua_pushnumber(l, ColorWaterCycleStart);
        return 1;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetColorWaterCycleEnd(SCM index)
-{
-       ColorWaterCycleEnd = gh_scm2int(index);
-       return index;
-}
-#elif defined(USE_LUA)
+/**
+**  FIXME: docu
+*/
 local int CclSetColorWaterCycleEnd(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -6801,15 +3990,10 @@
        lua_pushnumber(l, ColorWaterCycleEnd);
        return 1;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetColorIconCycleStart(SCM index)
-{
-       ColorIconCycleStart = gh_scm2int(index);
-       return index;
-}
-#elif defined(USE_LUA)
+/**
+**  FIXME: docu
+*/
 local int CclSetColorIconCycleStart(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -6821,15 +4005,10 @@
        lua_pushnumber(l, ColorIconCycleStart);
        return 1;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetColorIconCycleEnd(SCM index)
-{
-       ColorIconCycleEnd = gh_scm2int(index);
-       return index;
-}
-#elif defined(USE_LUA)
+/**
+**  FIXME: docu
+*/
 local int CclSetColorIconCycleEnd(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -6841,15 +4020,10 @@
        lua_pushnumber(l, ColorIconCycleEnd);
        return 1;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetColorBuildingCycleStart(SCM index)
-{
-       ColorBuildingCycleStart = gh_scm2int(index);
-       return index;
-}
-#elif defined(USE_LUA)
+/**
+**  FIXME: docu
+*/
 local int CclSetColorBuildingCycleStart(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -6861,15 +4035,10 @@
        lua_pushnumber(l, ColorBuildingCycleStart);
        return 1;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetColorBuildingCycleEnd(SCM index)
-{
-       ColorBuildingCycleEnd = gh_scm2int(index);
-       return index;
-}
-#elif defined(USE_LUA)
+/**
+**  FIXME: docu
+*/
 local int CclSetColorBuildingCycleEnd(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -6881,7 +4050,6 @@
        lua_pushnumber(l, ColorBuildingCycleEnd);
        return 1;
 }
-#endif
 
 /**
 **             Set double-click delay.
@@ -6889,17 +4057,6 @@
 **             @param delay            Delay in ms
 **             @return                         Old delay
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetDoubleClickDelay(SCM delay)
-{
-       int i;
-
-       i = DoubleClickDelay;
-       DoubleClickDelay = gh_scm2int(delay);
-
-       return gh_int2scm(i);
-}
-#elif defined(USE_LUA)
 local int CclSetDoubleClickDelay(lua_State* l)
 {
        lua_Number i;
@@ -6914,7 +4071,6 @@
        lua_pushnumber(l, i);
        return 1;
 }
-#endif
 
 /**
 **             Set hold-click delay.
@@ -6922,17 +4078,6 @@
 **             @param delay            Delay in ms
 **             @return                         Old delay
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetHoldClickDelay(SCM delay)
-{
-       int i;
-
-       i = HoldClickDelay;
-       HoldClickDelay = gh_scm2int(delay);
-
-       return gh_int2scm(i);
-}
-#elif defined(USE_LUA)
 local int CclSetHoldClickDelay(lua_State* l)
 {
        lua_Number i;
@@ -6947,7 +4092,6 @@
        lua_pushnumber(l, i);
        return 1;
 }
-#endif
 
 /**
 **             Set selection style.
@@ -6955,33 +4099,6 @@
 **             @param style            New style
 **             @return                         Old style
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetSelectionStyle(SCM style)
-{
-       SCM old;
-
-       old = NIL;
-
-       if (!gh_null_p(style)) {
-               if (gh_eq_p(style, gh_symbol2scm("rectangle"))) {
-                       DrawSelection = DrawSelectionRectangle;
-               } else if (gh_eq_p(style, gh_symbol2scm("alpha-rectangle"))) {
-                       DrawSelection = DrawSelectionRectangleWithTrans;
-               } else if (gh_eq_p(style, gh_symbol2scm("circle"))) {
-                       DrawSelection = DrawSelectionCircle;
-               } else if (gh_eq_p(style, gh_symbol2scm("alpha-circle"))) {
-                       DrawSelection = DrawSelectionCircleWithTrans;
-               } else if (gh_eq_p(style, gh_symbol2scm("corners"))) {
-                       DrawSelection = DrawSelectionCorners;
-               } else {
-                       errl("Unsupported selection style", style);
-               }
-       } else {
-               DrawSelection = DrawSelectionNone;
-       }
-       return old;
-}
-#elif defined(USE_LUA)
 local int CclSetSelectionStyle(lua_State* l)
 {
        char* old;
@@ -7013,7 +4130,6 @@
        free(old);
        return 1;
 }
-#endif
 
 /**
 **             Set display of sight range.
@@ -7022,27 +4138,6 @@
 **
 **             @return                         The old state of display of 
sight.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetShowSightRange(SCM flag)
-{
-       int old;
-
-       old = ShowSightRange;
-       if (!gh_null_p(flag)) {
-               if (gh_eq_p(flag, gh_symbol2scm("rectangle"))) {
-                       ShowSightRange = 1;
-               } else if (gh_eq_p(flag, gh_symbol2scm("circle"))) {
-                       ShowSightRange = 2;
-               } else {
-                       ShowSightRange = 3;
-               }
-       } else {
-               ShowSightRange = 0;
-       }
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetShowSightRange(lua_State* l)
 {
        lua_Number old;
@@ -7086,7 +4181,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set display of reaction range.
@@ -7095,27 +4189,6 @@
 **
 **             @return                         The old state of display of 
reaction.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetShowReactionRange(SCM flag)
-{
-       int old;
-
-       old = ShowReactionRange;
-       if (!gh_null_p(flag)) {
-               if (gh_eq_p(flag, gh_symbol2scm("rectangle"))) {
-                       ShowReactionRange = 1;
-               } else if (gh_eq_p(flag, gh_symbol2scm("circle"))) {
-                       ShowReactionRange = 2;
-               } else {
-                       ShowReactionRange = 3;
-               }
-       } else {
-               ShowReactionRange = 0;
-       }
-
-       return gh_int2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetShowReactionRange(lua_State* l)
 {
        lua_Number old;
@@ -7152,7 +4225,6 @@
        lua_pushnumber(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set display of attack range.
@@ -7161,17 +4233,6 @@
 **
 **             @return                         The old state of display of 
attack.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetShowAttackRange(SCM flag)
-{
-       int old;
-
-       old = ShowAttackRange;
-       ShowAttackRange = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetShowAttackRange(lua_State* l)
 {
        int old;
@@ -7186,7 +4247,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set display of orders.
@@ -7195,24 +4255,6 @@
 **
 **             @return                         The old state of display of 
orders.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetShowOrders(SCM flag)
-{
-       int old;
-
-       old = !ShowOrders;
-       if (gh_boolean_p(flag)) {
-               ShowOrders = gh_scm2bool(flag);
-               if (ShowOrders) {
-                       ShowOrders = SHOW_ORDERS_ALWAYS;
-               }
-       } else {
-               ShowOrders = gh_scm2int(flag);
-       }
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetShowOrders(lua_State* l)
 {
        int old;
@@ -7234,24 +4276,12 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Add a new message.
 **
 **             @param message          Message to display.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAddMessage(SCM message)
-{
-       const char* str;
-
-       str = get_c_string(message);
-       SetMessage("%s", str);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclAddMessage(lua_State* l)
 {
        const char* str;
@@ -7265,29 +4295,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Reset the keystroke help array
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclResetKeystrokeHelp(void)
-{
-       int n;
-
-       n = nKeyStrokeHelps * 2;
-       while (n--) {
-               free(KeyStrokeHelps[n]);
-       }
-       if (KeyStrokeHelps) {
-               free(KeyStrokeHelps);
-               KeyStrokeHelps = NULL;
-       }
-       nKeyStrokeHelps = 0;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclResetKeystrokeHelp(lua_State* l)
 {
        int n;
@@ -7309,15 +4320,10 @@
 
        return 0;
 }
-#endif
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetGroupKeys(SCM list)
-{
-       UiGroupKeys = gh_scm2newstr(list, NULL);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
+/**
+**  FIXME: docu
+*/
 local int CclSetGroupKeys(lua_State* l)
 {
        if (lua_gettop(l) != 1) {
@@ -7327,56 +4333,12 @@
        UiGroupKeys = strdup(LuaToString(l, 1));
        return 0;
 }
-#endif
 
 /**
 **             Add a keystroke help
 **
 **             @param list             pair describing the keystroke.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclAddKeystrokeHelp(SCM list)
-{
-       SCM value;
-       char* s1;
-       char* s2;
-       int n;
-
-       s1 = s2 = NULL;
-
-       if (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               s1 = gh_scm2newstr(value, NULL);
-       }
-       if (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               s2 = gh_scm2newstr(value, NULL);
-
-               n = nKeyStrokeHelps;
-               if (!n) {
-                       n = 1;
-                       KeyStrokeHelps = malloc(2 * sizeof(char*));
-               } else {
-                       ++n;
-                       KeyStrokeHelps = realloc(KeyStrokeHelps, n * 2 * 
sizeof(char*));
-               }
-               if (KeyStrokeHelps) {
-                       nKeyStrokeHelps = n;
-                       --n;
-                       KeyStrokeHelps[n * 2] = s1;
-                       KeyStrokeHelps[n * 2 + 1] = s2;
-               }
-       }
-
-       while (!gh_null_p(list)) {
-               list = gh_cdr(list);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclAddKeystrokeHelp(lua_State* l)
 {
        char* s1;
@@ -7408,94 +4370,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for UI.
 */
 global void UserInterfaceCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure1_0("add-message", CclAddMessage);
-
-       gh_new_procedure1_0("set-color-cycle-all!", CclSetColorCycleAll);
-       gh_new_procedure1_0("set-mouse-scroll-speed-default!", 
CclSetMouseScrollSpeedDefault);
-       gh_new_procedure1_0("set-mouse-scroll-speed-control!", 
CclSetMouseScrollSpeedControl);
-
-       gh_new_procedure1_0("set-click-missile!", CclSetClickMissile);
-       gh_new_procedure1_0("set-damage-missile!", CclSetDamageMissile);
-
-       gh_new_procedure1_0("set-contrast!", CclSetContrast);
-       gh_new_procedure1_0("set-brightness!", CclSetBrightness);
-       gh_new_procedure1_0("set-saturation!", CclSetSaturation);
-
-       gh_new_procedure2_0("set-video-resolution!", CclSetVideoResolution);
-       gh_new_procedure1_0("set-video-fullscreen!", CclSetVideoFullScreen);
-
-       gh_new_procedureN("set-title-screens!", CclSetTitleScreens);
-       gh_new_procedure1_0("set-menu-background!", CclSetMenuBackground);
-       gh_new_procedure1_0("set-menu-background-with-title!",
-               CclSetMenuBackgroundWithTitle);
-       gh_new_procedure1_0("set-menu-music!", CclSetMenuMusic);
-
-       gh_new_procedure1_0("display-picture", CclDisplayPicture);
-       gh_new_procedure1_0("process-menu", CclProcessMenu);
-
-       gh_new_procedureN("define-cursor", CclDefineCursor);
-       gh_new_procedure1_0("set-game-cursor!", CclSetGameCursor);
-       gh_new_procedureN("define-ui", CclDefineUI);
-       gh_new_procedureN("define-viewports", CclDefineViewports);
-
-       gh_new_procedure1_0("set-grab-mouse!", CclSetGrabMouse);
-       gh_new_procedure1_0("set-leave-stops!", CclSetLeaveStops);
-       gh_new_procedure1_0("set-key-scroll!", CclSetKeyScroll);
-       gh_new_procedure1_0("set-key-scroll-speed!", CclSetKeyScrollSpeed);
-       gh_new_procedure1_0("set-mouse-scroll!", CclSetMouseScroll);
-       gh_new_procedure1_0("set-mouse-scroll-speed!", CclSetMouseScrollSpeed);
-
-       gh_new_procedure1_0("set-show-command-key!", CclSetShowCommandKey);
-       gh_new_procedure0_0("right-button-attacks", CclRightButtonAttacks);
-       gh_new_procedure0_0("right-button-moves", CclRightButtonMoves);
-       gh_new_procedure1_0("set-fancy-buildings!", CclSetFancyBuildings);
-
-       gh_new_procedureN("define-button", CclDefineButton);
-
-       gh_new_procedureN("define-menu-item", CclDefineMenuItem);
-       gh_new_procedureN("define-menu", CclDefineMenu);
-       gh_new_procedureN("define-menu-graphics", CclDefineMenuGraphics);
-
-       //
-       //              Color cycling
-       //
-       gh_new_procedure1_0("set-color-water-cycle-start!", 
CclSetColorWaterCycleStart);
-       gh_new_procedure1_0("set-color-water-cycle-end!", 
CclSetColorWaterCycleEnd);
-       gh_new_procedure1_0("set-color-icon-cycle-start!", 
CclSetColorIconCycleStart);
-       gh_new_procedure1_0("set-color-icon-cycle-end!", 
CclSetColorIconCycleEnd);
-       gh_new_procedure1_0("set-color-building-cycle-start!", 
CclSetColorBuildingCycleStart);
-       gh_new_procedure1_0("set-color-building-cycle-end!", 
CclSetColorBuildingCycleEnd);
-
-       //
-       //              Correct named functions
-       //
-       gh_new_procedure1_0("set-double-click-delay!", CclSetDoubleClickDelay);
-       gh_new_procedure1_0("set-hold-click-delay!", CclSetHoldClickDelay);
-
-       //
-       //              Look and feel of units
-       //
-       gh_new_procedure1_0("set-selection-style!", CclSetSelectionStyle);
-       gh_new_procedure1_0("set-show-sight-range!", CclSetShowSightRange);
-       gh_new_procedure1_0("set-show-reaction-range!", 
CclSetShowReactionRange);
-       gh_new_procedure1_0("set-show-attack-range!", CclSetShowAttackRange);
-       gh_new_procedure1_0("set-show-orders!", CclSetShowOrders);
-
-       //
-       //              Keystroke helps
-       //
-       gh_new_procedure0_0("reset-keystroke-help", CclResetKeystrokeHelp);
-       gh_new_procedureN("add-keystroke-help", CclAddKeystrokeHelp);
-       gh_new_procedure1_0("set-group-keys", CclSetGroupKeys);
-#elif defined(USE_LUA)
        lua_register(Lua, "AddMessage", CclAddMessage);
 
        lua_register(Lua, "SetColorCycleAll", CclSetColorCycleAll);
@@ -7575,7 +4455,6 @@
        lua_register(Lua, "ResetKeystrokeHelp", CclResetKeystrokeHelp);
        lua_register(Lua, "AddKeystrokeHelp", CclAddKeystrokeHelp);
        lua_register(Lua, "SetGroupKeys", CclSetGroupKeys);
-#endif
 
        InitMenuFuncHash();
 }
Index: stratagus/src/ui/icons.c
diff -u stratagus/src/ui/icons.c:1.59 stratagus/src/ui/icons.c:1.60
--- stratagus/src/ui/icons.c:1.59       Sat Dec 20 16:33:40 2003
+++ stratagus/src/ui/icons.c    Fri Jan  2 08:24:18 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: icons.c,v 1.59 2003/12/20 05:33:40 jsalmon3 Exp $
+//     $Id: icons.c,v 1.60 2004/01/01 21:24:18 jsalmon3 Exp $
 
 //@{
 
@@ -432,7 +432,7 @@
        int i;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: icons $Id: icons.c,v 1.59 2003/12/20 
05:33:40 jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: icons $Id: icons.c,v 1.60 2004/01/01 
21:24:18 jsalmon3 Exp $\n\n");
 
        //
        //  Mapping the original icon numbers in puds to our internal strings
@@ -478,61 +478,6 @@
 **
 **             @param list             Icon definition list.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineIcon(SCM list)
-{
-       SCM value;
-       char* ident;
-       char* tileset;
-       char* filename;
-       int width;
-       int height;
-       int index;
-
-#ifdef DEBUG
-       index = width = height = 0;
-#endif
-       filename = NULL;
-       tileset = NULL;
-
-       //  Identifier
-
-       ident = gh_scm2newstr(gh_car(list), NULL);
-       list = gh_cdr(list);
-
-       //
-       //  Parse the arguments, tagged format.
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("tileset"))) {
-                       tileset = gh_scm2newstr(gh_car(list), NULL);
-               } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
-                       value = gh_car(list);
-                       width = gh_scm2int(gh_car(value));
-                       height = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(value, gh_symbol2scm("normal"))) {
-                       value = gh_car(list);
-                       index = gh_scm2int(gh_car(value));
-                       filename = gh_scm2newstr(gh_cadr(value), NULL);
-               } else {
-                       errl("Unsupported tag", value);
-               }
-               list = gh_cdr(list);
-       }
-
-       DebugCheck(!filename || !width || !height);
-
-       AddIcon(ident, tileset, index, width, height, filename);
-       free(ident);
-       free(tileset);
-       free(filename);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineIcon(lua_State* l)
 {
        const char* value;
@@ -601,7 +546,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             @brief Parse icon alias definition.
@@ -612,17 +556,6 @@
 **             @param alias            Icon alias name.
 **             @param icon             Original icon.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineIconAlias(SCM alias, SCM icon)
-{
-       IconAliases = realloc(IconAliases, sizeof(char*) * 2 * (NumIconAliases 
+ 1));
-       IconAliases[NumIconAliases * 2 + 0] = gh_scm2newstr(alias, NULL);
-       IconAliases[NumIconAliases * 2 + 1] = gh_scm2newstr(icon, NULL);
-       ++NumIconAliases;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineIconAlias(lua_State* l)
 {
        if (lua_gettop(l) != 2) {
@@ -636,40 +569,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             @brief Define icon mapping from original number to internal 
symbol
 **
 **             @param list             List of all names.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineIconWcNames(SCM list)
-{
-       int i;
-       char** cp;
-
-       if ((cp = IconWcNames)) {                               // Free all old 
names
-               while (*cp) {
-                       free(*cp++);
-               }
-               free(IconWcNames);
-       }
-
-       //
-       //              Get new table.
-       //
-       i = gh_length(list);
-       IconWcNames = cp = malloc((i + 1) * sizeof(char*));
-       while (i--) {
-               *cp++ = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-       }
-       *cp = NULL;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineIconWcNames(lua_State* l)
 {
        int i;
@@ -700,7 +605,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Set icon size
@@ -709,14 +613,6 @@
 **             @param width            Width of icon.
 **             @param height           Height of icon.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetIconSize(SCM width, SCM height)
-{
-       IconWidth = gh_scm2int(width);
-       IconHeight = gh_scm2int(height);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSetIconSize(lua_State* l)
 {
        if (lua_gettop(l) != 2) {
@@ -727,7 +623,6 @@
        IconHeight = LuaToNumber(l, 2);
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for icons.
@@ -737,15 +632,6 @@
 */
 global void IconCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-icon", CclDefineIcon);
-       gh_new_procedure2_0("define-icon-alias", CclDefineIconAlias);
-
-       gh_new_procedureN("define-icon-wc-names", CclDefineIconWcNames);
-
-       // FIXME: can be removed:
-       gh_new_procedure2_0("set-icon-size!", CclSetIconSize);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineIcon", CclDefineIcon);
        lua_register(Lua, "DefineIconAlias", CclDefineIconAlias);
 
@@ -753,7 +639,6 @@
 
        // FIXME: can be removed:
        lua_register(Lua, "SetIconSize", CclSetIconSize);
-#endif
 }
 
 //@}
Index: stratagus/src/ui/interface.c
diff -u stratagus/src/ui/interface.c:1.149 stratagus/src/ui/interface.c:1.150
--- stratagus/src/ui/interface.c:1.149  Sat Dec 20 16:33:40 2003
+++ stratagus/src/ui/interface.c        Fri Jan  2 08:24:18 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: interface.c,v 1.149 2003/12/20 05:33:40 jsalmon3 Exp $
+//     $Id: interface.c,v 1.150 2004/01/01 21:24:18 jsalmon3 Exp $
 
 //@{
 
@@ -985,132 +985,6 @@
 */
 global int HandleCheats(const char* input)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       int ret;
-       int i;
-
-       ret = 1;
-
-       // FIXME: disable cheats
-       if (strcmp(input, "there is no aliens level") == 0) {
-               // FIXME: no function yet.
-               SetMessage("cheat enabled");
-       } else if (strcmp(input, "hatchet") == 0) {
-               SpeedResourcesHarvest[WoodCost] = 52 / 2;
-               SetMessage("Wow -- I got jigsaw!");
-       } else if (strcmp(input, "glittering prizes") == 0) {
-               ThisPlayer->Resources[GoldCost] += 12000;
-               ThisPlayer->Resources[WoodCost] += 5000;
-               ThisPlayer->Resources[OilCost] += 5000;
-               ThisPlayer->Resources[OreCost] += 5000;
-               ThisPlayer->Resources[StoneCost] += 5000;
-               ThisPlayer->Resources[CoalCost] += 5000;
-               MustRedraw |= RedrawResources;
-               SetMessage("!!! :)");
-       } else if (strcmp(input, "on screen") == 0) {
-               RevealMap();
-       } else if (!strcmp(input, "showpath")) {
-               RevealMap();
-       } else if (strcmp(input, "fow on") == 0) {
-               TheMap.NoFogOfWar = 0;
-               UpdateFogOfWarChange();
-               SetMessage("Fog Of War is now ON");
-       } else if (strcmp(input, "fow off") == 0) {
-               TheMap.NoFogOfWar = 1;
-               UpdateFogOfWarChange();
-               SetMessage("Fog Of War is now OFF");
-       } else if (strcmp(input, "fast debug") == 0) {
-               for (i = 1; i < MaxCosts; ++i) {
-                       SpeedResourcesHarvest[i] = 10;
-                       SpeedResourcesReturn[i] = 10;
-               }
-               SpeedBuild = 10;                // speed factor for building
-               SpeedTrain = 10;                // speed factor for training
-               SpeedUpgrade = 10;              // speed factor for upgrading
-               SpeedResearch = 10;             // speed factor for researching
-               SetMessage("FAST DEBUG SPEED");
-       } else if (strcmp(input, "normal debug") == 0) {
-               for (i = 1; i < MaxCosts; ++i) {
-                       SpeedResourcesHarvest[i] = 1;
-                       SpeedResourcesReturn[i] = 1;
-               }
-               SpeedBuild = 1;         // speed factor for building
-               SpeedTrain = 1;         // speed factor for training
-               SpeedUpgrade = 1;               // speed factor for upgrading
-               SpeedResearch = 1;              // speed factor for researching
-               SetMessage("NORMAL DEBUG SPEED");
-       } else if (strcmp(input, "make it so") == 0) {
-               if (SpeedCheat) {
-                       SpeedCheat = 0;
-                       for (i = 1; i < MaxCosts; ++i) {
-                               SpeedResourcesHarvest[i] = 1;
-                               SpeedResourcesReturn[i] = 1;
-                       }
-                       SpeedBuild = 1;         // speed factor for building
-                       SpeedTrain = 1;         // speed factor for training
-                       SpeedUpgrade = 1;               // speed factor for 
upgrading
-                       SpeedResearch = 1;              // speed factor for 
researching
-                       SetMessage("NO SO!");
-               } else {
-                       SpeedCheat = 1;
-                       for (i = 1; i < MaxCosts; ++i) {
-                               SpeedResourcesHarvest[i] = 10;
-                               SpeedResourcesReturn[i] = 10;
-                       }
-                       SpeedBuild = 10;                // speed factor for 
building
-                       SpeedTrain = 10;                // speed factor for 
training
-                       SpeedUpgrade = 10;              // speed factor for 
upgrading
-                       SpeedResearch = 10;             // speed factor for 
researching
-                       ThisPlayer->Resources[GoldCost] += 32000;
-                       ThisPlayer->Resources[WoodCost] += 32000;
-                       ThisPlayer->Resources[OilCost] += 32000;
-                       ThisPlayer->Resources[OreCost] += 32000;
-                       ThisPlayer->Resources[StoneCost] += 32000;
-                       ThisPlayer->Resources[CoalCost] += 32000;
-                       MustRedraw |= RedrawResources;
-                       SetMessage("SO!");
-               }
-       } else if (!strcmp(input, "unite the clans")) {
-               GameRunning = 0;
-               GameResult = GameVictory;
-       } else if (!strcmp(input, "you pitiful worm")) {
-               GameRunning = 0;
-               GameResult = GameDefeat;
-       } else if (!strcmp(input, "it is a good day to die")) {
-               GodMode = !GodMode;
-               if (GodMode) {
-                       SetMessage("God Mode ON");
-               } else {
-                       SetMessage("God Mode OFF");
-               }
-       } else if (!strcmp(input, "fill mana")) {
-               for (i = 0; i < ThisPlayer->TotalNumUnits; ++i) {
-                       if (ThisPlayer->Units[i]->Type->_MaxMana) {
-                               ThisPlayer->Units[i]->Mana = 
ThisPlayer->Units[i]->Type->_MaxMana;
-                       }
-               }
-               SetMessage("All magic at your command");
-#ifdef DEBUG
-       } else if (!strcmp(input, "ai me")) {
-               if (ThisPlayer->AiEnabled) {
-                       ThisPlayer->AiEnabled = 0;
-                       ThisPlayer->Type = PlayerPerson;
-                       SetMessage("AI is off, Normal Player");
-               } else {
-                       ThisPlayer->AiEnabled = 1;
-                       ThisPlayer->Type = PlayerComputer;
-                       if (!ThisPlayer->Ai) {
-                                       AiInit(ThisPlayer);
-                       }
-                       SetMessage("I'm the BORG, resistance is futile!");
-               }
-#endif
-       } else {
-               ret = 0;
-       }
-
-       return ret;
-#elif defined(USE_LUA)
        int ret;
 
 #ifdef DEBUG
@@ -1144,7 +1018,6 @@
                ret = 0;
        }
        return ret;
-#endif
 }
 
 /**
Index: stratagus/src/unit/ccl_unit.c
diff -u stratagus/src/unit/ccl_unit.c:1.86 stratagus/src/unit/ccl_unit.c:1.87
--- stratagus/src/unit/ccl_unit.c:1.86  Sat Dec 20 16:33:45 2003
+++ stratagus/src/unit/ccl_unit.c       Fri Jan  2 08:24:19 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unit.c,v 1.86 2003/12/20 05:33:45 jsalmon3 Exp $
+//     $Id: ccl_unit.c,v 1.87 2004/01/01 21:24:19 jsalmon3 Exp $
 
 //@{
 
@@ -57,15 +57,9 @@
 ----------------------------------------------------------------------------*/
 
        /// Get unit-type.
-#if defined(USE_GUILE) || defined(USE_SIOD)
-extern UnitType* CclGetUnitType(SCM ptr);
-       /// Get resource by name
-extern unsigned CclGetResourceByName(SCM ptr);
-#elif defined(USE_LUA)
 extern UnitType* CclGetUnitType(lua_State* l);
        /// Get resource by name
 extern unsigned CclGetResourceByName(lua_State* l);
-#endif
 
 /**
 **             Set xp damage
@@ -74,17 +68,6 @@
 **
 **             @return  The old state of the xp damage
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetXpDamage(SCM flag)
-{
-       int old;
-
-       old = XpDamage;
-       XpDamage = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetXpDamage(lua_State* l)
 {
        int old;
@@ -99,7 +82,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set training queue
@@ -108,17 +90,6 @@
 **
 **             @return                         The old state of the training 
queue
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetTrainingQueue(SCM flag)
-{
-       int old;
-
-       old = EnableTrainingQueue;
-       EnableTrainingQueue = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetTrainingQueue(lua_State* l)
 {
        int old;
@@ -133,7 +104,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set capture buildings
@@ -142,17 +112,6 @@
 **
 **             @return                         The old state of the flag
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetBuildingCapture(SCM flag)
-{
-       int old;
-
-       old = EnableBuildingCapture;
-       EnableBuildingCapture = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetBuildingCapture(lua_State* l)
 {
        int old;
@@ -167,7 +126,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Set reveal attacker
@@ -176,17 +134,6 @@
 **
 **             @return                         The old state of the flag
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetRevealAttacker(SCM flag)
-{
-       int old;
-
-       old = RevealAttacker;
-       RevealAttacker = gh_scm2bool(flag);
-
-       return gh_bool2scm(old);
-}
-#elif defined(USE_LUA)
 local int CclSetRevealAttacker(lua_State* l)
 {
        int old;
@@ -201,7 +148,6 @@
        lua_pushboolean(l, old);
        return 1;
 }
-#endif
 
 /**
 **             Get a unit pointer
@@ -210,17 +156,10 @@
 **
 **             @return                         The unit pointer
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local Unit* CclGetUnit(SCM value)
-{
-       return UnitSlots[gh_scm2int(value)];
-}
-#elif defined(USE_LUA)
 local Unit* CclGetUnit(lua_State* l)
 {
        return UnitSlots[(int)LuaToNumber(l, -1)];
 }
-#endif
 
 /**
 **             Parse order
@@ -228,149 +167,6 @@
 **             @param list             All options of the order.
 **             @param order            OUT: resulting order.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseOrder(SCM list, Order* order)
-{
-       SCM value;
-       SCM sublist;
-
-       //
-       //              Parse the list:         (still everything could be 
changed!)
-       //
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("action-none"))) {
-                       order->Action = UnitActionNone;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-still"))) {
-                       order->Action = UnitActionStill;
-               } else if (gh_eq_p(value, 
gh_symbol2scm("action-stand-ground"))) {
-                       order->Action = UnitActionStandGround;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-follow"))) {
-                       order->Action = UnitActionFollow;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-move"))) {
-                       order->Action = UnitActionMove;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-attack"))) {
-                       order->Action = UnitActionAttack;
-               } else if (gh_eq_p(value, 
gh_symbol2scm("action-attack-ground"))) {
-                       order->Action = UnitActionAttackGround;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-die"))) {
-                       order->Action = UnitActionDie;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-spell-cast"))) {
-                       order->Action = UnitActionSpellCast;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-train"))) {
-                       order->Action = UnitActionTrain;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-upgrade-to"))) {
-                       order->Action = UnitActionUpgradeTo;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-research"))) {
-                       order->Action = UnitActionResearch;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-builded"))) {
-                       order->Action = UnitActionBuilded;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-board"))) {
-                       order->Action = UnitActionBoard;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-unload"))) {
-                       order->Action = UnitActionUnload;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-patrol"))) {
-                       order->Action = UnitActionPatrol;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-build"))) {
-                       order->Action = UnitActionBuild;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-repair"))) {
-                       order->Action = UnitActionRepair;
-               } else if (gh_eq_p(value, gh_symbol2scm("action-resource"))) {
-                       order->Action = UnitActionResource;
-               } else if (gh_eq_p(value, 
gh_symbol2scm("action-return-goods"))) {
-                       order->Action = UnitActionReturnGoods;
-
-               } else if (gh_eq_p(value, gh_symbol2scm("flags"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       order->Flags = gh_scm2int(value);
-
-               } else if (gh_eq_p(value, gh_symbol2scm("range"))) {
-                       order->Range = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("min-range"))) {
-                       order->MinRange = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("width"))) {
-                       order->Width = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("height"))) {
-                       order->Height = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("goal"))) {
-                       char* str;
-                       int slot;
-
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       str = gh_scm2newstr(value, NULL);
-
-                       slot = strtol(str + 1, NULL, 16);
-                       order->Goal = UnitSlots[slot];
-                       if (!UnitSlots[slot]) {
-                               DebugLevel0Fn("FIXME: Forward reference not 
supported\n");
-                       }
-                       ++UnitSlots[slot]->Refs;
-                       free(str);
-
-               } else if (gh_eq_p(value, gh_symbol2scm("tile"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       order->X = gh_scm2int(gh_car(sublist));
-                       order->Y = gh_scm2int(gh_cadr(sublist));
-
-               } else if (gh_eq_p(value, gh_symbol2scm("type"))) {
-                       char* str;
-
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       str = gh_scm2newstr(value, NULL);
-                       order->Type = UnitTypeByIdent(str);
-                       free(str);
-
-               } else if (gh_eq_p(value, gh_symbol2scm("patrol"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       order->Arg1 = (void*)((gh_scm2int(gh_car(sublist)) << 
16) |
-                               gh_scm2int(gh_cadr(sublist)));
-
-               } else if (gh_eq_p(value, gh_symbol2scm("spell"))) {
-                       char* str;
-
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       str = gh_scm2newstr(value, NULL);
-                       order->Arg1 = SpellTypeByIdent(str);
-                       free(str);
-
-               } else if (gh_eq_p(value, gh_symbol2scm("upgrade"))) {
-                       char* str;
-
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       str = gh_scm2newstr(value, NULL);
-                       order->Arg1 = UpgradeByIdent(str);
-                       free(str);
-
-               } else if (gh_eq_p(value, gh_symbol2scm("mine"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       order->Arg1 = (void*)((gh_scm2int(gh_car(sublist)) << 
16) |
-                               gh_scm2int(gh_cadr(sublist)));
-
-               } else if (gh_eq_p(value, gh_symbol2scm("arg1"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       order->Arg1 = (void*)gh_scm2int(value);
-
-               } else {
-                  // This leaves a half initialized unit
-                  errl("Unsupported tag", value);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseOrder(lua_State* l, Order* order)
 {
        const char* value;
@@ -550,7 +346,6 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse orders.
@@ -558,19 +353,6 @@
 **             @param unit             Unit pointer which should get the 
orders.
 **             @param vector           All options of the order.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseOrders(SCM vector, Unit* unit)
-{
-       int i;
-       int n;
-
-       n = gh_vector_length(vector);
-       DebugCheck(n != MAX_ORDERS);
-       for (i = 0; i < n; ++i) {
-               CclParseOrder(gh_vector_ref(vector, gh_int2scm(i)), 
&unit->Orders[i]);
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseOrders(lua_State* l, Unit* unit)
 {
        int args;
@@ -584,7 +366,6 @@
                lua_pop(l, 1);
        }
 }
-#endif
 
 /**
 **             Parse builded
@@ -592,47 +373,6 @@
 **             @param unit             Unit pointer which should be filled 
with the data.
 **             @param list             All options of the builded data.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseBuilded(Unit* unit, SCM list)
-{
-       SCM value;
-       char* str;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("worker"))) {
-                       int slot;
-
-                       value = gh_car(list);
-                       str = gh_scm2newstr(value, NULL);
-                       slot = strtol(str + 1, NULL, 16);
-                       DebugCheck(!UnitSlots[slot]);
-                       unit->Data.Builded.Worker = UnitSlots[slot];
-                       ++UnitSlots[slot]->Refs;
-                       free(str);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("progress"))) {
-                       unit->Data.Builded.Progress = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("cancel"))) {
-                       unit->Data.Builded.Cancel = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("frame"))) {
-                       int frame;
-                       ConstructionFrame* cframe;
-
-                       frame = gh_scm2int(gh_car(list));
-                       cframe = unit->Type->Construction->Frames;
-                       while (frame--) {
-                               cframe = cframe->Next;
-                       }
-                       unit->Data.Builded.Frame = cframe;
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseBuilded(lua_State* l, Unit* unit)
 {
        const char* value;
@@ -681,7 +421,6 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse res worker data
@@ -689,24 +428,6 @@
 **             @param unit             Unit pointer which should be filled 
with the data.
 **             @param list             All options of the resource worker data.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseResWorker(Unit* unit, SCM list)
-{
-       SCM value;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("time-to-harvest"))) {
-                       unit->Data.ResWorker.TimeToHarvest = 
gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("done-harvesting"))) {
-                       unit->Data.ResWorker.DoneHarvesting = 1;
-                       list = gh_cdr(list);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseResWorker(lua_State* l, Unit* unit)
 {
        const char* value;
@@ -733,7 +454,6 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse research
@@ -741,25 +461,6 @@
 **             @param unit             Unit pointer which should be filled 
with the data.
 **             @param list             All options of the research data.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseResearch(Unit* unit, SCM list)
-{
-       SCM value;
-       char* str;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("ident"))) {
-                       value = gh_car(list);
-                       str = gh_scm2newstr(value, NULL);
-                       unit->Data.Research.Upgrade = UpgradeByIdent(str);
-                       free(str);
-                       list = gh_cdr(list);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseResearch(lua_State* l, Unit* unit)
 {
        const char* value;
@@ -784,7 +485,6 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse upgrade to
@@ -792,21 +492,6 @@
 **             @param unit             Unit pointer which should be filled 
with the data.
 **             @param list             All options of the upgrade to data.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseUpgradeTo(Unit* unit, SCM list)
-{
-       SCM value;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("ticks"))) {
-                       unit->Data.UpgradeTo.Ticks = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseUpgradeTo(lua_State* l, Unit* unit)
 {
        const char* value;
@@ -830,7 +515,6 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse stored data for train order
@@ -838,42 +522,6 @@
 **             @param unit             Unit pointer which should be filled 
with the data.
 **             @param list             All options of the trained order
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseTrain(Unit* unit, SCM list)
-{
-       SCM value;
-       SCM sublist;
-       int i;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("ticks"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       unit->Data.Train.Ticks = gh_scm2int(value);
-               } else if (gh_eq_p(value, gh_symbol2scm("count"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       unit->Data.Train.Count = gh_scm2int(value);
-               } else if (gh_eq_p(value, gh_symbol2scm("queue"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       for (i = 0; i < MAX_UNIT_TRAIN; ++i) {
-                               value = gh_vector_ref(sublist, gh_int2scm(i));
-                               if (gh_eq_p(value, gh_symbol2scm("unit-none"))) 
{
-                                       unit->Data.Train.What[i] = NULL;
-                               } else {
-                                       char* ident;
-                                       ident = gh_scm2newstr(value, NULL);
-                                       unit->Data.Train.What[i] = 
UnitTypeByIdent(ident);
-                                       free(ident);
-                               }
-                       }
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseTrain(lua_State* l, Unit* unit)
 {
        const char* value;
@@ -922,7 +570,6 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse stored data for move order
@@ -930,32 +577,6 @@
 **             @param unit             Unit pointer which should be filled 
with the data.
 **             @param list             All options of the move order
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclParseMove(Unit* unit, SCM list)
-{
-       SCM value;
-       SCM sublist;
-       int i;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("fast"))) {
-                       unit->Data.Move.Fast = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("path"))) {
-                       int len;
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       len = gh_length(sublist);
-                       for (i = 0; i < len; ++i) {
-                               value = gh_vector_ref(sublist, gh_int2scm(i));
-                               unit->Data.Move.Path[i] = gh_scm2int(value);
-                       }
-                       unit->Data.Move.Length = len;
-               }
-       }
-}
-#elif defined(USE_LUA)
 local void CclParseMove(lua_State* l, Unit* unit)
 {
        const char* value;
@@ -995,359 +616,12 @@
                }
        }
 }
-#endif
 
 /**
 **             Parse unit
 **
 **             @param list             List describing unit
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclUnit(SCM list)
-{
-       SCM value;
-       SCM sublist;
-       Unit* unit;
-       UnitType* type;
-       UnitType* seentype;
-       Player* player;
-       int slot;
-       int i;
-       int insidecount;
-       char* str;
-       char* s;
-
-       insidecount = -1;
-       slot = gh_scm2int(gh_car(list));
-       list = gh_cdr(list);
-       DebugLevel3Fn("parsing unit #%d\n" _C_ slot);
-
-       unit = NULL;
-       type = NULL;
-       seentype = NULL;
-       player = NULL;
-       i = 0;
-
-       //
-       //              Parse the list:         (still everything could be 
changed!)
-       //
-       while (!gh_null_p(list)) {
-
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("type"))) {
-                       type = UnitTypeByIdent(str = 
gh_scm2newstr(gh_car(list), NULL));
-                       free(str);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("seen-type"))) {
-                       seentype = UnitTypeByIdent(str = 
gh_scm2newstr(gh_car(list), NULL));
-                       free(str);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("name"))) {
-                       unit->Name = gh_scm2newstr(gh_car(list),NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("player"))) {
-                       player = &Players[gh_scm2int(gh_car(list))];
-                       list = gh_cdr(list);
-
-                       // During a unit's death animation (when action is 
"die" but the
-                       // unit still has its original type, i.e. it's still 
not a corpse)
-                       // the unit is already removed from map and from 
player's
-                       // unit list (=the unit went through LetUnitDie() which
-                       // calls RemoveUnit() and UnitLost()).  Such a unit 
should not
-                       // be put on player's unit list!  However, this state 
is not
-                       // easily detected from this place.  It seems that it is
-                       // characterized by unit->HP==0 and by
-                       // unit->Orders[0].Action==UnitActionDie so we have to 
wait
-                       // until we parsed at least Unit::Orders[].
-                       DebugCheck(!type);
-                       unit = UnitSlots[slot];
-                       InitUnit(unit, type);
-                       unit->SeenType = seentype;
-                       unit->Active = 0;
-                       unit->Removed = 0;
-                       unit->Reset = 0;                                // 
JOHNS ????
-                       DebugCheck(unit->Slot != slot);
-               } else if (gh_eq_p(value, gh_symbol2scm("next"))) {
-                       unit->Next = UnitSlots[gh_scm2int(gh_car(list))];
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, 
gh_symbol2scm("current-sight-range"))) {
-                       unit->CurrentSightRange = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("host-info"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       MapMarkSight(player, gh_scm2int(gh_car(value)), 
gh_scm2int(gh_cadr(value)),
-                               gh_scm2int(gh_cadr(gh_cdr(value))),
-                               gh_scm2int(gh_cadr(gh_cdr(gh_cdr(value)))),
-                               unit->CurrentSightRange);
-               } else if (gh_eq_p(value, gh_symbol2scm("tile"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       unit->X = gh_scm2int(gh_car(value));
-                       unit->Y = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(value, gh_symbol2scm("stats"))) {
-                       unit->Stats = &type->Stats[gh_scm2int(gh_car(list))];
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("pixel"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       unit->IX = gh_scm2int(gh_car(value));
-                       unit->IY = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(value, gh_symbol2scm("seen-pixel"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       unit->SeenIX = gh_scm2int(gh_car(value));
-                       unit->SeenIY = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(value, gh_symbol2scm("frame"))) {
-                       unit->Frame = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("flipped-frame"))) {
-                       unit->Frame = -gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("seen"))) {
-                       unit->SeenFrame = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("flipped-seen"))) {
-                       unit->SeenFrame = -gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("not-seen"))) {
-                       unit->SeenFrame = UnitNotSeen;
-               } else if (gh_eq_p(value, gh_symbol2scm("direction"))) {
-                       unit->Direction = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("attacked"))) {
-                       // FIXME : unsigned long should be better handled
-                       unit->Attacked = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("burning"))) {
-                       unit->Burning = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("destroyed"))) {
-                       unit->Destroyed = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("seen-destroyed"))) {
-                       unit->SeenDestroyed = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("removed"))) {
-                       unit->Removed = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("selected"))) {
-                       unit->Selected = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("rescued-from"))) {
-                       unit->RescuedFrom = &Players[gh_scm2int(gh_car(list))];
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("visible"))) {
-                       str = s = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-                       for (i = 0; i < PlayerMax && *s; ++i, ++s) {
-                               if (*s == '-' || *s == '_' || *s == ' ') {
-                                       unit->Visible &= ~(1 << i);
-                               } else {
-                                       unit->Visible |= (1 << i);
-                               }
-                       }
-                       free(str);
-               } else if (gh_eq_p(value, gh_symbol2scm("constructed"))) {
-                       unit->Constructed = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("seen-constructed"))) {
-                       unit->SeenConstructed = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("seen-state"))) {
-                       unit->SeenState = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("active"))) {
-                       unit->Active = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("resource-active"))) {
-                       unit->Data.Resource.Active = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("mana"))) {
-                       unit->Mana = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("hp"))) {
-                       unit->HP = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("xp"))) {
-                       unit->XP = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("kills"))) {
-                       unit->Kills = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("ttl"))) {
-                       // FIXME : unsigned long should be better handled
-                       unit->TTL = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("bloodlust"))) {
-                       unit->Bloodlust = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("haste"))) {
-                       unit->Haste = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("slow"))) {
-                       unit->Slow = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("invisible"))) {
-                       unit->Invisible = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("flame-shield"))) {
-                       unit->FlameShield = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("unholy-armor"))) {
-                       unit->UnholyArmor = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("group-id"))) {
-                       unit->GroupId = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("last-group"))) {
-                       unit->LastGroup = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("value"))) {
-                       unit->Value = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("current-resource"))) {
-                       unit->CurrentResource = 
CclGetResourceByName(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("sub-action"))) {
-                       unit->SubAction = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("wait"))) {
-                       unit->Wait = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("state"))) {
-                       unit->State = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("reset"))) {
-                       unit->Reset = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("blink"))) {
-                       unit->Blink = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("moving"))) {
-                       unit->Moving = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("rs"))) {
-                       unit->Rs = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, 
gh_symbol2scm("units-contained-count"))) {
-                       insidecount = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("units-contained"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       for (i = 0; i < insidecount; ++i) {
-                                       value = gh_vector_ref(sublist, 
gh_int2scm(i));
-                               if (!gh_null_p(value)) {
-                                       str = gh_scm2newstr(value, NULL);
-                                       slot = strtol(str + 1, NULL, 16);
-                                       AddUnitInContainer(UnitSlots[slot], 
unit);
-                                       DebugCheck(!UnitSlots[slot]);
-                                       ++UnitSlots[slot]->Refs;
-                                       free(str);
-                               }
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("order-count"))) {
-                       unit->OrderCount = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("order-flush"))) {
-                       unit->OrderFlush = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("orders"))) {
-                       int hp;
-
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseOrders(sublist, unit);
-                       // now we know unit's action so we can assign it to a 
player
-                       hp = unit->HP;
-                       AssignUnitToPlayer (unit, player);
-                       unit->HP = hp;
-                       if (unit->Orders[0].Action == UnitActionBuilded) {
-                               // HACK: the building is not ready yet
-                               unit->Player->UnitTypesCount[type->Type]--;
-                       }
-                       // FIXME: (mr-russ) Does not load CorpseList Properly
-                       if (unit->Type->Building &&
-                                       (unit->Orders[0].Action == 
UnitActionDie || unit->Destroyed)) {
-                               DeadBuildingCacheInsert(unit);
-                       } else if (unit->Orders[0].Action == UnitActionDie) {
-                               CorpseCacheInsert(unit);
-                       }
-#if 0
-                       if (unit->Orders[0].Action == UnitActionDie &&
-                                       unit->Type->CorpseScript) {
-                               MapMarkUnitSight(unit);
-                       }
-#endif
-               } else if (gh_eq_p(value, gh_symbol2scm("saved-order"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseOrder(value, &unit->SavedOrder);
-               } else if (gh_eq_p(value, gh_symbol2scm("new-order"))) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseOrder(value, &unit->NewOrder);
-               } else if (gh_eq_p(value, gh_symbol2scm("data-builded"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseBuilded(unit, sublist);
-               } else if (gh_eq_p(value, gh_symbol2scm("data-res-worker"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseResWorker(unit, sublist);
-               } else if (gh_eq_p(value, gh_symbol2scm("data-research"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseResearch(unit, sublist);
-               } else if (gh_eq_p(value, gh_symbol2scm("data-upgrade-to"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseUpgradeTo(unit, sublist);
-               } else if (gh_eq_p(value, gh_symbol2scm("data-train"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseTrain(unit, sublist);
-               } else if (gh_eq_p(value, gh_symbol2scm("data-move"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       CclParseMove(unit, sublist);
-               } else if (gh_eq_p(value, gh_symbol2scm("goal"))) {
-                       unit->Goal = UnitSlots[gh_scm2int(gh_car(list))];
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("auto-cast"))) {
-                       str = gh_scm2newstr(gh_car(list),NULL);
-                       unit->AutoCastSpell = SpellTypeByIdent(str);
-                       list = gh_cdr(list);
-                       free(str);
-               } else {
-                  // This leaves a half initialized unit
-                  errl("Unsupported tag", value);
-               }
-       }
-
-       if (!unit->Player) {
-               AssignUnitToPlayer (unit, player);
-               UpdateForNewUnit(unit, 0);
-               unit->HP = unit->Type->_HitPoints;
-       }
-
-       //  Revealers are units that can see while removed
-       if (unit->Removed && unit->Type->Revealer) {
-                       MapMarkUnitSight(unit);
-       }
-
-       //              Place on map
-       if (!unit->Removed && !unit->Destroyed && !unit->Type->Vanishes) {
-               unit->Removed = 1;
-               PlaceUnit(unit, unit->X, unit->Y);
-       }
-
-       // FIXME: johns: works only for debug code.
-       if (unit->Moving) {
-               NewResetPath(unit);
-       }
-       // Fix Colors for rescued units.
-       if (unit->RescuedFrom) {
-               unit->Colors = &unit->RescuedFrom->UnitColors;
-       }
-       DebugLevel3Fn("unit #%d parsed\n" _C_ slot);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclUnit(lua_State* l)
 {
        const char* value;
@@ -1699,7 +973,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Make a unit.
@@ -1709,18 +982,6 @@
 **
 **             @return                         Returns the slot number of the 
made unit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclMakeUnit(SCM type, SCM player)
-{
-       UnitType* unittype;
-       Unit* unit;
-
-       unittype = CclGetUnitType(type);
-       unit = MakeUnit(unittype, &Players[gh_scm2int(player)]);
-
-       return gh_int2scm(unit->Slot);
-}
-#elif defined(USE_LUA)
 local int CclMakeUnit(lua_State* l)
 {
        UnitType* unittype;
@@ -1739,7 +1000,6 @@
        lua_pushnumber(l, unit->Slot);
        return 1;
 }
-#endif
 
 /**
 **             Place a unit on map.
@@ -1750,13 +1010,6 @@
 **
 **             @return                         Returns the slot number of the 
made placed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclPlaceUnit(SCM unit, SCM x, SCM y)
-{
-       PlaceUnit(CclGetUnit(unit), gh_scm2int(x), gh_scm2int(y));
-       return unit;
-}
-#elif defined(USE_LUA)
 local int CclPlaceUnit(lua_State* l)
 {
        Unit* unit;
@@ -1773,7 +1026,6 @@
        lua_pushvalue(l, 1);
        return 1;
 }
-#endif
 
 /**
 **             Create a unit and place it on the map
@@ -1785,42 +1037,6 @@
 **
 **             @return                         Returns the slot number of the 
made unit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclCreateUnit(SCM type, SCM player, SCM x, SCM y)
-{
-       UnitType* unittype;
-       Unit* unit;
-       int heading;
-       int playerno;
-       int mask;
-       int ix;
-       int iy;
-
-       unittype = CclGetUnitType(type);
-       ix = gh_scm2int(x);
-       iy = gh_scm2int(y);
-
-       heading = SyncRand() % 256;
-       playerno = TriggerGetPlayer(player);
-       if (playerno == -1) {
-               printf("CreateUnit: You cannot use 'any in create-unit, specify 
a player\n");
-               errl("bad player", player);
-               return SCM_UNSPECIFIED;
-       }
-       unit = MakeUnit(unittype, &Players[playerno]);
-       mask = UnitMovementMask(unit);
-       if (CheckedCanMoveToMask(ix, iy, mask)) {
-               unit->Wait = 1;
-               PlaceUnit(unit, ix, iy);
-       } else {
-               unit->X = ix;
-               unit->Y = iy;
-               DropOutOnSide(unit, heading, unittype->TileWidth, 
unittype->TileHeight);
-       }
-
-       return gh_int2scm(unit->Slot);
-}
-#elif defined(USE_LUA)
 local int CclCreateUnit(lua_State* l)
 {
        UnitType* unittype;
@@ -1866,86 +1082,12 @@
        lua_pushnumber(l, unit->Slot);
        return 1;
 }
-#endif
 
 /**
 **             Order a unit
 **
 **             (order-unit player unit-type sloc dloc order)
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclOrderUnit(SCM list)
-{
-       int plynr;
-       int x1;
-       int y1;
-       int x2;
-       int y2;
-       int dx1;
-       int dy1;
-       int dx2;
-       int dy2;
-       const UnitType* unittype;
-       Unit* table[UnitMax];
-       Unit* unit;
-       int an;
-       int j;
-       char* order;
-
-       plynr = TriggerGetPlayer(gh_car(list));
-       list = gh_cdr(list);
-       unittype = TriggerGetUnitType(gh_car(list));
-       list = gh_cdr(list);
-       x1 = gh_scm2int(gh_car(gh_car(list)));
-       y1 = gh_scm2int(gh_car(gh_cdr(gh_car(list))));
-       if (!gh_null_p(gh_cdr(gh_cdr(gh_car(list))))) {
-               x2 = gh_scm2int(gh_car(gh_cdr(gh_cdr(gh_car(list)))));
-               y2 = gh_scm2int(gh_car(gh_cdr(gh_cdr(gh_cdr(gh_car(list))))));
-       } else {
-               x2 = x1;
-               y2 = y1;
-       }
-       list = gh_cdr(list);
-       dx1 = gh_scm2int(gh_car(gh_car(list)));
-       dy1 = gh_scm2int(gh_car(gh_cdr(gh_car(list))));
-       if (!gh_null_p(gh_cdr(gh_cdr(gh_car(list))))) {
-               dx2 = gh_scm2int(gh_car(gh_cdr(gh_cdr(gh_car(list)))));
-               dy2 = gh_scm2int(gh_car(gh_cdr(gh_cdr(gh_cdr(gh_car(list))))));
-       } else {
-               dx2 = dx1;
-               dy2 = dy1;
-       }
-       list = gh_cdr(list);
-       order = gh_scm2newstr(gh_car(list),NULL);
-
-       an = SelectUnits(x1, y1, x2 + 1, y2 + 1, table);
-       for (j = 0; j < an; ++j) {
-               unit = table[j];
-               if (unittype == ANY_UNIT ||
-                               (unittype == ALL_FOODUNITS && 
!unit->Type->Building) ||
-                               (unittype == ALL_BUILDINGS && 
unit->Type->Building) ||
-                               unittype == unit->Type) {
-                       if (plynr == -1 || plynr == unit->Player->Player) {
-                               if (!strcmp(order,"move")) {
-                                       CommandMove(unit, (dx1 + dx2) / 2, (dy1 
+ dy2) / 2, 1);
-                               } else if (!strcmp(order, "attack")) {
-                                       Unit* attack;
-
-                                       attack=TargetOnMap(unit, dx1, dy1, dx2, 
dy2);
-                                       CommandAttack(unit, (dx1 + dx2) / 2, 
(dy1 + dy2) / 2, attack, 1);
-                               } else if (!strcmp(order, "patrol")) {
-                                       CommandPatrolUnit(unit, (dx1 + dx2) / 
2, (dy1 + dy2) / 2, 1);
-                               } else {
-                                       errl("Unsupported order", gh_car(list));
-                               }
-                       }
-               }
-       }
-
-       free(order);
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclOrderUnit(lua_State* l)
 {
        int plynr;
@@ -2046,7 +1188,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Kill a unit
@@ -2056,39 +1197,6 @@
 **
 **             @return                         Returns true if a unit was 
killed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclKillUnit(SCM type, SCM player)
-{
-       int j;
-       int plynr;
-       const UnitType* unittype;
-       Unit* unit;
-       Unit** table;
-
-       unittype = TriggerGetUnitType(type);
-       plynr = TriggerGetPlayer(player);
-       if (plynr == -1) {
-               table = Units;
-               j = NumUnits - 1;
-       } else {
-               table = Players[plynr].Units;
-               j = Players[plynr].TotalNumUnits - 1;
-       }
-
-       for (; j >= 0; --j) {
-               unit = table[j];
-               if (unittype == ANY_UNIT ||
-                               (unittype == ALL_FOODUNITS && 
!unit->Type->Building) ||
-                               (unittype == ALL_BUILDINGS && 
unit->Type->Building) ||
-                               unittype == unit->Type) {
-                       LetUnitDie(unit);
-                       return SCM_BOOL_T;
-               }
-       }
-
-       return SCM_BOOL_F;
-}
-#elif defined(USE_LUA)
 local int CclKillUnit(lua_State* l)
 {
        int j;
@@ -2129,7 +1237,6 @@
        lua_pushboolean(l, 0);
        return 1;
 }
-#endif
 
 /**
 **             Kill a unit at a location
@@ -2141,47 +1248,6 @@
 **
 **             @return                         Returns the number of units 
killed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclKillUnitAt(SCM type, SCM player, SCM quantity, SCM loc)
-{
-       int plynr;
-       int q;
-       int x1;
-       int y1;
-       int x2;
-       int y2;
-       const UnitType* unittype;
-       Unit* table[UnitMax];
-       Unit* unit;
-       int an;
-       int j;
-       int s;
-
-       plynr = TriggerGetPlayer(player);
-       q = gh_scm2int(quantity);
-       unittype = TriggerGetUnitType(type);
-       x1 = gh_scm2int(gh_car(loc));
-       y1 = gh_scm2int(gh_car(gh_cdr(loc)));
-       x2 = gh_scm2int(gh_car(gh_cdr(gh_cdr(loc))));
-       y2 = gh_scm2int(gh_car(gh_cdr(gh_cdr(gh_cdr(loc)))));
-
-       an = SelectUnits(x1, y1, x2 + 1, y2 + 1, table);
-       for (j = s = 0; j < an && s < q; ++j) {
-               unit = table[j];
-               if (unittype == ANY_UNIT ||
-                               (unittype == ALL_FOODUNITS && 
!unit->Type->Building) ||
-                               (unittype == ALL_BUILDINGS && 
unit->Type->Building) ||
-                               unittype==unit->Type) {
-                       if (plynr == -1 || plynr == unit->Player->Player) {
-                               LetUnitDie(unit);
-                               ++s;
-                       }
-               }
-       }
-
-       return gh_int2scm(s);
-}
-#elif defined(USE_LUA)
 local int CclKillUnitAt(lua_State* l)
 {
        int plynr;
@@ -2243,7 +1309,6 @@
        lua_pushnumber(l, s);
        return 1;
 }
-#endif
 
 /**
 **             Get a player's units
@@ -2252,8 +1317,6 @@
 **
 **             @return                         Array of units.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-#elif defined(USE_LUA)
 local int CclGetUnits(lua_State* l)
 {
        int plynr;
@@ -2280,7 +1343,6 @@
        }
        return 1;
 }
-#endif
 
 /**
 **             Get the mana of the unit structure.
@@ -2289,15 +1351,6 @@
 **
 **             @return                         The mana of the unit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetUnitMana(SCM ptr)
-{
-       const Unit* unit;
-
-       unit = CclGetUnit(ptr);
-       return gh_int2scm(unit->Mana);
-}
-#elif defined(USE_LUA)
 local int CclGetUnitMana(lua_State* l)
 {
        const Unit* unit;
@@ -2311,7 +1364,6 @@
        lua_pushnumber(l, unit->Mana);
        return 1;
 }
-#endif
 
 /**
 **             Set the mana of the unit structure.
@@ -2321,25 +1373,6 @@
 **
 **             @return                         The new mana of the unit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetUnitMana(SCM ptr, SCM value)
-{
-       Unit* unit;
-       int mana;
-
-       unit = CclGetUnit(ptr);
-       mana = gh_scm2int(value);
-       if (unit->Type->CanCastSpell && unit->Type->_MaxMana) {
-               if (mana > unit->Type->_MaxMana) {
-                       unit->Mana = unit->Type->_MaxMana;
-               } else {
-                       unit->Mana = mana;
-               }
-       }
-
-       return gh_int2scm(mana);
-}
-#elif defined(USE_LUA)
 local int CclSetUnitMana(lua_State* l)
 {
        Unit* unit;
@@ -2365,7 +1398,6 @@
        lua_pushnumber(l, mana);
        return 1;
 }
-#endif
 
 /**
 **             Get the unholy-armor of the unit structure.
@@ -2374,15 +1406,6 @@
 **
 **             @return                         The unholy-armor of the unit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetUnitUnholyArmor(SCM ptr)
-{
-       const Unit* unit;
-
-       unit = CclGetUnit(ptr);
-       return gh_int2scm(unit->UnholyArmor);
-}
-#elif defined(USE_LUA)
 local int CclGetUnitUnholyArmor(lua_State* l)
 {
        const Unit* unit;
@@ -2396,7 +1419,6 @@
        lua_pushnumber(l, unit->UnholyArmor);
        return 1;
 }
-#endif
 
 /**
 **             Set the unholy-armor of the unit structure.
@@ -2406,17 +1428,6 @@
 **
 **             @return                         The value of the unit.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetUnitUnholyArmor(SCM ptr, SCM value)
-{
-       Unit* unit;
-
-       unit = CclGetUnit(ptr);
-       unit->UnholyArmor = gh_scm2int(value);
-
-       return value;
-}
-#elif defined(USE_LUA)
 local int CclSetUnitUnholyArmor(lua_State* l)
 {
        Unit* unit;
@@ -2434,59 +1445,10 @@
        lua_pushvalue(l, 2);
        return 1;
 }
-#endif
 
 /**
 **             FIXME: docu
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSlotUsage(SCM list)
-{
-#define SLOT_LEN MAX_UNIT_SLOTS / 8 + 1
-       unsigned char SlotUsage[SLOT_LEN];
-       int i;
-       int prev;
-       SCM value;
-
-       memset(SlotUsage, 0, SLOT_LEN);
-       prev = -1;
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("-"))) {
-                       int range_end;
-
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       range_end = gh_scm2int(value);
-                       for (i = prev; i <= range_end; ++i) {
-                               SlotUsage[i / 8] |= 1 << (i % 8);
-                       }
-                       prev = -1;
-               } else {
-                       if (prev >= 0) {
-                               SlotUsage[prev / 8] |= 1 << (prev % 8);
-                       }
-                       prev = gh_scm2int(value);
-               }
-       }
-       if (prev >= 0) {
-               SlotUsage[prev / 8] |= 1 << (prev % 8);
-       }
-
-       /* now walk through the bitfield and create the needed unit slots */
-       for (i = 0; i < SLOT_LEN * 8; ++i) {
-               if (SlotUsage[i / 8] & (1 << i % 8)) {
-                       Unit* new_unit = (Unit*)calloc(1, sizeof(Unit));
-                       UnitSlotFree = (void*)UnitSlots[i];
-                       UnitSlots[i] = new_unit;
-                       new_unit->Slot = i;
-               }
-       }
-       return SCM_UNSPECIFIED;
-#undef SLOT_LEN
-}
-#elif defined(USE_LUA)
 local int CclSlotUsage(lua_State* l)
 {
 #define SLOT_LEN MAX_UNIT_SLOTS / 8 + 1
@@ -2534,7 +1496,6 @@
        return 0;
 #undef SLOT_LEN
 }
-#endif
 
 // FIXME: write the missing access functions
 
@@ -2543,29 +1504,6 @@
 */
 global void UnitCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure1_0("set-xp-damage!", CclSetXpDamage);
-       gh_new_procedure1_0("set-training-queue!", CclSetTrainingQueue);
-       gh_new_procedure1_0("set-building-capture!", CclSetBuildingCapture);
-       gh_new_procedure1_0("set-reveal-attacker!", CclSetRevealAttacker);
-
-       gh_new_procedureN("unit", CclUnit);
-
-       gh_new_procedure2_0("make-unit", CclMakeUnit);
-       gh_new_procedure3_0("place-unit", CclPlaceUnit);
-       gh_new_procedure4_0("create-unit", CclCreateUnit);
-       gh_new_procedureN("order-unit", CclOrderUnit);
-       gh_new_procedure2_0("kill-unit", CclKillUnit);
-       gh_new_procedure4_0("kill-unit-at", CclKillUnitAt);
-
-       // unit member access functions
-       gh_new_procedure1_0("get-unit-mana", CclGetUnitMana);
-       gh_new_procedure2_0("set-unit-mana!", CclSetUnitMana);
-       gh_new_procedure1_0("get-unit-unholy-armor", CclGetUnitUnholyArmor);
-       gh_new_procedure2_0("set-unit-unholy-armor!", CclSetUnitUnholyArmor);
-
-       gh_new_procedure1_0 ("slot-usage", CclSlotUsage);
-#elif defined(USE_LUA)
        lua_register(Lua, "SetXPDamage", CclSetXpDamage);
        lua_register(Lua, "SetTrainingQueue", CclSetTrainingQueue);
        lua_register(Lua, "SetBuildingCapture", CclSetBuildingCapture);
@@ -2589,7 +1527,6 @@
        lua_register(Lua, "SetUnitUnholyArmor", CclSetUnitUnholyArmor);
 
        lua_register(Lua, "SlotUsage", CclSlotUsage);
-#endif
 }
 
 //@}
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.126 
stratagus/src/unit/ccl_unittype.c:1.127
--- stratagus/src/unit/ccl_unittype.c:1.126     Sat Dec 20 16:33:45 2003
+++ stratagus/src/unit/ccl_unittype.c   Fri Jan  2 08:24:20 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unittype.c,v 1.126 2003/12/20 05:33:45 jsalmon3 Exp $
+//     $Id: ccl_unittype.c,v 1.127 2004/01/01 21:24:20 jsalmon3 Exp $
 
 //@{
 
@@ -60,11 +60,6 @@
 
 global _AnimationsHash AnimationsHash;         /// Animations hash table
 
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local ccl_smob_type_t SiodUnitTypeTag;                         /// siod 
unit-type object
-#elif defined(USE_LUA)
-#endif
-
 global char** BoolFlagName = NULL;             /// Name of user defined flag
 global int NumberBoolFlag = 0;                         /// Number of defined 
flags.
 
@@ -78,20 +73,6 @@
 **             @param value            SCM thingie
 **             @return                 the resource id
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global unsigned CclGetResourceByName(SCM value)
-{
-       int i;
-
-       for (i = 0; i < MaxCosts; ++i) {
-               if (gh_eq_p(value, gh_symbol2scm(DefaultResourceNames[i]))) {
-                       return i;
-               }
-       }
-       errl("Unsupported resource tag", value);
-       return 0xABCDEF;
-}
-#elif defined(USE_LUA)
 global unsigned CclGetResourceByName(lua_State* l)
 {
        int i;
@@ -107,7 +88,6 @@
        lua_error(l);
        return 0xABCDEF;
 }
-#endif
 
 /**
 **             Parse unit-type.
@@ -116,594 +96,6 @@
 **
 **             @param list             List describing the unit-type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineUnitType(SCM list)
-{
-       SCM value;
-       SCM sublist;
-       UnitType* type;
-       UnitType* auxtype;
-       ResourceInfo* res;
-       char* str;
-       int i;
-       int redefine;
-
-       //              Slot identifier
-
-       str = gh_scm2newstr(gh_car(list), NULL);
-       list = gh_cdr(list);
-
-#ifdef DEBUG
-       i = NoWarningUnitType;
-       NoWarningUnitType = 1;
-#endif
-       type = UnitTypeByIdent(str);
-#ifdef DEBUG
-       NoWarningUnitType = i;
-#endif
-       if (type) {
-               DebugLevel3Fn("Redefining unit-type `%s'\n" _C_ str);
-               free(str);
-               redefine = 1;
-       } else {
-               DebugLevel3Fn("Defining unit-type `%s'\n" _C_ str);
-               type = NewUnitTypeSlot(str);
-               redefine = 0;
-               //Set some default values
-               type->_RegenerationRate = 0;
-               type->Selectable = 1;
-       }
-       type->BoolFlag = realloc(type->BoolFlag, NumberBoolFlag * sizeof 
(*type->BoolFlag));
-       memset(type->BoolFlag, 0, NumberBoolFlag * sizeof (*type->BoolFlag));
-       type->CanTargetFlag = realloc(type->CanTargetFlag, NumberBoolFlag * 
sizeof (*type->CanTargetFlag));
-       memset(type->CanTargetFlag, 0, NumberBoolFlag * sizeof 
(*type->CanTargetFlag));
-
-       type->NumDirections = 8;
-
-       //
-       //              Parse the list:         (still everything could be 
changed!)
-       //
-       while (!gh_null_p(list)) {
-
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("name"))) {
-                       if (redefine) {
-                               free(type->Name);
-                       }
-                       type->Name = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("use"))) {
-                       if (redefine) {
-                               free(type->SameSprite);
-                       }
-                       type->SameSprite = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("files"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               char* str;
-
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               // FIXME: use a general get tileset function 
here!
-                               str = gh_scm2newstr(value, NULL);
-                               i = 0;
-                               if (strcmp(str, "default")) {
-                                       for (; i < NumTilesets; ++i) {
-                                               if (!strcmp(str, 
Tilesets[i]->Ident) ||
-                                                               !strcmp(str, 
Tilesets[i]->Class)) {
-                                                       break;
-                                               }
-                                       }
-                                       if (i == NumTilesets) {
-                                          // This leaves half initialized 
unit-type
-                                          errl("Unsupported tileset tag", 
value);
-                                       }
-                               }
-                               free(str);
-                               if (redefine) {
-                                       free(type->File[i]);
-                               }
-                               type->File[i] = gh_scm2newstr(gh_car(sublist), 
NULL);
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("shadow"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               if (gh_eq_p(value, gh_symbol2scm("file"))) {
-                                       if (redefine) {
-                                               free(type->ShadowFile);
-                                       }
-                                       type->ShadowFile = 
gh_scm2newstr(gh_car(sublist), NULL);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("size"))) {
-                                       type->ShadowWidth = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                       type->ShadowHeight = 
gh_scm2int(gh_car(gh_cdr(gh_car(sublist))));
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("height"))) {
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("offset"))) {
-                                       type->ShadowOffsetX = 
gh_scm2int(gh_car(gh_car(sublist)));
-                                       type->ShadowOffsetY = 
gh_scm2int(gh_car(gh_cdr(gh_car(sublist))));
-                               } else {
-                                       errl("Unsupported shadow tag", value);
-                               }
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       type->Width = gh_scm2int(gh_car(sublist));
-                       type->Height = gh_scm2int(gh_cadr(sublist));
-               } else if (gh_eq_p(value, gh_symbol2scm("animations"))) {
-                       type->Animations =
-                               AnimationsByIdent(str = 
gh_scm2newstr(gh_car(list), NULL));
-                       free(str);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
-                       if (redefine) {
-                               free(type->Icon.Name);
-                       }
-                       type->Icon.Name = gh_scm2newstr(gh_car(list), NULL);
-                       type->Icon.Icon = NULL;
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("costs"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               type->_Costs[CclGetResourceByName(value)] = 
gh_scm2int(gh_car(sublist));
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("improve-production"))) 
{
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               
type->ImproveIncomes[CclGetResourceByName(value)] =
-                                               
DefaultIncomes[CclGetResourceByName(value)] + gh_scm2int(gh_car(sublist));
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("construction"))) {
-                       // FIXME: What if constructions aren't yet loaded?
-                       str = gh_scm2newstr(gh_car(list), NULL);
-                       type->Construction = ConstructionByIdent(str);
-                       list = gh_cdr(list);
-                       free(str);
-               } else if (gh_eq_p(value, gh_symbol2scm("speed"))) {
-                       type->_Speed = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("draw-level"))) {
-                       type->DrawLevel = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("max-on-board"))) {
-                       type->MaxOnBoard = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("hit-points"))) {
-                       type->_HitPoints = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("regeneration-rate"))) {
-                       type->_RegenerationRate = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("burn-percent"))) {
-                       type->BurnPercent = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("burn-damage-rate"))) {
-                       type->BurnDamageRate = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("max-mana"))) {
-                       type->_MaxMana = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("tile-size"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       type->TileWidth = gh_scm2int(gh_car(sublist));
-                       type->TileHeight = gh_scm2int(gh_cadr(sublist));
-               } else if (gh_eq_p(value, gh_symbol2scm("must-build-on-top"))) {
-                       str = gh_scm2newstr(gh_car(list), NULL);
-                       auxtype = UnitTypeByIdent(str);
-                       if (!auxtype) {
-                               DebugLevel0("Build on top of undefined unit 
\"%s\".\n" _C_ str);
-                               DebugCheck(1);
-                       }
-                       type->MustBuildOnTop = auxtype;
-                       free(str);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("not-selectable"))) {
-                       type->Selectable = 0;
-               } else if (gh_eq_p(value, 
gh_symbol2scm("neutral-minimap-color"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-#ifdef USE_SDL_SURFACE
-                       type->NeutralMinimapColorRGB.r = 
gh_scm2int(gh_car(sublist));
-                       type->NeutralMinimapColorRGB.g = 
gh_scm2int(gh_car(gh_cdr(sublist)));
-                       type->NeutralMinimapColorRGB.b = 
gh_scm2int(gh_car(gh_cdr(gh_cdr(sublist))));
-#else
-                       type->NeutralMinimapColorRGB.D24.a = 
gh_scm2int(gh_car(sublist));
-                       type->NeutralMinimapColorRGB.D24.b = 
gh_scm2int(gh_car(gh_cdr(sublist)));
-                       type->NeutralMinimapColorRGB.D24.c = 
gh_scm2int(gh_car(gh_cdr(gh_cdr(sublist))));
-#endif
-               } else if (gh_eq_p(value, gh_symbol2scm("box-size"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       type->BoxWidth = gh_scm2int(gh_car(sublist));
-                       type->BoxHeight = gh_scm2int(gh_cadr(sublist));
-               } else if (gh_eq_p(value, gh_symbol2scm("num-directions"))) {
-                       type->NumDirections = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("revealer"))) {
-                       type->Revealer = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("sight-range"))) {
-                       type->_SightRange = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, 
gh_symbol2scm("computer-reaction-range"))) {
-                       type->ReactRangeComputer = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, 
gh_symbol2scm("person-reaction-range"))) {
-                       type->ReactRangePerson = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("armor"))) {
-                       type->_Armor = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("basic-damage"))) {
-                       type->_BasicDamage = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("piercing-damage"))) {
-                       type->_PiercingDamage = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("missile"))) {
-                       type->Missile.Name = gh_scm2newstr(gh_car(list), NULL);
-                       type->Missile.Missile = NULL;
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("min-attack-range"))) {
-                       type->MinAttackRange = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("max-attack-range"))) {
-                       type->_AttackRange = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("priority"))) {
-                       type->Priority = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, 
gh_symbol2scm("annoy-computer-factor"))) {
-                       type->AnnoyComputerFactor = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("decay-rate"))) {
-                       type->DecayRate = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("points"))) {
-                       type->Points = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("demand"))) {
-                       type->Demand = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("supply"))) {
-                       type->Supply = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("corpse"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       if (redefine) {
-                               free(type->CorpseName);
-                       }
-                       type->CorpseName = gh_scm2newstr(gh_car(sublist), NULL);
-                       type->CorpseType = NULL;
-                       type->CorpseScript = gh_scm2int(gh_cadr(sublist));
-               } else if (gh_eq_p(value, 
gh_symbol2scm("explode-when-killed"))) {
-                       type->ExplodeWhenKilled = 1;
-                       type->Explosion.Name = gh_scm2newstr(gh_car(list), 
NULL);
-                       type->Explosion.Missile = NULL;
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("type-land"))) {
-                       type->UnitType = UnitTypeLand;
-               } else if (gh_eq_p(value, gh_symbol2scm("type-fly"))) {
-                       type->UnitType = UnitTypeFly;
-               } else if (gh_eq_p(value, gh_symbol2scm("type-naval"))) {
-                       type->UnitType = UnitTypeNaval;
-
-               } else if (gh_eq_p(value, gh_symbol2scm("right-none"))) {
-                       type->MouseAction = MouseActionNone;
-               } else if (gh_eq_p(value, gh_symbol2scm("right-attack"))) {
-                       type->MouseAction = MouseActionAttack;
-               } else if (gh_eq_p(value, gh_symbol2scm("right-move"))) {
-                       type->MouseAction = MouseActionMove;
-               } else if (gh_eq_p(value, gh_symbol2scm("right-harvest"))) {
-                       type->MouseAction = MouseActionHarvest;
-               } else if (gh_eq_p(value, gh_symbol2scm("right-spell-cast"))) {
-                       type->MouseAction = MouseActionSpellCast;
-               } else if (gh_eq_p(value, gh_symbol2scm("right-sail"))) {
-                       type->MouseAction = MouseActionSail;
-
-               } else if (gh_eq_p(value, gh_symbol2scm("can-ground-attack"))) {
-                       type->GroundAttack = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("can-attack"))) {
-                       type->CanAttack = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("repair-range"))) {
-                       type->RepairRange = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("repair-hp"))) {
-                       type->RepairHP = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("repair-costs"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               type->RepairCosts[CclGetResourceByName(value)] 
= gh_scm2int(gh_car(sublist));
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("can-target-land"))) {
-                       type->CanTarget |= CanTargetLand;
-               } else if (gh_eq_p(value, gh_symbol2scm("can-target-sea"))) {
-                       type->CanTarget |= CanTargetSea;
-               } else if (gh_eq_p(value, gh_symbol2scm("can-target-air"))) {
-                       type->CanTarget |= CanTargetAir;
-
-               } else if (gh_eq_p(value, gh_symbol2scm("building"))) {
-                       type->Building = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("visible-under-fog"))) {
-                       type->VisibleUnderFog = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("builder-outside"))) {
-                       type->BuilderOutside = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("builder-lost"))) {
-                       type->BuilderLost = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("auto-build-rate"))) {
-                       type->AutoBuildRate = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("shore-building"))) {
-                       type->ShoreBuilding = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("land-unit"))) {
-                       type->LandUnit = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("air-unit"))) {
-                       type->AirUnit = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("sea-unit"))) {
-                       type->SeaUnit = 1;
-               } else if (gh_eq_p(value, 
gh_symbol2scm("random-movement-probability"))) {
-                       type->RandomMovementProbability = 
gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("clicks-to-explode"))) {
-                       type->ClicksToExplode = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("permanent-cloak"))) {
-                       type->PermanentCloak = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("detect-cloak"))) {
-                       type->DetectCloak = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("transporter"))) {
-                       type->Transporter = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("coward"))) {
-                       type->Coward = 1;
-               } else if (gh_eq_p(value, 
gh_symbol2scm("can-gather-resource"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       res = (ResourceInfo*)malloc(sizeof(ResourceInfo));
-                       memset(res, 0, sizeof(ResourceInfo));
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               if (gh_eq_p(value, 
gh_symbol2scm("resource-id"))) {
-                                       res->ResourceId = 
CclGetResourceByName(gh_car(sublist));
-                                       type->ResInfo[res->ResourceId] = res;
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("resource-step"))) {
-                                       res->ResourceStep = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("final-resource"))) {
-                                       res->FinalResource = 
CclGetResourceByName(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("wait-at-resource"))) {
-                                       res->WaitAtResource = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("wait-at-depot"))) {
-                                       res->WaitAtDepot = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("resource-capacity"))) {
-                                       res->ResourceCapacity = 
gh_scm2int(gh_car(sublist));
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("terrain-harvester"))) {
-                                       res->TerrainHarvester = 1;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("lose-resources"))) {
-                                       res->LoseResources = 1;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("harvest-from-outside"))) {
-                                       res->HarvestFromOutside = 1;
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("file-when-empty"))) {
-                                       res->FileWhenEmpty = 
gh_scm2newstr(gh_car(sublist),0);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("file-when-loaded"))) {
-                                       res->FileWhenLoaded = 
gh_scm2newstr(gh_car(sublist),0);
-                                       sublist = gh_cdr(sublist);
-                               } else {
-                                  printf("\n%s\n",type->Name);
-                                  errl("Unsupported tag", value);
-                                  DebugCheck(1);
-                               }
-                       }
-                       type->Harvester = 1;
-                       if (!res->FinalResource) {
-                               res->FinalResource = res->ResourceId;
-                       }
-                       DebugCheck(!res->ResourceId);
-               } else if (gh_eq_p(value, gh_symbol2scm("gives-resource"))) {
-                       type->GivesResource = 
CclGetResourceByName(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("can-harvest"))) {
-                       type->CanHarvest = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("can-store"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               
type->CanStore[CclGetResourceByName(gh_car(sublist))] = 1;
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("vanishes"))) {
-                       type->Vanishes = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("can-cast-spell"))) {
-                       //
-                       //      Warning: can-cast-spell should only be used 
AFTER all spells
-                       //      have been defined. FIXME: MaxSpellType=500 or 
something?
-                       //
-                       if (!type->CanCastSpell) {
-                               type->CanCastSpell = malloc(SpellTypeCount);
-                               memset(type->CanCastSpell, 0, SpellTypeCount);
-                       }
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       if (gh_null_p(sublist)) { // empty list
-                               free(type->CanCastSpell);
-                               type->CanCastSpell = NULL;
-                       }
-                       while (!gh_null_p(sublist)) {
-                               int id;
-                               id = CclGetSpellByIdent(gh_car(sublist));
-                               DebugLevel3Fn("%d \n" _C_ id);
-                               if (id == -1) {
-                                       errl("Unknown spell type", 
gh_car(sublist));
-                               }
-                               type->CanCastSpell[id] = 1;
-                               sublist = gh_cdr(sublist);
-                       }
-               } else if (gh_eq_p(value, gh_symbol2scm("can-target-flag"))) {
-                       //
-                       //      Warning: can-target-flag should only be used 
AFTER all bool flags
-                       //      have been defined.
-                       //
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-                               for (i = 0; i < NumberBoolFlag; ++i) {
-                                       if (gh_eq_p(value, 
gh_symbol2scm(BoolFlagName[i]))) {
-                                               type->CanTargetFlag[i] = 
Scm2Condition(gh_car(sublist));
-                                               sublist = gh_cdr(sublist);
-                                               break;
-                                       }
-                               }
-                               if (i != NumberBoolFlag) {
-                                       continue;
-                               }
-                               printf("\n%s\n", type->Name);
-                               errl("Unsupported flag tag for 
can-target-flag", value);
-                       }
-               } else if (gh_eq_p(value, 
gh_symbol2scm("selectable-by-rectangle"))) {
-                       type->SelectableByRectangle = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("teleporter"))) {
-                       type->Teleporter = 1;
-               } else if (gh_eq_p(value, gh_symbol2scm("sounds"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               if (gh_eq_p(value, gh_symbol2scm("selected"))) {
-                                       if (redefine) {
-                                               free(type->Sound.Selected.Name);
-                                       }
-                                       type->Sound.Selected.Name = 
gh_scm2newstr(
-                                               gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("acknowledge"))) {
-                                       if (redefine) {
-                                               
free(type->Sound.Acknowledgement.Name);
-                                       }
-                                       type->Sound.Acknowledgement.Name = 
gh_scm2newstr(
-                                               gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("ready"))) {
-                                       if (redefine) {
-                                               free(type->Sound.Ready.Name);
-                                       }
-                                       type->Sound.Ready.Name = gh_scm2newstr(
-                                               gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("repair"))) {
-                                       if (redefine) {
-                                               free(type->Sound.Repair.Name);
-                                       }
-                                       type->Sound.Repair.Name = gh_scm2newstr(
-                                               gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("harvest"))) {
-                                       int res;
-                                       char* name;
-
-                                       name = gh_scm2newstr(gh_car(sublist), 
NULL);
-                                       sublist = gh_cdr(sublist);
-                                       for (res = 0; res < MaxCosts; ++res) {
-                                               if (!strcmp(name, 
DefaultResourceNames[res])) {
-                                                       break;
-                                               }
-                                       }
-                                       if (res == MaxCosts) {
-                                               errl("Resource not found", 
value);
-                                       }
-                                       free(name);
-                                       if (redefine) {
-                                               
free(type->Sound.Harvest[res].Name);
-                                       }
-                                       type->Sound.Harvest[res].Name = 
gh_scm2newstr(
-                                               gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("help"))) {
-                                       if (redefine) {
-                                               free(type->Sound.Help.Name);
-                                       }
-                                       type->Sound.Help.Name = gh_scm2newstr(
-                                               gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("dead"))) {
-                                       if (redefine) {
-                                               free(type->Sound.Dead.Name);
-                                       }
-                                       type->Sound.Dead.Name = gh_scm2newstr(
-                                               gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else if (gh_eq_p(value, 
gh_symbol2scm("attack"))) {
-                                       if (redefine) {
-                                               free(type->Weapon.Attack.Name);
-                                       }
-                                       type->Weapon.Attack.Name = 
gh_scm2newstr(
-                                               gh_car(sublist), NULL);
-                                       sublist = gh_cdr(sublist);
-                               } else {
-                                       errl("Unsupported sound tag", value);
-                               }
-                       }
-               } else {
-                       for (i = 0; i < NumberBoolFlag; i++) { // User defined 
bool flags
-                               if (gh_eq_p(value, 
gh_symbol2scm(BoolFlagName[i]))) {
-                                       type->BoolFlag[i] = 1;
-                                       break;
-                               }
-                       }
-                       if (i != NumberBoolFlag) {
-                               continue;
-                       }
-                       // This leaves a half initialized unit-type
-                       printf("\n%s\n",type->Name);
-                       errl("Unsupported tag", value);
-                       DebugCheck(1);
-               }
-       }
-
-       // FIXME: try to simplify/combine the flags instead
-       if (type->MouseAction == MouseActionAttack && !type->CanAttack) {
-               printf("Unit-type `%s': right-attack is set, but can-attack is 
not\n", type->Name);
-               // ugly way to show the line number
-               errl("", SCM_UNSPECIFIED);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineUnitType(lua_State* l)
 {
        const char* value;
@@ -1418,99 +810,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Parse unit-stats.
 **
 **             @param list             List describing the unit-stats.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineUnitStats(SCM list)
-{
-       SCM value;
-       //SCM data;
-       SCM sublist;
-       UnitType* type;
-       UnitStats* stats;
-       int i;
-       char* str;
-
-       type = UnitTypeByIdent(str = gh_scm2newstr(gh_car(list), NULL));
-       DebugCheck(!type);
-
-       free(str);
-       list = gh_cdr(list);
-       i = gh_scm2int(gh_car(list));
-       DebugCheck(i >= PlayerMax);
-       list = gh_cdr(list);
-
-       stats = &type->Stats[i];
-
-       //
-       //              Parse the list:         (still everything could be 
changed!)
-       //
-       while (!gh_null_p(list)) {
-
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               if (gh_eq_p(value, gh_symbol2scm("level"))) {
-                       stats->Level = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("speed"))) {
-                       stats->Speed = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("attack-range"))) {
-                       stats->AttackRange = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("sight-range"))) {
-                       stats->SightRange = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("armor"))) {
-                       stats->Armor = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("basic-damage"))) {
-                       stats->BasicDamage = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("piercing-damage"))) {
-                       stats->PiercingDamage = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("hit-points"))) {
-                       stats->HitPoints = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("regeneration-rate"))) {
-                       stats->RegenerationRate = gh_scm2int(gh_car(list));
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("costs"))) {
-                       sublist = gh_car(list);
-                       list = gh_cdr(list);
-                       while (!gh_null_p(sublist)) {
-
-                               value = gh_car(sublist);
-                               sublist = gh_cdr(sublist);
-
-                               for (i = 0; i < MaxCosts; ++i) {
-                                       if (gh_eq_p(value, 
gh_symbol2scm(DefaultResourceNames[i]))) {
-                                               stats->Costs[i] = 
gh_scm2int(gh_car(sublist));
-                                               break;
-                                       }
-                               }
-                               if (i == MaxCosts) {
-                                  // This leaves half initialized stats
-                                  errl("Unsupported tag", value);
-                               }
-                               sublist = gh_cdr(sublist);
-                       }
-               } else {
-                  // This leaves a half initialized unit
-                  errl("Unsupported tag", value);
-               }
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineUnitStats(lua_State* l)
 {
        const char* value;
@@ -1598,33 +903,12 @@
 
        return 0;
 }
-#endif
 
 // ----------------------------------------------------------------------------
 
 /**
 **             Access unit-type object
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global UnitType* CclGetUnitType(SCM ptr)
-{
-       char* str;
-       UnitType* type;
-
-       // Be kind allow also strings or symbols
-       if ((str = CclConvertToString(ptr)) != NULL)  {
-               DebugLevel3("CclGetUnitType: %s\n"_C_ str);
-               type = UnitTypeByIdent(str);
-               free(str);
-               return type;
-       } else if (CclGetSmobType(ptr) == SiodUnitTypeTag)  {
-               return CclGetSmobData(ptr);
-       } else {
-               errl("CclGetUnitType: not a unit-type", ptr);
-               return 0;
-       }
-}
-#elif defined(USE_LUA)
 global UnitType* CclGetUnitType(lua_State* l)
 {
        const char* str;
@@ -1645,37 +929,6 @@
        lua_error(l);
        return NULL;
 }
-#endif
-
-/**
-**             Print the unit-type object
-**
-**             @param ptr              Scheme object.
-**             @param f                Output structure.
-*/
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local void CclUnitTypePrin1(SCM ptr, struct gen_printio* f)
-{
-#ifndef USE_GUILE
-       char buf[1024];
-       const UnitType* type;
-
-       type = CclGetUnitType(ptr);
-
-       if (type) {
-               if (type->Ident) {
-                       sprintf(buf, "#<UnitType %p '%s'>", type, type->Ident);
-               } else {
-                       sprintf(buf, "#<UnitType %p '(null)'>", type);
-               }
-       } else {
-               sprintf(buf, "#<UnitType NULL>");
-       }
-
-       gput_st(f,buf);
-#endif
-}
-#endif
 
 /**
 **             Get unit-type structure.
@@ -1684,24 +937,6 @@
 **
 **             @return                         Unit-type structure.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclUnitType(SCM ident)
-{
-       char* str;
-       UnitType* type;
-
-       str = CclConvertToString(ident);
-       if (str) {
-               type = UnitTypeByIdent(str);
-               DebugLevel3Fn("CclUnitType: '%s' -> '%ld'\n" _C_ str _C_ 
(long)type);
-               free(str);
-               return CclMakeSmobObj(SiodUnitTypeTag, type);
-       } else {
-               errl("CclUnitType: no unittype by ident: ", ident);
-               return SCM_BOOL_F;
-       }
-}
-#elif defined(USE_LUA)
 local int CclUnitType(lua_State* l)
 {
        const char* str;
@@ -1721,29 +956,12 @@
        data->Data = type;
        return 1;
 }
-#endif
 
 /**
 **             Get all unit-type structures.
 **
 **             @return                         An array of all unit-type 
structures.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclUnitTypeArray(void)
-{
-       SCM array;
-       SCM value;
-       int i;
-
-       array = cons_array(gh_int2scm(NumUnitTypes), NIL);
-
-       for (i = 0; i < NumUnitTypes; ++i) {
-               value = CclMakeSmobObj(SiodUnitTypeTag, &UnitTypes[i]);
-               gh_vector_set_x(array, gh_int2scm(i), value);
-       }
-       return array;
-}
-#elif defined(USE_LUA)
 local int CclUnitTypeArray(lua_State* l)
 {
        int i;
@@ -1764,7 +982,6 @@
        }
        return 1;
 }
-#endif
 
 /**
 **             Get the ident of the unit-type structure.
@@ -1773,17 +990,6 @@
 **
 **             @return                         The identifier of the unit-type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetUnitTypeIdent(SCM ptr)
-{
-       const UnitType* type;
-       SCM value;
-
-       type = CclGetUnitType(ptr);
-       value = gh_str02scm(type->Ident);
-       return value;
-}
-#elif defined(USE_LUA)
 local int CclGetUnitTypeIdent(lua_State* l)
 {
        const UnitType* type;
@@ -1797,7 +1003,6 @@
        lua_pushstring(l, type->Ident);
        return 1;
 }
-#endif
 
 /**
 **             Get the name of the unit-type structure.
@@ -1806,17 +1011,6 @@
 **
 **             @return                         The name of the unit-type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetUnitTypeName(SCM ptr)
-{
-       const UnitType* type;
-       SCM value;
-
-       type = CclGetUnitType(ptr);
-       value = gh_str02scm(type->Name);
-       return value;
-}
-#elif defined(USE_LUA)
 local int CclGetUnitTypeName(lua_State* l)
 {
        const UnitType* type;
@@ -1830,7 +1024,6 @@
        lua_pushstring(l, type->Name);
        return 1;
 }
-#endif
 
 /**
 **             Set the name of the unit-type structure.
@@ -1840,18 +1033,6 @@
 **
 **             @return                         The name of the unit-type.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSetUnitTypeName(SCM ptr, SCM name)
-{
-       UnitType* type;
-
-       type = CclGetUnitType(ptr);
-       free(type->Name);
-       type->Name = gh_scm2newstr(name, NULL);
-
-       return name;
-}
-#elif defined(USE_LUA)
 local int CclSetUnitTypeName(lua_State* l)
 {
        UnitType* type;
@@ -1870,40 +1051,12 @@
        lua_pushvalue(l, 2);
        return 1;
 }
-#endif
 
 /**
 **             Define tileset mapping from original number to internal symbol
 **
 **             @param list             List of all names.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineUnitTypeWcNames(SCM list)
-{
-       int i;
-       char** cp;
-
-       if ((cp = UnitTypeWcNames)) {                           // Free all old 
names
-               while (*cp) {
-                       free(*cp++);
-               }
-               free(UnitTypeWcNames);
-       }
-
-       //
-       //              Get new table.
-       //
-       i = gh_length(list);
-       UnitTypeWcNames = cp = malloc((i + 1) * sizeof(char*));
-       while (i--) {
-               *cp++ = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-       }
-       *cp = NULL;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineUnitTypeWcNames(lua_State* l)
 {
        int i;
@@ -1934,7 +1087,6 @@
 
        return 0;
 }
-#endif
 
 // ----------------------------------------------------------------------------
 
@@ -1943,105 +1095,6 @@
 **
 **             @param list             Animations list.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineAnimations(SCM list)
-{
-       char* str;
-       SCM id;
-       SCM value;
-       SCM resource;
-       Animations* anims;
-       Animation* anim;
-       Animation* t;
-       int i;
-       int frame;
-
-       resource = NULL;
-       str = gh_scm2newstr(gh_car(list), NULL);
-       list = gh_cdr(list);
-       anims = calloc(1, sizeof(Animations));
-
-       while (!gh_null_p(list)) {
-               id = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(id, gh_symbol2scm("harvest"))) {
-                       resource = gh_car(list);
-                       list = gh_cdr(list);
-               }
-               value = gh_car(list);
-               list = gh_cdr(list);
-
-               t = anim = malloc(gh_length(value) * sizeof(Animation));
-               frame = 0;
-               while (!gh_null_p(value)) {
-                       t->Flags = gh_scm2int(gh_vector_ref(gh_car(value), 
gh_int2scm(0)));
-                       t->Pixel = gh_scm2int(gh_vector_ref(gh_car(value), 
gh_int2scm(1)));
-                       t->Sleep = gh_scm2int(gh_vector_ref(gh_car(value), 
gh_int2scm(2)));
-                       i = gh_scm2int(gh_vector_ref(gh_car(value), 
gh_int2scm(3)));
-                       t->Frame = i - frame;
-                       frame = i;
-                       if (t->Flags & AnimationRestart) {
-                               frame = 0;
-                       }
-                       ++t;
-                       value = gh_cdr(value);
-               }
-               t[-1].Flags |= 0x80;                            // Marks end of 
list
-
-               if (gh_eq_p(id, gh_symbol2scm("still"))) {
-                       if (anims->Still) {
-                               free(anims->Still);
-                       }
-                       anims->Still = anim;
-               } else if (gh_eq_p(id, gh_symbol2scm("move"))) {
-                       if (anims->Move) {
-                               free(anims->Move);
-                       }
-                       anims->Move = anim;
-               } else if (gh_eq_p(id, gh_symbol2scm("attack"))) {
-                       if (anims->Attack) {
-                               free(anims->Attack);
-                       }
-                       anims->Attack = anim;
-               } else if (gh_eq_p(id, gh_symbol2scm("repair"))) {
-                       if (anims->Repair) {
-                               free(anims->Repair);
-                       }
-                       anims->Repair = anim;
-               } else if (gh_eq_p(id, gh_symbol2scm("harvest"))) {
-                       int res;
-                       char* name;
-
-                       name = gh_scm2newstr(resource, NULL);
-                       for (res = 0; res < MaxCosts; ++res) {
-                               if (!strcmp(name, DefaultResourceNames[res])) {
-                                       break;
-                               }
-                       }
-                       if (res == MaxCosts) {
-                               errl("Resource not found", resource);
-                       }
-                       free(name);
-                       if (anims->Harvest[res]) {
-                               free(anims->Harvest[res]);
-                       }
-                       anims->Harvest[res] = anim;
-               } else if (gh_eq_p(id, gh_symbol2scm("die"))) {
-                       if (anims->Die) {
-                               free(anims->Die);
-                       }
-                       anims->Die = anim;
-               } else {
-                       errl("Unsupported tag", id);
-               }
-       }
-
-       *(Animations**)hash_add(AnimationsHash, str) = anims;
-       free(str);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineAnimations(lua_State* l)
 {
        const char* str;
@@ -2158,40 +1211,12 @@
        *(Animations**)hash_add(AnimationsHash, str) = anims;
        return 0;
 }
-#endif
 
 /*
 **             Define boolean flag.
 **
 **             @param list : list of flags' name.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineBoolFlags(SCM list)
-{
-       char* str;
-       int i;
-
-       if (NumberBoolFlag != 0) {
-               DebugLevel0("Warning, Redefine Bool flags\n");
-       }
-       while (!gh_null_p(list)) {
-               str = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-               for (i = 0; i < NumberBoolFlag; ++i) {
-                       if (!strcmp(str, BoolFlagName[i])) {
-                               DebugLevel0("Warning, Bool flags already 
defined\n");
-                               break;
-                       }
-               }
-               if (i != NumberBoolFlag) {
-                       break;
-               }
-               BoolFlagName = realloc(BoolFlagName, (NumberBoolFlag + 1) * 
sizeof(*BoolFlagName));
-               BoolFlagName[NumberBoolFlag++] = str;
-       }
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineBoolFlags(lua_State* l)
 {
        char* str;
@@ -2219,7 +1244,6 @@
        }
        return 0;
 }
-#endif
 
 // ----------------------------------------------------------------------------
 
@@ -2228,28 +1252,6 @@
 */
 global void UnitTypeCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-unit-type", CclDefineUnitType);
-       gh_new_procedureN("define-unit-stats", CclDefineUnitStats);
-       gh_new_procedureN("define-bool-flags", CclDefineBoolFlags);
-
-       SiodUnitTypeTag = CclMakeSmobType("UnitType");
-
-#ifndef USE_GUILE
-       set_print_hooks(SiodUnitTypeTag, CclUnitTypePrin1);
-#endif
-
-       gh_new_procedure1_0("unit-type", CclUnitType);
-       gh_new_procedure0_0("unit-type-array", CclUnitTypeArray);
-       // unit type structure access
-       gh_new_procedure1_0("get-unit-type-ident", CclGetUnitTypeIdent);
-       gh_new_procedure1_0("get-unit-type-name", CclGetUnitTypeName);
-       gh_new_procedure2_0("set-unit-type-name!", CclSetUnitTypeName);
-
-       gh_new_procedureN("define-unittype-wc-names", CclDefineUnitTypeWcNames);
-
-       gh_new_procedureN("define-animations", CclDefineAnimations);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineUnitType", CclDefineUnitType);
        lua_register(Lua, "DefineUnitStats", CclDefineUnitStats);
        lua_register(Lua, "DefineBoolFlags", CclDefineBoolFlags);
@@ -2264,8 +1266,6 @@
        lua_register(Lua, "DefineUnitTypeWcNames", CclDefineUnitTypeWcNames);
 
        lua_register(Lua, "DefineAnimations", CclDefineAnimations);
-
-#endif
 }
 
 //@}
Index: stratagus/src/unit/depend.c
diff -u stratagus/src/unit/depend.c:1.35 stratagus/src/unit/depend.c:1.36
--- stratagus/src/unit/depend.c:1.35    Sat Dec 20 16:33:45 2003
+++ stratagus/src/unit/depend.c Fri Jan  2 08:24:20 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: depend.c,v 1.35 2003/12/20 05:33:45 jsalmon3 Exp $
+//     $Id: depend.c,v 1.36 2004/01/01 21:24:20 jsalmon3 Exp $
 
 //@{
 
@@ -287,7 +287,7 @@
        const DependRule* temp;
 
        CLprintf(file,"\n;;; -----------------------------------------\n");
-       CLprintf(file,";;; MODULE: dependencies $Id: depend.c,v 1.35 2003/12/20 
05:33:45 jsalmon3 Exp $\n\n");
+       CLprintf(file,";;; MODULE: dependencies $Id: depend.c,v 1.36 2004/01/01 
21:24:20 jsalmon3 Exp $\n\n");
 
        // Save all dependencies
 
@@ -386,57 +386,6 @@
 **
 **             @param list             List of the dependency.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineDependency(SCM list)
-{
-       char* target;
-       char* required;
-       int count;
-       SCM value;
-       SCM temp;
-       int or_flag;
-
-       value = gh_car(list);
-       list = gh_cdr(list);
-       target = gh_scm2newstr(value, NULL);
-
-       //
-       //              All or rules.
-       //
-       or_flag = 0;
-       while (!gh_null_p(list)) {
-               temp = gh_car(list);
-               list = gh_cdr(list);
-
-               while (!gh_null_p(temp)) {
-                       value = gh_car(temp);
-                       temp = gh_cdr(temp);
-                       required = gh_scm2newstr(value, NULL);
-                       count = 1;
-                       if (!gh_null_p(temp) && gh_exact_p(temp)) {
-                               value = gh_car(temp);
-                               count = gh_scm2int(value);
-                               temp = gh_cdr(temp);
-                       }
-
-                       AddDependency(target, required, count, or_flag);
-                       free(required);
-                       or_flag = 0;
-               }
-               if (!gh_null_p(list)) {
-                       if (!gh_eq_p(gh_car(list), gh_symbol2scm("or"))) {
-                               errl("not or symbol", gh_car(list));
-                               return SCM_UNSPECIFIED;
-                       }
-                       or_flag = 1;
-                       list = gh_cdr(list);
-               }
-       }
-       free(target);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineDependency(lua_State* l)
 {
        const char* target;
@@ -497,7 +446,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Get the dependency.
@@ -506,21 +454,12 @@
 **
 **             @param target           Unit type or upgrade.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclGetDependency(SCM target __attribute__((unused)))
-{
-       DebugLevel0Fn("FIXME: write this %p\n" _C_ target);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclGetDependency(lua_State* l __attribute__((unused)))
 {
        DebugLevel0Fn("FIXME: write this %p\n" _C_ l);
 
        return 0;
 }
-#endif
 
 /**
 **             Check the dependency.
@@ -529,36 +468,21 @@
 **
 **             @param target           Unit type or upgrade.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclCheckDependency(SCM target __attribute__((unused)))
-{
-       DebugLevel0Fn("FIXME: write this %p\n" _C_ target);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclCheckDependency(lua_State* l __attribute__((unused)))
 {
        DebugLevel0Fn("FIXME: write this %p\n" _C_ l);
 
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for dependencies.
 */
 global void DependenciesCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-dependency", CclDefineDependency);
-       gh_new_procedure1_0("get-dependency", CclGetDependency);
-       gh_new_procedure1_0("check-dependency", CclCheckDependency);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineDependency", CclDefineDependency);
        lua_register(Lua, "GetDependency", CclGetDependency);
        lua_register(Lua, "CheckDependency", CclCheckDependency);
-#endif
 }
 
 //@}
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.197 
stratagus/src/unit/unit_draw.c:1.198
--- stratagus/src/unit/unit_draw.c:1.197        Sat Dec 20 16:33:20 2003
+++ stratagus/src/unit/unit_draw.c      Fri Jan  2 08:24:20 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit_draw.c,v 1.197 2003/12/20 05:33:20 jsalmon3 Exp $
+//     $Id: unit_draw.c,v 1.198 2004/01/01 21:24:20 jsalmon3 Exp $
 
 //@{
 
@@ -405,20 +405,6 @@
 **             @param w                Mana width.
 **             @param h                Mana height.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclManaSprite(SCM file, SCM x, SCM y, SCM w, SCM h)
-{
-       free(ManaSprite.File);
-
-       ManaSprite.File = gh_scm2newstr(file, NULL);
-       ManaSprite.HotX = gh_scm2int(x);
-       ManaSprite.HotY = gh_scm2int(y);
-       ManaSprite.Width = gh_scm2int(w);
-       ManaSprite.Height = gh_scm2int(h);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclManaSprite(lua_State* l)
 {
        if (lua_gettop(l) != 5) {
@@ -435,7 +421,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define health sprite.
@@ -446,20 +431,6 @@
 **             @param w                Health width.
 **             @param h                Health height.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclHealthSprite(SCM file, SCM x, SCM y, SCM w, SCM h)
-{
-       free(HealthSprite.File);
-
-       HealthSprite.File = gh_scm2newstr(file, NULL);
-       HealthSprite.HotX = gh_scm2int(x);
-       HealthSprite.HotY = gh_scm2int(y);
-       HealthSprite.Width = gh_scm2int(w);
-       HealthSprite.Height = gh_scm2int(h);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclHealthSprite(lua_State* l)
 {
        if (lua_gettop(l) != 5) {
@@ -476,7 +447,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define shadow sprite.
@@ -487,20 +457,6 @@
 **             @param w                Shadow width.
 **             @param h                Shadow height.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShadowSprite(SCM file, SCM x, SCM y, SCM w, SCM h)
-{
-       free(ShadowSprite.File);
-
-       ShadowSprite.File = gh_scm2newstr(file, NULL);
-       ShadowSprite.HotX = gh_scm2int(x);
-       ShadowSprite.HotY = gh_scm2int(y);
-       ShadowSprite.Width = gh_scm2int(w);
-       ShadowSprite.Height = gh_scm2int(h);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShadowSprite(lua_State* l)
 {
        if (lua_gettop(l) != 5) {
@@ -517,7 +473,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define spell sprite.
@@ -528,20 +483,6 @@
 **             @param w                Spell width.
 **             @param h                Spell height.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclSpellSprite(SCM file, SCM x, SCM y, SCM w, SCM h)
-{
-       free(SpellSprite.File);
-
-       SpellSprite.File = gh_scm2newstr(file, NULL);
-       SpellSprite.HotX = gh_scm2int(x);
-       SpellSprite.HotY = gh_scm2int(y);
-       SpellSprite.Width = gh_scm2int(w);
-       SpellSprite.Height = gh_scm2int(h);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclSpellSprite(lua_State* l)
 {
        if (lua_gettop(l) != 5) {
@@ -558,20 +499,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable display health as health-bar.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowHealthBar(void)
-{
-       ShowHealthBar = 1;
-       ShowHealthDot = 0;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowHealthBar(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -583,20 +514,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable display health as health-dot.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowHealthDot(void)
-{
-       ShowHealthBar = 0;
-       ShowHealthDot = 1;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowHealthDot(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -608,21 +529,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable display health as horizontal bar.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowHealthHorizontal(void)
-{
-       ShowHealthBar = 1;
-       ShowHealthDot = 0;
-       ShowHealthHorizontal = 1;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowHealthHorizontal(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -635,21 +545,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable display health as vertical bar.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowHealthVertical(void)
-{
-       ShowHealthBar = 1;
-       ShowHealthDot = 0;
-       ShowHealthHorizontal = 0;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowHealthVertical(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -662,20 +561,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable display mana as mana-bar.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowManaBar(void)
-{
-       ShowManaBar = 1;
-       ShowManaDot = 0;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowManaBar(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -687,20 +576,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable display mana as mana-dot.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowManaDot(void)
-{
-       ShowManaBar = 0;
-       ShowManaDot = 1;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowManaDot(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -712,19 +591,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable energy bars and dots only for selected units
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowEnergySelected(void)
-{
-       ShowEnergySelectedOnly = 1;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowEnergySelected(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -735,20 +605,10 @@
 
        return 0;
 }
-#endif
-
 
 /**
 **             Enable display of full bars/dots.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowFull(void)
-{
-       ShowNoFull = 0;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowFull(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -759,21 +619,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable display mana as horizontal bar.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowManaHorizontal(void)
-{
-       ShowManaBar = 1;
-       ShowManaDot = 0;
-       ShowManaHorizontal = 1;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowManaHorizontal(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -786,21 +635,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Enable display mana as vertical bar.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowManaVertical(void)
-{
-       ShowManaBar = 1;
-       ShowManaDot = 0;
-       ShowManaHorizontal = 0;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowManaVertical(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -813,19 +651,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Disable display of full bars/dots.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclShowNoFull(void)
-{
-       ShowNoFull = 1;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclShowNoFull(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -836,19 +665,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Draw decorations always on top.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDecorationOnTop(void)
-{
-       DecorationOnTop = 1;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDecorationOnTop(lua_State* l)
 {
        if (lua_gettop(l) != 0) {
@@ -859,35 +679,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for decorations.
 */
 global void DecorationCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure5_0("mana-sprite", CclManaSprite);
-       gh_new_procedure5_0("health-sprite", CclHealthSprite);
-       gh_new_procedure5_0("shadow-sprite", CclShadowSprite);
-       gh_new_procedure5_0("spell-sprite", CclSpellSprite);
-
-       gh_new_procedure0_0("show-health-bar", CclShowHealthBar);
-       gh_new_procedure0_0("show-health-dot", CclShowHealthDot);
-// adicionado por protoman
-       gh_new_procedure0_0("show-health-vertical", CclShowHealthVertical);
-       gh_new_procedure0_0("show-health-horizontal", CclShowHealthHorizontal);
-       gh_new_procedure0_0("show-mana-vertical", CclShowManaVertical);
-       gh_new_procedure0_0("show-mana-horizontal", CclShowManaHorizontal);
-// fim
-
-       gh_new_procedure0_0("show-mana-bar", CclShowManaBar);
-       gh_new_procedure0_0("show-mana-dot", CclShowManaDot);
-       gh_new_procedure0_0("show-energy-selected-only", CclShowEnergySelected);
-       gh_new_procedure0_0("show-full", CclShowFull);
-       gh_new_procedure0_0("show-no-full", CclShowNoFull);
-       gh_new_procedure0_0("decoration-on-top", CclDecorationOnTop);
-#elif defined(USE_LUA)
        lua_register(Lua, "ManaSprite", CclManaSprite);
        lua_register(Lua, "HealthSprite", CclHealthSprite);
        lua_register(Lua, "ShadowSprite", CclShadowSprite);
@@ -908,7 +705,6 @@
        lua_register(Lua, "ShowFull", CclShowFull);
        lua_register(Lua, "ShowNoFull", CclShowNoFull);
        lua_register(Lua, "DecorationOnTop", CclDecorationOnTop);
-#endif
 }
 
 /**
@@ -944,7 +740,7 @@
 global void SaveDecorations(CLFile* file)
 {
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.197 
2003/12/20 05:33:20 jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.198 
2004/01/01 21:24:20 jsalmon3 Exp $\n\n");
 
        CLprintf(file, "(mana-sprite \"%s\"  %d %d  %d %d)\n",
                ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
Index: stratagus/src/unit/upgrade.c
diff -u stratagus/src/unit/upgrade.c:1.69 stratagus/src/unit/upgrade.c:1.70
--- stratagus/src/unit/upgrade.c:1.69   Sat Dec 20 16:33:46 2003
+++ stratagus/src/unit/upgrade.c        Fri Jan  2 08:24:20 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: upgrade.c,v 1.69 2003/12/20 05:33:46 jsalmon3 Exp $
+//     $Id: upgrade.c,v 1.70 2004/01/01 21:24:20 jsalmon3 Exp $
 
 //@{
 
@@ -544,7 +544,7 @@
        int p;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: upgrades $Id: upgrade.c,v 1.69 2003/12/20 
05:33:46 jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: upgrades $Id: upgrade.c,v 1.70 2004/01/01 
21:24:20 jsalmon3 Exp $\n\n");
 
        /* remove?
        //
@@ -707,136 +707,6 @@
 **
 **             @param list             List of modifiers.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineModifier(SCM list)
-{
-       SCM temp;
-       SCM value;
-       int uid;
-       char* str;
-       int attack_range;
-       int sight_range;
-       int basic_damage;
-       int piercing_damage;
-       int armor;
-       int speed;
-       int regeneration_rate;
-       int hit_points;
-       int costs[MaxCosts];
-       int units[UnitTypeMax];
-       char upgrades[UpgradeMax];
-       char apply_to[UnitTypeMax];
-       UnitType* convert_to;
-
-       attack_range = 0;
-       sight_range = 0;
-       basic_damage = 0;
-       piercing_damage = 0;
-       armor = 0;
-       speed = 0;
-       hit_points = 0;
-       regeneration_rate = 0;
-       memset(costs, 0, sizeof(costs));
-       memset(units, 0, sizeof(units));
-       memset(upgrades, '?', sizeof(upgrades));
-       memset(apply_to, '?', sizeof(apply_to));
-       convert_to = NULL;
-
-       value = gh_car(list);
-       list = gh_cdr(list);
-
-       str = gh_scm2newstr(value, NULL);
-       uid = UpgradeIdByIdent(str);
-       free(str);
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (!gh_list_p(value)) {
-                       errl("wrong tag", value);
-                       return SCM_UNSPECIFIED;
-               }
-               temp = gh_car(value);
-               if (gh_eq_p(temp, gh_symbol2scm("attack-range"))) {
-                       attack_range = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("sight-range"))) {
-                       sight_range = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("basic-damage"))) {
-                       basic_damage = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("piercing-damage"))) {
-                       piercing_damage = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("armor"))) {
-                       armor = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("speed"))) {
-                       speed = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("hit-points"))) {
-                       hit_points = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("regeneration-rate"))) {
-                       regeneration_rate = gh_scm2int(gh_cadr(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("cost"))) {
-                       int i;
-                       char* name;
-
-                       value = gh_car(gh_cdr(value));
-                       name = gh_scm2newstr(gh_car(value), NULL);
-                       for (i = 0; i < MaxCosts; ++i) {
-                               if (!strcmp(name, DefaultResourceNames[i])) {
-                                       break;
-                               }
-                       }
-                       if (i == MaxCosts) {
-                               errl("Resource not found", gh_car(value));
-                       }
-                       free(name);
-                       value = gh_cdr(value);
-                       costs[i] = gh_scm2int(gh_car(value));
-               } else if (gh_eq_p(temp, gh_symbol2scm("allow-unit"))) {
-                       value = gh_cdr(value);
-                       str = gh_scm2newstr(gh_car(value), NULL);
-                       value = gh_cdr(value);
-                       DebugLevel3Fn("%s\n" _C_ str);
-                       if (!strncmp(str, "unit-", 5)) {
-                               units[UnitTypeIdByIdent(str)] = 
gh_scm2int(gh_car(value));
-                       } else {
-                               free(str);
-                               errl("unit expected", NIL);
-                       }
-                       free(str);
-               } else if (gh_eq_p(temp, gh_symbol2scm("allow"))) {
-                       value = gh_cdr(value);
-                       str = gh_scm2newstr(gh_car(value), NULL);
-                       value = gh_cdr(value);
-                       DebugLevel3Fn("%s\n" _C_ str);
-                       if (!strncmp(str, "upgrade-", 8)) {
-                               upgrades[UpgradeIdByIdent(str)] = 
gh_scm2int(gh_car(value));
-                       } else {
-                               free(str);
-                               errl("upgrade expected", NIL);
-                       }
-                       free(str);
-               } else if (gh_eq_p(temp, gh_symbol2scm("apply-to"))) {
-                       value = gh_cdr(value);
-                       str = gh_scm2newstr(gh_car(value), NULL);
-                       apply_to[UnitTypeIdByIdent(str)] = 'X';
-                       free(str);
-               } else if (gh_eq_p(temp, gh_symbol2scm("convert-to"))) {
-                       value = gh_cdr(value);
-                       str = gh_scm2newstr(gh_car(value), NULL);
-                       convert_to = UnitTypeByIdent(str);
-                       free(str);
-               } else {
-                       errl("wrong tag", temp);
-                       return SCM_UNSPECIFIED;
-               }
-       }
-
-       AddUpgradeModifierBase(uid, attack_range, sight_range, basic_damage,
-               piercing_damage, armor, speed, hit_points, regeneration_rate, 
costs,
-               units, upgrades, apply_to,convert_to);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineModifier(lua_State* l)
 {
        const char* temp;
@@ -989,75 +859,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define a new upgrade.
 **
 **             @param list             List defining the upgrade.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineUpgrade(SCM list)
-{
-       SCM value;
-       char* str;
-       char* icon;
-       char* ident;
-       int costs[MaxCosts];
-       int n;
-       int j;
-
-       //              Identifier
-
-       ident = gh_scm2newstr(gh_car(list), NULL);
-       list = gh_cdr(list);
-
-       icon = NULL;
-       memset(costs, 0, sizeof(costs));
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               if (gh_eq_p(value, gh_symbol2scm("icon"))) {
-                       //              Icon
-
-                       if (icon) {
-                               free(icon);
-                       }
-                       icon = gh_scm2newstr(gh_car(list), NULL);
-                       list = gh_cdr(list);
-               } else if (gh_eq_p(value, gh_symbol2scm("costs"))) {
-                       //              Costs
-
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       n = gh_vector_length(value);
-                       if (n > MaxCosts) {
-                               fprintf(stderr, "%s: Wrong vector length\n", 
ident);
-                               if (n > MaxCosts) {
-                                       n = MaxCosts;
-                               }
-                       }
-                       for (j = 0; j < n; ++j) {
-                               costs[j] = gh_scm2int(gh_vector_ref(value, 
gh_int2scm(j)));
-                       }
-                       while (j < MaxCosts) {
-                               costs[j++] = 0;
-                       }
-               } else {
-                       str = gh_scm2newstr(value, NULL);
-                       fprintf(stderr, "%s: Wrong tag `%s'\n", ident, str);
-                       free(str);
-               }
-       }
-
-       AddUpgrade(ident, icon, costs);
-       free(ident);
-       free(icon);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineUpgrade(lua_State* l)
 {
        const char* value;
@@ -1115,43 +922,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define which units are allowed and how much.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineUnitAllow(SCM list)
-{
-       SCM value;
-       char* ident;
-       int i;
-
-       if (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               ident = gh_scm2newstr(value, NULL);
-
-               if (strncmp(ident, "unit-", 5)) {
-                       DebugLevel0Fn(" wrong ident %s\n" _C_ ident);
-                       free(ident);
-                       return SCM_UNSPECIFIED;
-               }
-
-               i = 0;
-               while (!gh_null_p(list) && i < 16) {
-                       value = gh_car(list);
-                       list = gh_cdr(list);
-                       AllowUnitByIdent(&Players[i], ident, gh_scm2int(value));
-                       ++i;
-               }
-
-               free(ident);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineUnitAllow(lua_State* l)
 {
        const char* ident;
@@ -1177,57 +951,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define which units/upgrades are allowed.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineAllow(SCM list)
-{
-       SCM value;
-       char* ident;
-       char* ids;
-       int i;
-       int n;
-
-       while (!gh_null_p(list)) {
-               value = gh_car(list);
-               list = gh_cdr(list);
-               ident = gh_scm2newstr(value, NULL);
-               value = gh_car(list);
-               list = gh_cdr(list);
-               ids = gh_scm2newstr(value, NULL);
-
-               n = strlen(ids);
-               if (n > 16) {
-                       fprintf(stderr, "%s: Allow string too long %d\n", 
ident, n);
-                       n = 16;
-               }
-
-               if (!strncmp(ident, "unit-", 5)) {
-                       for (i = 0; i < n; ++i) {
-                               if (ids[i] == 'A') {
-                                       AllowUnitByIdent(&Players[i], ident, 
UnitMax);
-                               } else if (ids[i] == 'F') {
-                                       AllowUnitByIdent(&Players[i], ident, 0);
-                               }
-                       }
-               } else if (!strncmp(ident, "upgrade-", 8)) {
-                       for (i = 0; i < n; ++i) {
-                               AllowUpgradeByIdent(&Players[i], ident, ids[i]);
-                       }
-               } else {
-                       DebugLevel0Fn(" wrong ident %s\n" _C_ ident);
-               }
-
-               free(ident);
-               free(ids);
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineAllow(lua_State* l)
 {
        const char* ident;
@@ -1268,40 +995,12 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define upgrade mapping from original number to internal symbol
 **
 **             @param list             List of all names.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineUpgradeWcNames(SCM list)
-{
-       int i;
-       char** cp;
-
-       if ((cp = UpgradeWcNames)) {                            // Free all old 
names
-               while (*cp) {
-                       free(*cp++);
-               }
-               free(UpgradeWcNames);
-       }
-
-       //
-       //              Get new table.
-       //
-       i = gh_length(list);
-       UpgradeWcNames = cp = malloc((i + 1) * sizeof(char*));
-       while (i--) {
-               *cp++ = gh_scm2newstr(gh_car(list), NULL);
-               list = gh_cdr(list);
-       }
-       *cp = NULL;
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineUpgradeWcNames(lua_State* l)
 {
        int i;
@@ -1332,34 +1031,23 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for upgrades.
 */
 global void UpgradesCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedureN("define-modifier", CclDefineModifier);
-       gh_new_procedureN("define-upgrade", CclDefineUpgrade);
-       gh_new_procedureN("define-allow", CclDefineAllow);
-       gh_new_procedureN("define-unit-allow", CclDefineUnitAllow);
-
-       gh_new_procedureN("define-upgrade-wc-names", CclDefineUpgradeWcNames);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineModifier", CclDefineModifier);
        lua_register(Lua, "DefineUpgrade", CclDefineUpgrade);
        lua_register(Lua, "DefineAllow", CclDefineAllow);
        lua_register(Lua, "DefineUnitAllow", CclDefineUnitAllow);
 
        lua_register(Lua, "DefineUpgradeWcNames", CclDefineUpgradeWcNames);
-#endif
 }
 
 
 
 
-// FIXME: Johns stops here
 
 /*----------------------------------------------------------------------------
 --             Init/Done/Add functions
Index: stratagus/src/video/font.c
diff -u stratagus/src/video/font.c:1.69 stratagus/src/video/font.c:1.70
--- stratagus/src/video/font.c:1.69     Mon Dec 22 22:28:41 2003
+++ stratagus/src/video/font.c  Fri Jan  2 08:24:22 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: font.c,v 1.69 2003/12/22 11:28:41 wizzard Exp $
+//     $Id: font.c,v 1.70 2004/01/01 21:24:22 jsalmon3 Exp $
 
 //@{
 
@@ -1108,35 +1108,6 @@
 **
 **             @return                         Integer as font identifier.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-global int CclFontByIdentifier(SCM type)
-{
-       if (gh_eq_p(type, gh_symbol2scm("game"))) {
-               return GameFont;
-       } else if (gh_eq_p(type, gh_symbol2scm("small"))) {
-               return SmallFont;
-       } else if (gh_eq_p(type, gh_symbol2scm("large"))) {
-               return LargeFont;
-       } else if (gh_eq_p(type, gh_symbol2scm("small-title"))) {
-               return SmallTitleFont;
-       } else if (gh_eq_p(type, gh_symbol2scm("large-title"))) {
-               return LargeTitleFont;
-       } else if (gh_eq_p(type, gh_symbol2scm("user1"))) {
-               return User1Font;
-       } else if (gh_eq_p(type, gh_symbol2scm("user2"))) {
-               return User2Font;
-       } else if (gh_eq_p(type, gh_symbol2scm("user3"))) {
-               return User3Font;
-       } else if (gh_eq_p(type, gh_symbol2scm("user4"))) {
-               return User4Font;
-       } else if (gh_eq_p(type, gh_symbol2scm("user5"))) {
-               return User5Font;
-       } else {
-               errl("Unsupported font tag", type);
-       }
-       return 0;
-}
-#elif defined(USE_LUA)
 global int CclFontByIdentifier(const char* type)
 {
        if (!strcmp(type, "game")) {
@@ -1165,7 +1136,6 @@
        }
        return 0;
 }
-#endif
 
 /**
 **             Define the used fonts.
@@ -1177,22 +1147,6 @@
 **
 **             @todo           make the font name functions more general, 
support more fonts.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineFont(SCM type, SCM file, SCM width, SCM height)
-{
-       int i;
-
-       i = CclFontByIdentifier(type);
-       free(Fonts[i].File);
-       VideoSaveFree(Fonts[i].Graphic);
-       Fonts[i].Graphic = NULL;
-       Fonts[i].File = gh_scm2newstr(file, NULL);
-       Fonts[i].Width = gh_scm2int(width);
-       Fonts[i].Height = gh_scm2int(height);
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineFont(lua_State* l)
 {
        int i;
@@ -1211,79 +1165,10 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Define a font color.
 */
-#if defined(USE_GUILE) || defined(USE_SIOD)
-local SCM CclDefineFontColor(SCM list)
-{
-       SCM value;
-       char* color;
-       int i;
-       FontColorMapping* fcm;
-       FontColorMapping** fcmp;
-
-       value = gh_car(list);
-       list = gh_cdr(list);
-
-       color = gh_scm2newstr(value,NULL);
-
-       if (!FontColorMappings) {
-               FontColorMappings = calloc(sizeof(*FontColorMappings), 1);
-               fcm = FontColorMappings;
-       } else {
-               fcmp = &FontColorMappings;
-               while (*fcmp) {
-#ifdef USE_SDL_SURFACE
-                       if (!strcmp((*fcmp)->ColorName, color)) {
-                               fprintf(stderr, "Warning: Redefining color 
'%s'\n", color);
-                               free((*fcmp)->ColorName);
-                               fcm = *fcmp;
-                               break;
-                       }
-#else
-                       if (!strcmp((*fcmp)->Color, color)) {
-                               fprintf(stderr, "Warning: Redefining color 
'%s'\n", color);
-                               free((*fcmp)->Color);
-                               fcm = *fcmp;
-                               break;
-                       }
-#endif
-                       fcmp = &(*fcmp)->Next;
-               }
-               *fcmp = calloc(sizeof(*FontColorMappings), 1);
-               fcm = *fcmp;
-       }
-#ifdef USE_SDL_SURFACE
-       fcm->ColorName = color;
-#else
-       fcm->Color = color;
-#endif
-       fcm->Next = NULL;
-
-       value = gh_car(list);
-       list = gh_cdr(list);
-
-       if (gh_vector_length(value) != NumFontColors * 3) {
-               fprintf(stderr, "Wrong vector length\n");
-       }
-       for (i = 0; i < NumFontColors; ++i) {
-#ifdef USE_SDL_SURFACE
-               fcm->Color[i].r = gh_scm2int(gh_vector_ref(value, gh_int2scm(i 
* 3 + 0)));
-               fcm->Color[i].g = gh_scm2int(gh_vector_ref(value, gh_int2scm(i 
* 3 + 1)));
-               fcm->Color[i].b = gh_scm2int(gh_vector_ref(value, gh_int2scm(i 
* 3 + 2)));
-#else
-               fcm->RGB[i].R = gh_scm2int(gh_vector_ref(value, gh_int2scm(i * 
3 + 0)));
-               fcm->RGB[i].G = gh_scm2int(gh_vector_ref(value, gh_int2scm(i * 
3 + 1)));
-               fcm->RGB[i].B = gh_scm2int(gh_vector_ref(value, gh_int2scm(i * 
3 + 2)));
-#endif
-       }
-
-       return SCM_UNSPECIFIED;
-}
-#elif defined(USE_LUA)
 local int CclDefineFontColor(lua_State* l)
 {
        char* color;
@@ -1358,7 +1243,6 @@
 
        return 0;
 }
-#endif
 
 /**
 **             Register CCL features for fonts.
@@ -1367,22 +1251,17 @@
 */
 global void FontsCclRegister(void)
 {
-#if defined(USE_GUILE) || defined(USE_SIOD)
-       gh_new_procedure4_0("define-font", CclDefineFont);
-       gh_new_procedureN("define-font-color", CclDefineFontColor);
-
-       //gh_new_procedure2_0("default-text-colors", CclDefaultTextColors);
-       //gh_new_procedure1_0("text-length", CclTextLength);
-       //gh_new_procedure4_0("draw-text", CclDrawText);
-       //gh_new_procedure4_0("draw-reverse-text", CclDrawReverseText);
-       //gh_new_procedure4_0("draw-text-centered", CclDrawTextCentered);
-       //gh_new_procedure4_0("draw-reverse-text-centered", 
CclDrawReverseTextCentered);
-       //gh_new_procedure4_0("draw-number", CclDrawNumber);
-       //gh_new_procedure4_0("draw-reverse-number", CclDrawReverseNumber);
-#elif defined(USE_LUA)
        lua_register(Lua, "DefineFont", CclDefineFont);
        lua_register(Lua, "DefineFontColor", CclDefineFontColor);
-#endif
+
+//     lua_register(Lua, "DefaultTextColors", CclDefaultTextColors);
+//     lua_register(Lua, "TextLength", CclTextLength);
+//     lua_register(Lua, "DrawText", CclDrawText);
+//     lua_register(Lua, "DrawReverseText", CclDrawReverseText);
+//     lua_register(Lua, "DrawTextCentered", CclDrawTextCentered);
+//     lua_register(Lua, "DrawReverseTextCentered", 
CclDrawReverseTextCentered);
+//     lua_register(Lua, "DrawNumber", CclDrawNumber);
+//     lua_register(Lua, "DrawReverseNumber", CclDrawReverseNumber);
 }
 
 /**




reply via email to

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