stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus data/ccl/human/units.ccl data/ccl/orc...


From: Crestez Leonard
Subject: [Stratagus-CVS] stratagus data/ccl/human/units.ccl data/ccl/orc...
Date: Sun, 10 Aug 2003 22:14:47 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Crestez Leonard <address@hidden>        03/08/10 22:14:46

Modified files:
        data/ccl/human : units.ccl 
        data/ccl/orc   : units.ccl 
        src/action     : Module.make action_harvest.c action_resource.c 
                         action_returngoods.c action_train.c actions.c 
                         command.c 
        src/ai         : ai_building.c ai_resource.c 
        src/clone      : unit.c unit_draw.c unit_find.c 
        src/include    : actions.h commands.h unit.h unittype.h 
        src/map        : map_wood.c 
        src/network    : commands.c 
        src/ui         : botpanel.c interface.c mouse.c 
        src/unit       : ccl_unit.c ccl_unittype.c unittype.c 
Removed files:
        src/action     : action_minegold.c 

Log message:
        Even more resource code.

Patches:
Index: stratagus/data/ccl/human/units.ccl
diff -u stratagus/data/ccl/human/units.ccl:1.22 
stratagus/data/ccl/human/units.ccl:1.23
--- stratagus/data/ccl/human/units.ccl:1.22     Sat Aug  9 16:32:51 2003
+++ stratagus/data/ccl/human/units.ccl  Sun Aug 10 22:14:45 2003
@@ -26,13 +26,14 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: units.ccl,v 1.22 2003/08/09 20:32:51 n0body Exp $
+;;     $Id: units.ccl,v 1.23 2003/08/11 02:14:45 n0body Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
 ;;
 ;;     NOTE: Save can generate this table.
 ;;
+
 (define-unit-type 'unit-footman 'name "Footman"
   'files '(tileset-summer "human/units/footman.png")
   'size '(72 72)
@@ -52,7 +53,7 @@
   'corpse '(unit-dead-body 6)
   'type-land
   'right-attack
-  'can-attack
+  'can-attack 'can-repair
   'can-target-land
   'land-unit
   'organic
@@ -86,7 +87,7 @@
   'corpse '(unit-dead-body 6)
   'type-land
   'right-harvest
-  'can-attack
+  'can-attack 'can-repair
   'can-target-land
   'land-unit
   'cower-worker
@@ -121,7 +122,7 @@
   'corpse '(unit-dead-body 6)
   'type-land
   'right-harvest
-  'can-attack
+  'can-attack 'can-repair
   'can-target-land
   'land-unit
   'cower-worker
@@ -156,7 +157,7 @@
   'corpse '(unit-dead-body 6)
   'type-land
   'right-harvest
-  'can-attack
+  'can-attack 'can-repair
   'can-target-land
   'land-unit
   'cower-worker
@@ -514,7 +515,7 @@
   'demand 1
   'corpse '(unit-dead-body 12)
   'type-naval
-  'right-haul-oil
+  'right-harvest
   'sea-unit
   'harvester 'resource-harvested 'oil 'resource-capacity 100
   'wait-at-resource 100 'wait-at-depot 100
@@ -545,7 +546,7 @@
   'demand 1
   'corpse '(unit-dead-body 12)
   'type-naval
-  'right-haul-oil
+  'right-harvest
   'sea-unit
   'harvester 'resource-harvested 'oil 'resource-capacity 100
   'wait-at-resource 100 'wait-at-depot 100
Index: stratagus/data/ccl/orc/units.ccl
diff -u stratagus/data/ccl/orc/units.ccl:1.26 
stratagus/data/ccl/orc/units.ccl:1.27
--- stratagus/data/ccl/orc/units.ccl:1.26       Sat Aug  9 16:32:51 2003
+++ stratagus/data/ccl/orc/units.ccl    Sun Aug 10 22:14:45 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: units.ccl,v 1.26 2003/08/09 20:32:51 n0body Exp $
+;;     $Id: units.ccl,v 1.27 2003/08/11 02:14:45 n0body Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -63,6 +63,8 @@
     dead "basic orc voices dead"
     attack "grunt-attack"))
 
+(define-unit-type 'unit-peon-with-gold)
+
 (define-unit-type 'unit-peon 'name "Peon"
   'files '(tileset-summer "orc/units/peon.png")
   'size '(72 72)
@@ -81,10 +83,13 @@
   'corpse '(unit-dead-body 0)
   'type-land
   'right-harvest
-  'can-attack
+  'can-attack 'can-repair
   'can-target-land
   'land-unit
   'cower-worker
+  'harvester 'resource-harvested 'gold 'resource-capacity 100
+  'wait-at-resource 150 'wait-at-depot 150
+  'transform-when-loaded 'unit-peon-with-gold
   'organic
   'selectable-by-rectangle
   'sounds '(
@@ -113,10 +118,13 @@
   'corpse '(unit-dead-body 0)
   'type-land
   'right-harvest
-  'can-attack
+  'can-attack 'can-repair
   'can-target-land
   'land-unit
   'cower-worker
+  'harvester 'resource-harvested 'gold 'resource-capacity 100
+  'wait-at-resource 150 'wait-at-depot 150
+  'transform-when-empty 'unit-peon
   'organic
   'selectable-by-rectangle
   'sounds '(
@@ -145,7 +153,7 @@
   'corpse '(unit-dead-body 0)
   'type-land
   'right-harvest
-  'can-attack
+  'can-attack 'can-repair
   'can-target-land
   'land-unit
   'cower-worker
@@ -509,7 +517,7 @@
   'demand 1
   'corpse '(unit-dead-body 12)
   'type-naval
-  'right-haul-oil
+  'right-harvest
   'sea-unit
   'harvester 'resource-harvested 'oil 'resource-capacity 100
   'wait-at-resource 100 'wait-at-depot 100
@@ -540,7 +548,7 @@
   'demand 1
   'corpse '(unit-dead-body 12)
   'type-naval
-  'right-haul-oil
+  'right-harvest
   'sea-unit
   'harvester 'resource-harvested 'oil 'resource-capacity 100
   'wait-at-resource 100 'wait-at-depot 100
Index: stratagus/src/action/Module.make
diff -u stratagus/src/action/Module.make:1.6 
stratagus/src/action/Module.make:1.7
--- stratagus/src/action/Module.make:1.6        Thu Jul  3 13:48:48 2003
+++ stratagus/src/action/Module.make    Sun Aug 10 22:14:45 2003
@@ -27,7 +27,7 @@
 
 MODULE = src/action
 MSRC =  action_attack.c action_board.c action_build.c action_demolish.c \
-        action_die.c action_follow.c action_harvest.c action_minegold.c \
+        action_die.c action_follow.c action_harvest.c \
         action_move.c action_patrol.c action_repair.c action_research.c \
         action_resource.c action_returngoods.c action_spellcast.c \
         action_stand.c action_still.c action_train.c action_unload.c \
Index: stratagus/src/action/action_harvest.c
diff -u stratagus/src/action/action_harvest.c:1.75 
stratagus/src/action/action_harvest.c:1.76
--- stratagus/src/action/action_harvest.c:1.75  Fri Aug  8 15:31:36 2003
+++ stratagus/src/action/action_harvest.c       Sun Aug 10 22:14:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_harvest.c,v 1.75 2003/08/08 19:31:36 n0body Exp $
+//     $Id: action_harvest.c,v 1.76 2003/08/11 02:14:45 n0body Exp $
 
 //@{
 
@@ -169,7 +169,7 @@
        //
 #if 1
        if( unit->Orders[1].Action==UnitActionHarvest
-                || unit->Orders[1].Action==UnitActionMineGold ) {
+                || unit->Orders[1].Action==UnitActionResource ) {
            unit->Orders[0].Action=UnitActionStill;
            unit->SubAction=0;
            return 0;
Index: stratagus/src/action/action_resource.c
diff -u stratagus/src/action/action_resource.c:1.45 
stratagus/src/action/action_resource.c:1.46
--- stratagus/src/action/action_resource.c:1.45 Sun Aug 10 13:54:53 2003
+++ stratagus/src/action/action_resource.c      Sun Aug 10 22:14:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_resource.c,v 1.45 2003/08/10 17:54:53 martinxyz Exp $
+//     $Id: action_resource.c,v 1.46 2003/08/11 02:14:45 n0body Exp $
 
 //@{
 
@@ -341,6 +341,7 @@
        (unit->Value*unit->Player->Incomes[unit->Type->ResourceHarvested])/100;
     unit->Player->TotalResources[unit->Type->ResourceHarvested]+=
        (unit->Value*unit->Player->Incomes[unit->Type->ResourceHarvested])/100;
+    unit->Value=0;
     if( unit->Player==ThisPlayer ) {
        MustRedraw|=RedrawResources;
     }
Index: stratagus/src/action/action_returngoods.c
diff -u stratagus/src/action/action_returngoods.c:1.36 
stratagus/src/action/action_returngoods.c:1.37
--- stratagus/src/action/action_returngoods.c:1.36      Sat Aug  9 16:32:51 2003
+++ stratagus/src/action/action_returngoods.c   Sun Aug 10 22:14:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_returngoods.c,v 1.36 2003/08/09 20:32:51 n0body Exp $
+//     $Id: action_returngoods.c,v 1.37 2003/08/11 02:14:45 n0body Exp $
 
 //@{
 
@@ -91,26 +91,6 @@
        return;
     }
     
-    if( type==UnitTypeHumanWorkerWithGold || type==UnitTypeOrcWorkerWithGold ) 
{
-       if( !unit->Orders[0].Goal ) {
-           if( !(destu=FindDeposit(unit->Player,unit->X,unit->Y,GoldCost)) ) {
-               // No deposit -> can't return
-               unit->Orders[0].Action=UnitActionStill;
-               return;
-           }
-           unit->Orders[0].Goal=destu;
-           RefsDebugCheck( !destu->Refs );
-           ++destu->Refs;
-       }
-       unit->Orders[0].Action=UnitActionMineGold;
-       unit->Orders[0].Arg1=(void*)-1;
-       NewResetPath(unit);
-       unit->SubAction=65;     // FIXME: hardcoded
-       DebugLevel3("Wait: %d\n" _C_ unit->Wait);
-       unit->Wait=1;
-       return;
-    }
-
     if( type==UnitTypeHumanWorkerWithWood || type==UnitTypeOrcWorkerWithWood ) 
{
        if( !unit->Orders[0].Goal ) {
            if( !(destu=FindDeposit(unit->Player,unit->X,unit->Y,WoodCost)) ) {
Index: stratagus/src/action/action_train.c
diff -u stratagus/src/action/action_train.c:1.54 
stratagus/src/action/action_train.c:1.55
--- stratagus/src/action/action_train.c:1.54    Fri Aug  8 15:31:36 2003
+++ stratagus/src/action/action_train.c Sun Aug 10 22:14:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_train.c,v 1.54 2003/08/08 19:31:36 n0body Exp $
+//     $Id: action_train.c,v 1.55 2003/08/11 02:14:45 n0body Exp $
 
 //@{
 
@@ -155,8 +155,7 @@
                && !nunit->Type->Harvester)
            || (unit->NewOrder.Action==UnitActionAttack
                && !nunit->Type->CanAttack)
-            || ((unit->NewOrder.Action==UnitActionMineGold
-                || unit->NewOrder.Action==UnitActionHarvest)
+            || ((unit->NewOrder.Action==UnitActionHarvest)
                && nunit->Type!=UnitTypeOrcWorker 
                && nunit->Type!=UnitTypeHumanWorker )
            || (unit->NewOrder.Action==UnitActionBoard
Index: stratagus/src/action/actions.c
diff -u stratagus/src/action/actions.c:1.85 stratagus/src/action/actions.c:1.86
--- stratagus/src/action/actions.c:1.85 Sat Aug  9 16:32:51 2003
+++ stratagus/src/action/actions.c      Sun Aug 10 22:14:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: actions.c,v 1.85 2003/08/09 20:32:51 n0body Exp $
+//     $Id: actions.c,v 1.86 2003/08/11 02:14:45 n0body Exp $
 
 //@{
 
@@ -176,15 +176,12 @@
     HandleActionRepair,
     HandleActionHarvest,
     HandleActionResource,
-    HandleActionNotWritten,    // HandleActionMineOre,
-    HandleActionNotWritten,    // HandleActionMineCoal,
-    HandleActionNotWritten,    // HandleActionQuarryStone,
-    HandleActionResource,
     HandleActionReturnGoods,
     HandleActionDemolish,
 
     // Enough for the future ?
-    HandleActionNotWritten, HandleActionNotWritten,
+    HandleActionNotWritten, HandleActionNotWritten, HandleActionNotWritten,
+    HandleActionNotWritten, HandleActionNotWritten, HandleActionNotWritten,
     HandleActionNotWritten, HandleActionNotWritten, HandleActionNotWritten,
     HandleActionNotWritten, HandleActionNotWritten, HandleActionNotWritten,
     HandleActionNotWritten, HandleActionNotWritten, HandleActionNotWritten,
Index: stratagus/src/action/command.c
diff -u stratagus/src/action/command.c:1.97 stratagus/src/action/command.c:1.98
--- stratagus/src/action/command.c:1.97 Sat Aug  9 16:32:51 2003
+++ stratagus/src/action/command.c      Sun Aug 10 22:14:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: command.c,v 1.97 2003/08/09 20:32:51 n0body Exp $
+//     $Id: command.c,v 1.98 2003/08/11 02:14:45 n0body Exp $
 
 //@{
 
@@ -739,52 +739,6 @@
        order->Y=y;
        order->RangeX=order->RangeY=1;
        order->Goal=NoUnitP;
-       order->Type=NULL;
-       order->Arg1=NULL;
-    }
-    ClearSavedAction(unit);
-}
-
-/**
-**     Send unit mine gold.
-**
-**     @param unit     pointer to unit.
-**     @param dest     destination unit.
-**     @param flush    if true, flush command queue.
-*/
-global void CommandMineGold(Unit* unit,Unit* dest,int flush)
-{
-    Order* order;
-
-    //
-    // Check if unit is still valid and Goal still alive? (NETWORK!)
-    //
-    if( !unit->Removed && unit->Orders[0].Action!=UnitActionDie
-            && !dest->Destroyed ) {
-       // FIXME: more races, could happen with many orders in queue.
-       if( !unit->Type->Building
-               && unit->Type!=UnitTypeHumanWorker
-               && unit->Type!=UnitTypeOrcWorker ) {
-           DebugLevel0Fn("None worker gets order\n");
-           ClearSavedAction(unit);
-           return;
-       }
-       // FIXME: if low-level supports searching, pass NoUnitP down.
-
-       if( unit->Type->Building ) {
-           // FIXME: should find a better way for pending orders.
-           order=&unit->NewOrder;
-           ReleaseOrder(order);
-       } else if( !(order=GetNextOrder(unit,flush)) ) {
-           return;
-       }
-
-       order->Action=UnitActionMineGold;
-       order->X=order->Y=-1;
-       order->Goal=dest;
-       RefsDebugCheck( !dest->Refs );
-       dest->Refs++;
-       order->RangeX=order->RangeY=1;
        order->Type=NULL;
        order->Arg1=NULL;
     }
Index: stratagus/src/ai/ai_building.c
diff -u stratagus/src/ai/ai_building.c:1.34 stratagus/src/ai/ai_building.c:1.35
--- stratagus/src/ai/ai_building.c:1.34 Tue Jul 22 10:32:21 2003
+++ stratagus/src/ai/ai_building.c      Sun Aug 10 22:14:45 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai_building.c,v 1.34 2003/07/22 14:32:21 n0body Exp $
+//      $Id: ai_building.c,v 1.35 2003/08/11 02:14:45 n0body Exp $
 
 #ifdef NEW_AI  // {
 
@@ -412,7 +412,7 @@
                //
                //      Look if there is a mine
                //
-               if ( (mine=GoldMineOnMap(x,y)) ) {
+               if ( (mine=ResourceOnMap(x,y,GoldCost)) ) {
                    int buildings;
                    int j;
                    int minx;
@@ -638,9 +638,9 @@
     }
 
     //
-    // Platforms can only be build on oil patches
+    // Platforms can only be built on oil patches
     //
-    if( !type->GivesResource==OilCost && 
AiFindBuildingPlace2(worker,type,worker->X,worker->Y,dx,dy,1) ) {
+    if( type->GivesResource!=OilCost && 
AiFindBuildingPlace2(worker,type,worker->X,worker->Y,dx,dy,1) ) {
        return 1;
     }
 
Index: stratagus/src/ai/ai_resource.c
diff -u stratagus/src/ai/ai_resource.c:1.61 stratagus/src/ai/ai_resource.c:1.62
--- stratagus/src/ai/ai_resource.c:1.61 Sat Aug  9 16:32:51 2003
+++ stratagus/src/ai/ai_resource.c      Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ai_resource.c,v 1.61 2003/08/09 20:32:51 n0body Exp $
+//      $Id: ai_resource.c,v 1.62 2003/08/11 02:14:46 n0body Exp $
 
 #ifdef NEW_AI  // {
 
@@ -855,7 +855,7 @@
                //
                //      Look if there is a mine
                //
-               if ( (mine=GoldMineOnMap(x,y)) ) {
+               if ( (mine=ResourceOnMap(x,y,GoldCost)) ) {
                    if( destu ) {
                        n=max(abs(destx-x),abs(desty-y));
                        if( n<bestd ) {
@@ -932,7 +932,7 @@
     DebugCheck(unit->Type != UnitTypeHumanWorker
            && unit->Type != UnitTypeOrcWorker);
 
-    CommandMineGold(unit, dest, FlushCommands);
+    CommandResource(unit, dest, FlushCommands);
 
     return 1;
 }
@@ -1256,16 +1256,12 @@
        //      See if it's assigned already
        //
        switch( unit->Orders[0].Action ) {
-           case UnitActionMineGold:
-               units_assigned[num_units_assigned[GoldCost]++][GoldCost]=unit;
-               continue;
            case UnitActionHarvest:
                units_assigned[num_units_assigned[WoodCost]++][WoodCost]=unit;
                continue;
            case UnitActionResource:
                
units_assigned[num_units_assigned[unit->Type->ResourceHarvested]++][unit->Type->ResourceHarvested]=unit;
                continue;
-               // FIXME: the other resources
            default:
                break;
        }
@@ -1418,7 +1414,7 @@
                            int n1;
                            int n2;
                            case GoldCost:
-                               if( unit->Orders[0].Action==UnitActionMineGold 
|| AiMineGold(unit) ) {
+                               if( 
(unit->Orders[0].Action==UnitActionResource&&unit->Type->ResourceHarvested==GoldCost)
 || AiMineGold(unit) ) {
                                    DebugLevel3Fn("Assigned to gold\n");
                                    
units_assigned[num_units_assigned[c]++][c]=unit;
                                    units_unassigned[i][c] = 
units_unassigned[--num_units_unassigned[c]][c];
@@ -1450,7 +1446,7 @@
                                }
                                break;
                            case OilCost:
-                               if( unit->Orders[0].Action==UnitActionResource 
|| AiHaulOil(unit) ) {
+                               if( 
(unit->Orders[0].Action==UnitActionResource&&unit->Type->ResourceHarvested==OilCost)
 || AiHaulOil(unit) ) {
                                    DebugLevel3Fn("Assigned to oil\n");
                                    
units_assigned[num_units_assigned[c]++][c]=unit;
                                    units_unassigned[i][c] = 
units_unassigned[--num_units_unassigned[c]][c];
@@ -1519,9 +1515,10 @@
     nunits = FindPlayerUnitsByType(AiPlayer->Player,type,table);
     for (num = i = 0; i < nunits; i++) {
        unit = table[i];
-    //if (unit->Orders[0].Action != UnitActionBuild && unit->OrderCount==1 ) {
-       if ( unit->Orders[0].Action == UnitActionMineGold
-               && unit->OrderCount==1 ) {
+       if ( unit->Type->CanRepair &&
+               (unit->Orders[0].Action==UnitActionResource ||
+               unit->Orders[0].Action==UnitActionStill) &&
+               unit->OrderCount==1 ) {
            table[num++] = unit;
        }
     }
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.285 stratagus/src/clone/unit.c:1.286
--- stratagus/src/clone/unit.c:1.285    Sat Aug  9 16:32:51 2003
+++ stratagus/src/clone/unit.c  Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.c,v 1.285 2003/08/09 20:32:51 n0body Exp $
+//     $Id: unit.c,v 1.286 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -472,45 +472,6 @@
     unit->X=x;
     unit->Y=y;
 
-#if 0
-    //
-    // Place unit on the map.
-    //
-    if( type->Building ) {
-       //
-       //      Mark building on movement map.
-       //              buildings that could be entered have no HP!
-       //              on Oilpatch could be build.
-       //
-
-       // FIXME: should be done more general.
-       if( unit->HP ) {
-           for( h=type->TileHeight; h--; ) {
-               for( w=type->TileWidth; w--; ) {
-                   TheMap.Fields[x+w+(y+h)*TheMap.Width].Flags
-                       |=MapFieldBuilding;
-               }
-           }
-       } else if( !type->OilPatch ) {
-           for( h=type->TileHeight; h--; ) {
-               for( w=type->TileWidth; w--; ) {
-                   TheMap.Fields[x+w+(y+h)*TheMap.Width].Flags
-                       |=MapFieldNoBuilding;
-               }
-           }
-       }
-    } else {
-       unsigned flags;
-
-       flags=unit->Type->FieldFlags;
-       for( h=type->TileHeight; h--; ) {
-           for( w=type->TileWidth; w--; ) {
-               TheMap.Fields[x+w+(y+h)*TheMap.Width].Flags|=flags;
-           }
-       }
-    }
-#else
-
     //
     // Place unit on the map, mark the field with the FieldFlags.
     //
@@ -531,8 +492,6 @@
     }
 #endif
 
-#endif
-
     x+=unit->Type->TileWidth/2;
     y+=unit->Type->TileHeight/2;
 
@@ -710,52 +669,6 @@
     // FIXME: unit is tracked?
 
     type=unit->Type;
-#if 0
-    //
-    // Update map
-    //
-    if( type->Building ) {
-       //
-       //      Unmark building on movement map.
-       //              buildings that could be entered have no HP!
-       //              on Oilpatch could be build.
-       //
-
-       // FIXME: should be done more general.
-       if( unit->Stats->HitPoints ) {
-           for( h=type->TileHeight; h--; ) {
-               for( w=type->TileWidth; w--; ) {
-                   TheMap.Fields[unit->X+w+(unit->Y+h)*TheMap.Width].Flags
-                       &=~MapFieldBuilding;
-               }
-           }
-       } else if( !type->OilPatch ) {
-           for( h=type->TileHeight; h--; ) {
-               for( w=type->TileWidth; w--; ) {
-                   TheMap.Fields[unit->X+w+(unit->Y+h)*TheMap.Width].Flags
-                       &=~MapFieldNoBuilding;
-               }
-           }
-       }
-#ifdef HIERARCHIC_PATHFINDER
-       //
-       //      Update hierarchic pathfinder structures.
-       //
-       PfHierMapChangedCallback (unit->X, unit->Y,
-               unit->X + unit->Type->TileWidth - 1,
-               unit->Y + unit->Type->TileHeight - 1);
-#endif
-    } else {
-       unsigned flags;
-
-       flags=~UnitFieldFlags(unit);
-       for( h=type->TileHeight; h--; ) {
-           for( w=type->TileWidth; w--; ) {
-               TheMap.Fields[unit->X+w+(unit->Y+h)*TheMap.Width].Flags&=flags;
-           }
-       }
-    }
-#else
 
     //
     // Update map
@@ -776,8 +689,6 @@
     }
 #endif
 
-#endif
-
     DebugLevel3Fn("%d %p %p\n" _C_ UnitNumber(unit) _C_ unit _C_ unit->Next);
     UnitCacheRemove(unit);
     // UnitCache uses Next, need to set next again
@@ -2334,6 +2245,7 @@
 
     if( EditorRunning ) {
        if( type->GivesResource==OilCost ) {
+           // FIXME: Better ideas? type->OnlyPlaceable on odd tiles? Yuck.
            // Oil patches and platforms can only be placed on even tiles
            if( !(x&1 && y&1) ) {
                return 0;
@@ -2779,7 +2691,7 @@
     best_d=99999;
     for (pnum=0;pnum<PlayerMax;++pnum) {
        // FIXME: allow harvesting from ally
-       if ( (pnum!=PlayerMax-1) && (pnum!=ThisPlayer->Player) ) {
+       if ( (pnum!=PlayerMax-1) && (pnum!=player->Player) ) {
            continue;
        }
        nunits=Players[pnum].TotalNumUnits;
@@ -2811,7 +2723,7 @@
  **    @param player   The player the deposit must belong to.
  **    @param x        Nearest to X position.
  **    @param y        Nearest to Y position.
- **    @param resource The resource oyu need the deposit to hold.
+ **    @param resource The resource you need the deposit to hold.
  **
  **    @return         NoUnitP or oil deposit unit
  */
@@ -3107,15 +3019,6 @@
     UnitLost(unit);
     UnitClearOrders(unit);
 
-    // FIXME: ugly trick unit-peon-with-gold ... has no die sequence.
-    if( type==UnitTypeHumanWorkerWithGold
-           || type==UnitTypeHumanWorkerWithWood ) {
-       unit->Type=UnitTypeHumanWorker;
-    } else if( type==UnitTypeOrcWorkerWithGold
-           || type==UnitTypeOrcWorkerWithWood ) {
-       unit->Type=UnitTypeOrcWorker;
-    }
-
     //
     // Unit has death animation.
     //
@@ -3671,9 +3574,6 @@
        case UnitActionHarvest:
            fprintf(file,"action-harvest");
            break;
-       case UnitActionMineGold:
-           fprintf(file,"action-mine-gold");
-           break;
        case UnitActionResource:
            fprintf(file,"action-resource");
            break;
@@ -3716,10 +3616,6 @@
            case UnitActionResearch:
                fprintf(file," upgrade %s",((Upgrade*)order->Arg1)->Ident);
                break;
-           case UnitActionMineGold:
-               fprintf(file," mine (%d %d)",
-                       (int)order->Arg1>>16,(int)order->Arg1&0xFFFF);
-               break;
            default:
                fprintf(file," arg1 %d",(int)order->Arg1);
                break;
@@ -3976,7 +3872,7 @@
     int InRun, RunStart;
 
     fprintf(file,"\n;;; -----------------------------------------\n");
-    fprintf(file,";;; MODULE: units $Id: unit.c,v 1.285 2003/08/09 20:32:51 
n0body Exp $\n\n");
+    fprintf(file,";;; MODULE: units $Id: unit.c,v 1.286 2003/08/11 02:14:46 
n0body Exp $\n\n");
 
     //
     // Local variables
Index: stratagus/src/clone/unit_draw.c
diff -u stratagus/src/clone/unit_draw.c:1.149 
stratagus/src/clone/unit_draw.c:1.150
--- stratagus/src/clone/unit_draw.c:1.149       Sat Aug  9 16:08:38 2003
+++ stratagus/src/clone/unit_draw.c     Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit_draw.c,v 1.149 2003/08/09 20:08:38 martinxyz Exp $
+//     $Id: unit_draw.c,v 1.150 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -649,7 +649,7 @@
 global void SaveDecorations(FILE* file)
 {
     fprintf(file,"\n;;; -----------------------------------------\n");
-    fprintf(file,";;; MODULE: decorations $Id: unit_draw.c,v 1.149 2003/08/09 
20:08:38 martinxyz Exp $\n\n");
+    fprintf(file,";;; MODULE: decorations $Id: unit_draw.c,v 1.150 2003/08/11 
02:14:46 n0body Exp $\n\n");
 
     fprintf(file,"(mana-sprite \"%s\"  %d %d  %d %d)\n",
        ManaSprite.File,ManaSprite.HotX,ManaSprite.HotY,
@@ -1522,11 +1522,6 @@
            break;
 
        case UnitActionHarvest:
-           e_color = color = ColorYellow;
-           dest = 1;
-           break;
-
-       case UnitActionMineGold:
            e_color = color = ColorYellow;
            dest = 1;
            break;
Index: stratagus/src/clone/unit_find.c
diff -u stratagus/src/clone/unit_find.c:1.51 
stratagus/src/clone/unit_find.c:1.52
--- stratagus/src/clone/unit_find.c:1.51        Sat Aug  9 16:32:52 2003
+++ stratagus/src/clone/unit_find.c     Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit_find.c,v 1.51 2003/08/09 20:32:52 n0body Exp $
+//     $Id: unit_find.c,v 1.52 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -478,32 +478,6 @@
 /*----------------------------------------------------------------------------
 --     Finding special units
 ----------------------------------------------------------------------------*/
-
-/**
-**     Gold mine on map tile
-**
-**     @param tx       X position on map, tile-based.
-**     @param ty       Y position on map, tile-based.
-**
-**     @return         Returns the gold mine if found, or NoUnitP.
-*/
-global Unit* GoldMineOnMap(int tx,int ty)
-{
-    Unit* table[UnitMax];
-    int i;
-    int n;
-
-    n=SelectUnitsOnTile(tx,ty,table);
-    for( i=0; i<n; ++i ) {
-       if( UnitUnusable(table[i]) ) {
-           continue;
-       }
-       if( table[i]->Type->GivesResource==GoldCost ) {
-           return table[i];
-       }
-    }
-    return NoUnitP;
-}
 
 /**
 **     Find a unit on a map tile with a specific type
Index: stratagus/src/include/actions.h
diff -u stratagus/src/include/actions.h:1.52 
stratagus/src/include/actions.h:1.53
--- stratagus/src/include/actions.h:1.52        Fri Aug  8 15:31:36 2003
+++ stratagus/src/include/actions.h     Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: actions.h,v 1.52 2003/08/08 19:31:36 n0body Exp $
+//     $Id: actions.h,v 1.53 2003/08/11 02:14:46 n0body Exp $
 
 #ifndef __ACTIONS_H__
 #define __ACTIONS_H__
@@ -102,9 +102,7 @@
 extern void CommandCancelBuilding(Unit* unit,Unit* worker);
     /// Prepare command harvest
 extern void CommandHarvest(Unit* unit,int x,int y,int flush);
-    /// Prepare command mine
-extern void CommandMineGold(Unit* unit,Unit* dest,int flush);
-    /// Prepare command haul
+    /// Prepare command resource
 extern void CommandResource(Unit* unit,Unit* dest,int flush);
     /// Prepare command return
 extern void CommandReturnGoods(Unit* unit,Unit* goal,int flush);
@@ -164,8 +162,6 @@
 extern void HandleActionUnload(Unit* unit);
     /// Handle command harvest
 extern void HandleActionHarvest(Unit* unit);
-    /// Handle command mine
-extern void HandleActionMineGold(Unit* unit);
     /// Handle command haul
 extern void HandleActionResource(Unit* unit);
     /// Handle command return
Index: stratagus/src/include/commands.h
diff -u stratagus/src/include/commands.h:1.20 
stratagus/src/include/commands.h:1.21
--- stratagus/src/include/commands.h:1.20       Fri Aug  8 15:31:36 2003
+++ stratagus/src/include/commands.h    Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: commands.h,v 1.20 2003/08/08 19:31:36 n0body Exp $
+//     $Id: commands.h,v 1.21 2003/08/11 02:14:46 n0body Exp $
 
 #ifndef __COMMANDS_H__
 #define __COMMANDS_H__
@@ -100,8 +100,6 @@
 extern void SendCommandCancelBuilding(Unit* unit,Unit* peon);
     /// Send harvest command
 extern void SendCommandHarvest(Unit* unit,int x,int y,int flush);
-    /// Send mine gold command
-extern void SendCommandMineGold(Unit* unit,Unit* dest,int flush);
     /// Send haul oil command
 extern void SendCommandResource(Unit* unit,Unit* dest,int flush);
     /// Send return goods command
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.203 stratagus/src/include/unit.h:1.204
--- stratagus/src/include/unit.h:1.203  Sat Aug  9 16:32:52 2003
+++ stratagus/src/include/unit.h        Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.h,v 1.203 2003/08/09 20:32:52 n0body Exp $
+//     $Id: unit.h,v 1.204 2003/08/11 02:14:46 n0body Exp $
 
 #ifndef __UNIT_H__
 #define __UNIT_H__
@@ -278,8 +278,8 @@
 **
 **     Unit::Value
 **
-**             This values hold the amount of gold in a goldmine, amount of
-**             oil in an oil patch or oil platform.
+**             This values hold the amount of resources in a resource or in
+**             in a harvester.
 **             FIXME: continue documentation
 **
 **     Unit::SubAction
@@ -290,7 +290,8 @@
 **
 **     Unit::Wait
 **
-**             FIXME: continue documentation
+**             The unit is forced too wait for that many cycles. Be carefull,
+**             setting this to 0 will lock the unit.
 **
 **     Unit::State
 **
@@ -298,7 +299,6 @@
 **             0 if an animation has just started, it should only be changed
 **             inside of actions.
 **
-**
 **     Unit::Reset
 **
 **             FIXME: continue documentation
@@ -314,11 +314,6 @@
 **             Pointer to the original owner of an unit. It will be NULL if
 **             the unit was not rescued.
 **
-**     Unit::OnBoard[::MAX_UNITS_ONBOARD]
-**
-**             A table of units on board. This can be units in a transporter
-**             or units in a tower.
-**
 **     Unit::OrderCount
 **
 **             The number of the orders unit to process. An unit has atleast
@@ -426,11 +421,7 @@
 
     UnitActionRepair,                  /// unit repairing
     UnitActionHarvest,                 /// unit harvest lumber
-    UnitActionMineGold,                        /// unit mines gold
-    UnitActionMineOre,                 /// unit mines ore FIXME: not written
-    UnitActionMineCoal,                        /// unit mines coal FIXME: not 
written
-    UnitActionQuarryStone,             /// unit quarrying stone FIXME: not 
written
-    UnitActionResource,                        /// unit hauling oil
+    UnitActionResource,                        /// unit harvesting resources
     UnitActionReturnGoods,             /// unit returning any resource
 
     UnitActionDemolish,                        /// unit demolish at 
position/unit
@@ -979,8 +970,6 @@
 
     /// Return unit of a fixed type on a map tile.
 extern Unit* UnitTypeOnMap(int tx,int ty,UnitType* type);
-    /// Return gold mine, if on map tile
-extern Unit* GoldMineOnMap(int tx,int ty);
     /// Return resource, if on map tile
 extern Unit* ResourceOnMap(int tx,int ty,int resource);
     /// Return resource deposit, if on map tile
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.94 
stratagus/src/include/unittype.h:1.95
--- stratagus/src/include/unittype.h:1.94       Sat Aug  9 16:32:52 2003
+++ stratagus/src/include/unittype.h    Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.h,v 1.94 2003/08/09 20:32:52 n0body Exp $
+//     $Id: unittype.h,v 1.95 2003/08/11 02:14:46 n0body Exp $
 
 #ifndef __UNITTYPE_H__
 #define __UNITTYPE_H__
@@ -555,8 +555,7 @@
 #define MouseActionNone                0               /// Nothing
 #define MouseActionAttack      1               /// Attack
 #define MouseActionMove                2               /// Move
-#define MouseActionHarvest     3               /// Harvest or mine gold
-#define MouseActionHaulOil     4               /// Haul oil
+#define MouseActionHarvest     3               /// Harvest resources
 #define MouseActionDemolish    5               /// Demolish
 #define MouseActionSail                6               /// Sail
     int                Points;                 /// How many points you get for 
unit
@@ -583,6 +582,7 @@
     unsigned ShoreBuilding : 1;                /// Building must be build on 
coast.
     unsigned CanCastSpell : 1;         /// Unit is able to use spells.
     unsigned CanAttack : 1;            /// Unit can attack.
+    unsigned CanRepair : 1;            /// Unit can repair .
     unsigned Tower : 1;                        /// Unit can attack, but not 
move.
     unsigned Hero : 1;                 /// Is hero only used for triggers .
     unsigned Volatile : 1;             /// Invisiblity/unholy armor kills unit.
@@ -591,7 +591,7 @@
     
     unsigned CanStore[MaxCosts];       /// Resources that we can store here.
     unsigned GivesResource;            /// The resource this unit gives.
-    unsigned CanHarvest : 1;           /// Resource can be harvested(false for 
oil patches).
+    unsigned CanHarvest : 1;           /// Resource can be harvested (false 
for oil patches).
     unsigned Harvester : 1;            /// Unit is a resource worker.
     unsigned ResourceHarvested;                /// The resource it can harvest.
     unsigned WaitAtResource;           /// Cycles the unit waits while mining.
@@ -651,8 +651,6 @@
 // FIXME: this hardcoded unit-types must be removed!!
 extern UnitType*UnitTypeHumanWorker;           /// Human worker
 extern UnitType*UnitTypeOrcWorker;             /// Orc worker
-extern UnitType*UnitTypeHumanWorkerWithGold;   /// Human worker with gold
-extern UnitType*UnitTypeOrcWorkerWithGold;     /// Orc worker with gold
 extern UnitType*UnitTypeHumanWorkerWithWood;   /// Human worker with wood
 extern UnitType*UnitTypeOrcWorkerWithWood;     /// Orc worker with wood
 extern UnitType*UnitTypeHumanWall;             /// Human wall
Index: stratagus/src/map/map_wood.c
diff -u stratagus/src/map/map_wood.c:1.26 stratagus/src/map/map_wood.c:1.27
--- stratagus/src/map/map_wood.c:1.26   Fri Jul 11 10:35:32 2003
+++ stratagus/src/map/map_wood.c        Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: map_wood.c,v 1.26 2003/07/11 14:35:32 n0body Exp $
+//     $Id: map_wood.c,v 1.27 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -46,6 +46,7 @@
 #include "map.h"
 #include "minimap.h"
 #include "player.h"
+#include "editor.h"
 #ifdef HIERARCHIC_PATHFINDER
 #include "pathfinder.h"
 #endif
@@ -328,6 +329,7 @@
 */
 global void MapRemoveWood(unsigned x, unsigned y)
 {
+    //EditTile(x,y,TheMap.Tileset->RemovedTree);
     MapField *mf;
 
     mf = TheMap.Fields + x + y * TheMap.Width;
Index: stratagus/src/network/commands.c
diff -u stratagus/src/network/commands.c:1.63 
stratagus/src/network/commands.c:1.64
--- stratagus/src/network/commands.c:1.63       Fri Aug  8 15:31:37 2003
+++ stratagus/src/network/commands.c    Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: commands.c,v 1.63 2003/08/08 19:31:37 n0body Exp $
+//     $Id: commands.c,v 1.64 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -145,7 +145,7 @@
        fprintf(LogFile,"(replay-log\n");
        fprintf(LogFile,"  'comment\t\"Generated by Stratagus Version " VERSION 
"\"\n");
        fprintf(LogFile,"  'comment\t\"Visit http://Stratagus.Org for more 
information\"\n");
-       fprintf(LogFile,"  'comment\t\"$Id: commands.c,v 1.63 2003/08/08 
19:31:37 n0body Exp $\"\n");
+       fprintf(LogFile,"  'comment\t\"$Id: commands.c,v 1.64 2003/08/11 
02:14:46 n0body Exp $\"\n");
        if( NetworkFildes==-1 ) {
            fprintf(LogFile,"  'type\t\"%s\"\n","single-player");
            fprintf(LogFile,"  'race\t%d\n",GameSettings.Presets[0].Race);
@@ -563,8 +563,6 @@
        SendCommandCancelBuilding(UnitSlots[unit],dunit);
     } else if( !strcmp(name,"harvest") ) {
        SendCommandHarvest(UnitSlots[unit],posx,posy,flags);
-    } else if( !strcmp(name,"mine") ) {
-       SendCommandMineGold(UnitSlots[unit],dunit,flags);
     } else if( !strcmp(name,"resource") ) {
        SendCommandResource(UnitSlots[unit],dunit,flags);
     } else if( !strcmp(name,"return") ) {
@@ -922,24 +920,7 @@
 }
 
 /**
-**     Send command: Unit mine gold.
-**
-**     @param unit     pointer to unit.
-**     @param dest     pointer to destination (gold-mine).
-**     @param flush    Flag flush all pending commands.
-*/
-global void SendCommandMineGold(Unit* unit,Unit* dest,int flush)
-{
-    if( NetworkFildes==-1 ) {
-       CommandLog("mine",unit,flush,-1,-1,dest,NULL,-1);
-       CommandMineGold(unit,dest,flush);
-    } else {
-       NetworkSendCommand(MessageCommandMine,unit,0,0,dest,0,flush);
-    }
-}
-
-/**
-**     Send command: Unit haul oil.
+**     Send command: Unit harvest resources
 **
 **     @param unit     pointer to unit.
 **     @param dest     pointer to destination (oil-platform).
@@ -1330,15 +1311,6 @@
        case MessageCommandHarvest:
            CommandLog("harvest",unit,status,x,y,NoUnitP,NULL,-1);
            CommandHarvest(unit,x,y,status);
-           break;
-       case MessageCommandMine:
-           dest=NoUnitP;
-           if( dstnr!=(unsigned short)0xFFFF ) {
-               dest=UnitSlots[dstnr];
-               DebugCheck( !dest || !dest->Type );
-           }
-           CommandLog("mine",unit,status,-1,-1,dest,NULL,-1);
-           CommandMineGold(unit,dest,status);
            break;
        case MessageCommandResource:
            dest=NoUnitP;
Index: stratagus/src/ui/botpanel.c
diff -u stratagus/src/ui/botpanel.c:1.82 stratagus/src/ui/botpanel.c:1.83
--- stratagus/src/ui/botpanel.c:1.82    Sun Aug 10 13:54:54 2003
+++ stratagus/src/ui/botpanel.c Sun Aug 10 22:14:46 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: botpanel.c,v 1.82 2003/08/10 17:54:54 martinxyz Exp $
+//     $Id: botpanel.c,v 1.83 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -114,7 +114,7 @@
 #endif
 
     fprintf(file,"\n;;; -----------------------------------------\n");
-    fprintf(file,";;; MODULE: buttons $Id: botpanel.c,v 1.82 2003/08/10 
17:54:54 martinxyz Exp $\n\n");
+    fprintf(file,";;; MODULE: buttons $Id: botpanel.c,v 1.83 2003/08/11 
02:14:46 n0body Exp $\n\n");
 
 #ifndef NEW_UI
     for( i=0; i<NumUnitButtons; ++i ) {
@@ -576,7 +576,7 @@
                    case ButtonHarvest:
                    case ButtonReturn:
                        for( j=0; j<NumSelected; ++j ) {
-                           if( 
Selected[j]->Orders[0].Action!=UnitActionMineGold
+                           if( 
Selected[j]->Orders[0].Action!=UnitActionResource
                                    && Selected[j]->Orders[0].Action
                                        !=UnitActionHarvest ) {
                                break;
Index: stratagus/src/ui/interface.c
diff -u stratagus/src/ui/interface.c:1.133 stratagus/src/ui/interface.c:1.134
--- stratagus/src/ui/interface.c:1.133  Fri Aug  8 06:16:44 2003
+++ stratagus/src/ui/interface.c        Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: interface.c,v 1.133 2003/08/08 10:16:44 martinxyz Exp $
+//     $Id: interface.c,v 1.134 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -1082,7 +1082,7 @@
            if( !ThisPlayer->Ai ) {
                AiInit( ThisPlayer );
            }
-           SetMessage("I'm and AI Now :)");
+           SetMessage("I'm an AI Now :)");
        }
 #endif
     } else {
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.136 stratagus/src/ui/mouse.c:1.137
--- stratagus/src/ui/mouse.c:1.136      Sat Aug  9 16:32:52 2003
+++ stratagus/src/ui/mouse.c    Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: mouse.c,v 1.136 2003/08/09 20:32:52 n0body Exp $
+//     $Id: mouse.c,v 1.137 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -201,98 +201,50 @@
        //      Worker of human or orcs
        //
        if( action==MouseActionHarvest ) {
-           if( type==UnitTypeOrcWorkerWithWood
-                   || type==UnitTypeHumanWorkerWithWood
-                   || type==UnitTypeOrcWorkerWithGold
-                   || type==UnitTypeHumanWorkerWithGold ) {
-               if( UnitUnderCursor && (dest=UnitOnMapTile(x,y)) ) {
-                   if( dest->Player==unit->Player ) {
-                       dest->Blink=4;
-                       if( dest->Type->CanStore[GoldCost]
-                               && (type==UnitTypeOrcWorkerWithGold
-                                   || type==UnitTypeHumanWorkerWithGold) ) {
-                           DebugLevel3("GOLD-DEPOSIT\n");
-                           SendCommandReturnGoods(unit,dest,flush);
-                           continue;
-                       }
-                       if( (dest->Type->CanStore[WoodCost])
-                               && (type==UnitTypeOrcWorkerWithWood
-                                   || type==UnitTypeHumanWorkerWithWood) ) {
-                           DebugLevel3("WOOD-DEPOSIT\n");
-                           SendCommandReturnGoods(unit,dest,flush);
-                           continue;
-                       }
-                   }
-               }
-           } else {
-               if( IsMapFieldExplored(unit->Player,x,y) && ForestOnMap(x,y) ) {
-                   SendCommandHarvest(unit,x,y,flush);
-                   continue;
-               }
-               if( UnitUnderCursor && (dest=GoldMineOnMap(x,y)) ) {
-                   dest->Blink=4;
-                   DebugLevel3("GOLD-MINE\n");
-                   SendCommandMineGold(unit,dest,flush);
-                   continue;
-               }
+           //  Return wood cutter home
+           if( (type==UnitTypeOrcWorkerWithWood ||
+                   type==UnitTypeHumanWorkerWithWood) &&
+                   (dest=ResourceDepositOnMap(x,y,WoodCost)) &&
+                   dest->Player==unit->Player) {
+               DebugLevel3("send to wood deposit.\n");
+               dest->Blink=4;
+               SendCommandReturnGoods(unit,dest,flush);
+               continue;
            }
-
-           if( UnitUnderCursor
-                   && (dest=TargetOnScreenMapPosition(unit,sx,sy)) ) {
-               if( IsEnemy(unit->Player,dest) ) {
-                   dest->Blink=4;
-                   SendCommandAttack(unit,x,y,dest,flush);
-                   continue;
-               }
+           //  Send wood cutter to work
+           if((type==UnitTypeOrcWorker||type==UnitTypeHumanWorker) &&
+                   IsMapFieldExplored(unit->Player,x,y) &&
+                   ForestOnMap(x,y) ) {
+               SendCommandHarvest(unit,x,y,flush);
+               continue;
            }
-
-           // cade: this is default repair action
-           if( UnitUnderCursor
-                   && (dest=RepairableOnScreenMapPosition(sx, sy)) ) {
-               if( dest->Type && (dest->Player==unit->Player
-                       || IsAllied(unit->Player,dest)) ) {
-                   SendCommandRepair(unit,x,y,dest,flush);
+           if (unit->Type->Harvester&&UnitUnderCursor) {
+               //  Return a loaded harvester to deposit
+               if( (unit->Value>0) &&
+                       
(dest=ResourceDepositOnMap(x,y,unit->Type->ResourceHarvested)) &&
+                       (dest->Player==unit->Player)) {
+                   dest->Blink=4;
+                   DebugLevel3Fn("Return to deposit.\n");
+                   SendCommandReturnGoods(unit,dest,flush);
                    continue;
-               }
-           }
-
-           if( UnitUnderCursor && (dest=UnitOnScreenMapPosition(sx,sy)) ) {
-               // FIXME: should ally to self
-               if( (dest->Player==unit->Player || IsAllied(unit->Player,dest))
-                       && dest!=unit ) {
+               } 
+               //  Go and harvest
+               if( (unit->Value<unit->Type->ResourceCapacity) &&
+                       (dest=ResourceOnMap(x,y,unit->Type->ResourceHarvested)) 
&&
+                       ((dest->Player==unit->Player) ||
+                        (dest->Player->Player==PlayerMax-1))) {
                    dest->Blink=4;
-                   SendCommandFollow(unit,dest,flush);
+                   SendCommandResource(unit,dest,flush);
                    continue;
                }
            }
-
-           SendCommandMove(unit,x,y,flush);
-           continue;
-       }
-
-       //
-       //      Tanker
-       //
-       if( action==MouseActionHaulOil ) {
-           //  Return to deposit
-           if( (unit->Type->Harvester) &&
-                   (unit->Value) &&
+           //  Go and repair
+           if ( (unit->Type->CanRepair) &&
                    (UnitUnderCursor) &&
-                   
(dest=ResourceDepositOnMap(x,y,unit->Type->ResourceHarvested)) &&
-                   (dest->Player==unit->Player)) {
+                   (dest=RepairableOnScreenMapPosition(sx,sy)) &&
+                   ((dest->Player==unit->Player) || 
(IsAllied(dest->Player,dest)))) {
                dest->Blink=4;
-               DebugLevel3Fn("Return to deposit.\n");
-               SendCommandReturnGoods(unit,dest,flush);
-               continue;
-           } 
-           //  Go and harvest
-           if( (unit->Type->Harvester) &&
-                   (unit->Value<unit->Type->ResourceCapacity) &&
-                   (UnitUnderCursor) &&
-                   (dest=ResourceOnMap(x,y,unit->Type->ResourceHarvested)) &&
-                   (dest->Player==unit->Player)) {
-               dest->Blink=4;
-               SendCommandResource(unit,dest,flush);
+               SendCommandRepair(unit,x,y,dest,flush);
                continue;
            }
            //  Follow another unit
@@ -415,10 +367,10 @@
                 
SendCommandResource(Selected[i],dest,!(KeyModifiers&ModifierShift));
                continue;
             }
-            if( UnitUnderCursor && (dest=GoldMineOnMap(x,y)) ) {
+            if( UnitUnderCursor && (dest=ResourceOnMap(x,y,GoldCost)) ) {
                dest->Blink=4;
                 DebugLevel3("RALY POINT TO GOLD-MINE\n");
-               
SendCommandMineGold(Selected[i],dest,!(KeyModifiers&ModifierShift));
+               
SendCommandResource(Selected[i],dest,!(KeyModifiers&ModifierShift));
                continue;
            }
            if( IsMapFieldExplored(unit->Player,x,y) && ForestOnMap(x,y) ) {
@@ -1049,7 +1001,7 @@
        if( UnitUnderCursor && (dest=ResourceOnMap(x,y,GoldCost)) ) {
            dest->Blink=4;
            DebugLevel3("GOLD-MINE\n");
-           SendCommandMineGold(Selected[i],dest,!(KeyModifiers&ModifierShift));
+           SendCommandResource(Selected[i],dest,!(KeyModifiers&ModifierShift));
            continue;
        }
        SendCommandHarvest(Selected[i],x,y,!(KeyModifiers&ModifierShift));
Index: stratagus/src/unit/ccl_unit.c
diff -u stratagus/src/unit/ccl_unit.c:1.62 stratagus/src/unit/ccl_unit.c:1.63
--- stratagus/src/unit/ccl_unit.c:1.62  Fri Aug  8 15:31:37 2003
+++ stratagus/src/unit/ccl_unit.c       Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unit.c,v 1.62 2003/08/08 19:31:37 n0body Exp $
+//     $Id: ccl_unit.c,v 1.63 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -210,8 +210,6 @@
            order->Action=UnitActionRepair;
        } else if( gh_eq_p(value,gh_symbol2scm("action-harvest")) ) {
            order->Action=UnitActionHarvest;
-       } else if( gh_eq_p(value,gh_symbol2scm("action-mine-gold")) ) {
-           order->Action=UnitActionMineGold;
        } else if( gh_eq_p(value,gh_symbol2scm("action-resource")) ) {
            order->Action=UnitActionResource;
        } else if( gh_eq_p(value,gh_symbol2scm("action-return-goods")) ) {
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.72 
stratagus/src/unit/ccl_unittype.c:1.73
--- stratagus/src/unit/ccl_unittype.c:1.72      Fri Aug  8 15:31:37 2003
+++ stratagus/src/unit/ccl_unittype.c   Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unittype.c,v 1.72 2003/08/08 19:31:37 n0body Exp $
+//     $Id: ccl_unittype.c,v 1.73 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -356,8 +356,6 @@
            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-haul-oil")) ) {
-           type->MouseAction=MouseActionHaulOil;
        } else if( gh_eq_p(value,gh_symbol2scm("right-demolish")) ) {
            type->MouseAction=MouseActionDemolish;
        } else if( gh_eq_p(value,gh_symbol2scm("right-sail")) ) {
@@ -367,6 +365,8 @@
            type->GroundAttack=1;
        } else if( gh_eq_p(value,gh_symbol2scm("can-attack")) ) {
            type->CanAttack=1;
+       } else if( gh_eq_p(value,gh_symbol2scm("can-repair")) ) {
+           type->CanRepair=1;
 
        } else if( gh_eq_p(value,gh_symbol2scm("can-target-land")) ) {
            type->CanTarget|=CanTargetLand;
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.83 stratagus/src/unit/unittype.c:1.84
--- stratagus/src/unit/unittype.c:1.83  Sat Aug  9 16:32:52 2003
+++ stratagus/src/unit/unittype.c       Sun Aug 10 22:14:46 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.c,v 1.83 2003/08/09 20:32:52 n0body Exp $
+//     $Id: unittype.c,v 1.84 2003/08/11 02:14:46 n0body Exp $
 
 //@{
 
@@ -84,8 +84,6 @@
 #endif
 global UnitType*UnitTypeHumanWorker;           /// Human worker
 global UnitType*UnitTypeOrcWorker;             /// Orc worker
-global UnitType*UnitTypeHumanWorkerWithGold;   /// Human worker with gold
-global UnitType*UnitTypeOrcWorkerWithGold;     /// Orc worker with gold
 global UnitType*UnitTypeHumanWorkerWithWood;   /// Human worker with wood
 global UnitType*UnitTypeOrcWorkerWithWood;     /// Orc worker with wood
 global UnitType*UnitTypeHumanWall;             /// Human wall
@@ -809,9 +807,6 @@
        case MouseActionHarvest:
            fprintf(file,"'right-harvest");
            break;
-       case MouseActionHaulOil:
-           fprintf(file,"'right-haul-oil");
-           break;
        case MouseActionDemolish:
            fprintf(file,"'right-demolish");
            break;
@@ -830,6 +825,9 @@
     if( type->CanAttack ) {
        fprintf(file,"  'can-attack\n");
     }
+    if( type->CanRepair ) {
+       fprintf(file,"  'can-repair\n");
+    }
     if( type->CanTarget ) {
        fprintf(file,"  ");
        if( type->CanTarget&CanTargetLand ) {
@@ -1030,7 +1028,7 @@
     char **sp;
 
     fprintf(file,"\n;;; -----------------------------------------\n");
-    fprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.83 2003/08/09 
20:32:52 n0body Exp $\n\n");
+    fprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.84 2003/08/11 
02:14:46 n0body Exp $\n\n");
 
     // Original number to internal unit-type name.
 
@@ -1223,8 +1221,6 @@
     //
     UnitTypeHumanWorker=UnitTypeByIdent("unit-peasant");
     UnitTypeOrcWorker=UnitTypeByIdent("unit-peon");
-    UnitTypeHumanWorkerWithGold=UnitTypeByIdent("unit-peasant-with-gold");
-    UnitTypeOrcWorkerWithGold=UnitTypeByIdent("unit-peon-with-gold");
     UnitTypeHumanWorkerWithWood=UnitTypeByIdent("unit-peasant-with-wood");
     UnitTypeOrcWorkerWithWood=UnitTypeByIdent("unit-peon-with-wood");
     UnitTypeHumanWall=UnitTypeByIdent("unit-human-wall");
@@ -1448,8 +1444,6 @@
     //
     UnitTypeHumanWorker=NULL;
     UnitTypeOrcWorker=NULL;
-    UnitTypeHumanWorkerWithGold=NULL;
-    UnitTypeOrcWorkerWithGold=NULL;
     UnitTypeHumanWorkerWithWood=NULL;
     UnitTypeOrcWorkerWithWood=NULL;
     UnitTypeHumanWall=NULL;




reply via email to

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