stratagus-cvs
[Top][All Lists]
Advanced

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

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


From: Crestez Leonard
Subject: [Stratagus-CVS] stratagus data/ccl/units.ccl data/ccl/human/uni...
Date: Fri, 12 Sep 2003 13:44:39 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Crestez Leonard <address@hidden>        03/09/12 13:44:38

Modified files:
        data/ccl       : units.ccl 
        data/ccl/human : units.ccl 
        data/ccl/orc   : units.ccl 
        doc            : ChangeLog.html 
        doc/ccl        : config.html unittype.html 
        src/action     : action_build.c action_demolish.c 
                         action_repair.c action_resource.c 
                         action_still.c command.c 
        src/clone      : selection.c 
        src/include    : unittype.h video.h 
        src/map        : map_draw.c minimap.c 
        src/unit       : ccl_unittype.c unittype.c 

Log message:
        Fixed rare grave resource bug.
        Fixed make it so cheat for buildings and resource.
        Added some ccl options: 'demolish-range 'demolish-damage 
'clicks-to-explode 'random-movement-probablity

Patches:
Index: stratagus/data/ccl/human/units.ccl
diff -u stratagus/data/ccl/human/units.ccl:1.33 
stratagus/data/ccl/human/units.ccl:1.34
--- stratagus/data/ccl/human/units.ccl:1.33     Thu Sep 11 06:49:08 2003
+++ stratagus/data/ccl/human/units.ccl  Fri Sep 12 13:44:35 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.33 2003/09/11 10:49:08 n0body Exp $
+;;     $Id: units.ccl,v 1.34 2003/09/12 17:44:35 n0body Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -89,7 +89,6 @@
   'can-target-land
   'land-unit
   'coward
-  'harvester
   'can-gather-resource '(
        file-when-loaded "human/units/peasant_with_gold.png"  
        resource-id gold
@@ -296,6 +295,8 @@
   'demand 1
   'type-land
   'right-demolish
+  'demolish-range 2
+  'demolish-damage 400
   'can-attack
   'can-target-land
   'land-unit
@@ -459,7 +460,6 @@
   'type-naval
   'right-harvest
   'sea-unit 'coward
-  'harvester
   'can-gather-resource '(
       file-when-empty "human/units/oil_tanker_empty.png"
       file-when-loaded "human/units/oil_tanker_full.png"
Index: stratagus/data/ccl/orc/units.ccl
diff -u stratagus/data/ccl/orc/units.ccl:1.37 
stratagus/data/ccl/orc/units.ccl:1.38
--- stratagus/data/ccl/orc/units.ccl:1.37       Thu Sep 11 06:49:08 2003
+++ stratagus/data/ccl/orc/units.ccl    Fri Sep 12 13:44:36 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.37 2003/09/11 10:49:08 n0body Exp $
+;;     $Id: units.ccl,v 1.38 2003/09/12 17:44:36 n0body Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -85,7 +85,6 @@
   'can-target-land
   'land-unit
   'coward
-  'harvester
   'can-gather-resource '(
        file-when-loaded "orc/units/peon_with_gold.png"
        resource-id gold
@@ -293,6 +292,8 @@
   'demand 1
   'type-land
   'right-demolish
+  'demolish-range 2
+  'demolish-damage 400
   'can-attack
   'can-target-land
   'land-unit
@@ -461,7 +462,6 @@
   'type-naval
   'right-harvest
   'sea-unit 'coward
-  'harvester
   'can-gather-resource '(
         file-when-empty "human/units/oil_tanker_empty.png"
         file-when-loaded "human/units/oil_tanker_full.png"
Index: stratagus/data/ccl/units.ccl
diff -u stratagus/data/ccl/units.ccl:1.45 stratagus/data/ccl/units.ccl:1.46
--- stratagus/data/ccl/units.ccl:1.45   Thu Sep 11 06:49:07 2003
+++ stratagus/data/ccl/units.ccl        Fri Sep 12 13:44:34 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.45 2003/09/11 10:49:07 n0body Exp $
+;;     $Id: units.ccl,v 1.46 2003/09/12 17:44:34 n0body Exp $
 
 ;; Load the animations for the units.
 (ccl:load "ccl/anim.ccl")
@@ -170,6 +170,8 @@
   'can-target-land
   'land-unit
   'critter
+  'random-movement-probability 100
+  'clicks-to-explode 10
   'organic
   'sounds '(
     selected "critter-selected"
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.524 stratagus/doc/ChangeLog.html:1.525
--- stratagus/doc/ChangeLog.html:1.524  Thu Sep 11 06:49:08 2003
+++ stratagus/doc/ChangeLog.html        Fri Sep 12 13:44:36 2003
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-----   $Id: ChangeLog.html,v 1.524 2003/09/11 10:49:08 n0body Exp $
+----   $Id: ChangeLog.html,v 1.525 2003/09/12 17:44:36 n0body Exp $
 
 ----   (c) Copyright 1998-2003 by Lutz Sammer
 
@@ -36,6 +36,8 @@
 <li>Future 1.19 Release<p>
     <ul>
     <li>++
+    <li>Demolishing units and critters are more configurable (from Crestez 
Leonard).
+    <li>"make it so" cheat works again for resources and buildings (from 
Crestez Leonard).
     <li>Fixed attack-move bug (from Crestez Leonard).
     <li>Fixed bug #5116 on lose-resource option (from Crestez Leonard).
     <li>Fixed Ai resource gathering (and bug #5180) (from Crestez Leonard).
Index: stratagus/doc/ccl/config.html
diff -u stratagus/doc/ccl/config.html:1.22 stratagus/doc/ccl/config.html:1.23
--- stratagus/doc/ccl/config.html:1.22  Wed Sep 10 11:33:43 2003
+++ stratagus/doc/ccl/config.html       Fri Sep 12 13:44:36 2003
@@ -128,11 +128,11 @@
 
 <h2>Functions</h2>
 <a name="a-star"></a>
-<h3>(a-star on fixed_unit_cost moving_unit_cost unseen_terrain 
unseen_terrain_cost)</h3>
+<h3>(a-star on fixed-unit-cost moving-unit-cost unseen-terrain 
unseen-terrain-cost)</h3>
 
 Configures the A-star pathfinder to be on or off.  Also sets variables about 
the pathfinder.
 What the movement cost for unseen terrian is and whether units are aware of 
what's under unseen terrain.
-Items can be turned on and off to give desired behaviour, however 
dont_know_unseen_terrain will increase
+Items can be turned on and off to give desired behaviour, however 
dont-know-unseen-terrain will increase
 the amount the pathfinder is used at the start of a game while the map is 
being discovered.  If you need
 the performance, turn it off.
 
@@ -141,13 +141,13 @@
 <dl>
 <dt>on</dt>
 <dd>Whether A-Star is on or off &lt;'on|'off&gt;</dd>
-<dt>fixed_unit_cost</dt>
+<dt>fixed-unit-cost</dt>
 <dd>cost to move over a unit that is standing still.</dd>
-<dt>moving_unit_cost</dt>
+<dt>moving-unit-cost</dt>
 <dd>cost to move over a unit that is moving to somewhere.</dd>
-<dt>unseen_terrain</dt>
+<dt>unseen-terrain</dt>
 <dd>Whether the pathfinder treats unknown terrain as visible when calculating 
paths or not. &lt;'dont-know-unseen-terrain|'know-unseen-terrain&gt;</dd>
-<dt>unseen_terrain_cost</dt>
+<dt>unseen-terrain-cost</dt>
 <dd>Extra cost to move on unseen terrain, makes units tend towards know areas 
when finding paths.</dd>
 <dd></dd>
 
@@ -1575,7 +1575,7 @@
 <a href="../../data/ccl/stratagus.ccl"> $LIBARYPATH/ccl/stratagus.ccl </a>
 
 <hr>
-Last changed: $Id: config.html,v 1.22 2003/09/10 15:33:43 martinxyz Exp $<br>
+Last changed: $Id: config.html,v 1.23 2003/09/12 17:44:36 n0body Exp $<br>
 All trademarks and copyrights on this page are owned by their respective 
owners.
 <address>(c) 2002-2003 by <a href="http://stratagus.org";>
 The Stratagus Project</a></address></body></html>
Index: stratagus/doc/ccl/unittype.html
diff -u stratagus/doc/ccl/unittype.html:1.28 
stratagus/doc/ccl/unittype.html:1.29
--- stratagus/doc/ccl/unittype.html:1.28        Thu Sep 11 18:07:52 2003
+++ stratagus/doc/ccl/unittype.html     Fri Sep 12 13:44:36 2003
@@ -207,7 +207,7 @@
        this unit-type (here paladin).</dd>
     </dl>
 </dd>
-<dt>pixel_size</dt>
+<dt>pixel-size</dt>
 <dd>Size of the unit-type graphic in pixeln. A list of X (width) and Y (height)
 sizes.  F.E. '( 72 72 ), '( 96 96 ).<p></dd>
 <dt>animations</dt>
@@ -236,7 +236,7 @@
 </ul>
 NOTE: this will be changed to identifiers sometime.
 <p></dd>
-<dt>sight_range</dt>
+<dt>sight-range</dt>
 <dd>Sight range (in tiles) of this unit. F.E. 6, 14.<p></dd>
 <dt>hitpoints</dt>
 <dd>Hitpoints for this Unit. F.E. 90, 1000<p></dd>
@@ -251,7 +251,7 @@
 to build this unit.  Oil is the amount required to build this unit.
 F.E.: '( time 200 gold 2000 wood 1000 oil 200 ).<p>
 </dd>
-<dt>improve_production</dt>
+<dt>improve-production</dt>
 <dd>Define the production increase from defaults that this unit adds. It is an
 array of '(resource-name amount) pairs. Gold is the amount it increase the
 default gold by. All other defined resources are treated the same way. The
@@ -259,15 +259,17 @@
 not stack, but the maximum is what matters.
 F.E.: 'improve-production '( gold 20 wood 5 ) will give 120% gold and 105% 
wood.<p>
 </dd>
-<dt>repair_hp</dt>
+<dt>repair-range</dt>
+<dd>Range that a unit can repair from, eg. repair-range 1.</dd>
+<dt>repair-hp</dt>
 <dd>Defines the amount of hp a unit gain for each repair animation.  Units can 
only be
 repaired if this value is non-zero.
 F.E.: 'repair-hp 4.<p>
 </dd>
-<dt>repair_costs</dt>
+<dt>repair-costs</dt>
 <dd>Define the costs to repair this unit. It is an array of '(
 resource-name amount) pairs.
-Gold is the amount required to repair repair_hp above.
+Gold is the amount required to repair repair-hp above.
 Wood and Oil are the same.
 F.E.: '( gold 2 wood 1 oil 1 ).<p>
 </dd>
@@ -297,7 +299,7 @@
    
     <dt>resource-capacity</dt>
     <dd>Maximum amount of resources a harvester can carry. The actual amount 
can be
-    modified while unloading, with improve_incomes.<p></dd>
+    modified while unloading, with improve-incomes.<p></dd>
     
     <dt>file-when-loaded</dt>
     <dd>The harvester's animation file will change when it's loaded.<p></dd>
@@ -317,22 +319,34 @@
     <dt>terrain-harvester</dt>
     <dd>The unit will harvest terrain. For now this only works for 
wood.<p></dd>
     </dl>
-<dt>tile_size</dt>
+<dt>tile-size</dt>
 <dd>Define the unit-type size in tiles. NOTE: currently only buildings could
 be bigger than one tile. A list of X (width) and Y (height) sizes.
-F.E. '( 1 1 ), '( 2 2 ).<p>
-</dd>
-<dt>permanent_cloak</dt>
+F.E. '( 1 1 ), '( 2 2 ).<p></dd>
+<dt>permanent-cloak</dt>
 <dd>Unit is permanently cloaked, and can only be seen by detectors (see 
below.)<p></dd>
-<dt>detect_cloak</dt>
+<dt>detect-cloak</dt>
 <dd>Unit can detect cloaked units. If an unit is detected other units can 
attack it as well<p></dd>
-<dt>box_size</dt>
+<dt>demolish-range</dt>
+<dd>If non-zero this is the range for units that can demolish.The demolished 
area is a square, sorry.<p></dd>
+<dt>demolish-damage</dt>
+<dd>Damage dealt to unit affected by demolition. This can be 0, in this case
+only terrain will be affected. Units have to be in demolish-range to be 
affected.<p></dd>
+<dt>random-movement-probablitity</dt>
+<dd>When the unit is idle this is the probability that it will take a
+step in a random direction, in percents. Usefull for netural animals.<p></dd>
+<dt>clicks-to-explode</dt>
+<dd>If this is non-zero, then after that many clicks the unit will commit
+suicide. Doesn't work with resource workers/resources. It can even be used
+in combination with demolish-damage and demolish-range, though it wouldn't
+be very fair.<p></dd>
+<dt>box-size</dt>
 <dd></dd>
-<dt>attack_range</dt>
+<dt>attack-range</dt>
 <dd></dd>
-<dt>computer_reaction_range</dt>
+<dt>computer-reaction-range</dt>
 <dd></dd>
-<dt>human_reaction_range</dt>
+<dt>human-reaction-range</dt>
 <dd></dd>
 <dt>armor</dt>
 <dd></dd>
@@ -340,15 +354,15 @@
 <dd></dd>
 <dt>damage</dt>
 <dd></dd>
-<dt>piercing_damge</dt>
+<dt>piercing-damge</dt>
 <dd></dd>
-<dt>weapon_upgradable</dt>
+<dt>weapon-upgradable</dt>
 <dd></dd>
-<dt>armor_upgradeable</dt>
+<dt>armor-upgradeable</dt>
 <dd></dd>
 <dt>decay</dt>
 <dd></dd>
-<dt>annoy_factor</dt>
+<dt>annoy-factor</dt>
 <dd></dd>
 <dt>points</dt>
 <dd></dd>
@@ -358,17 +372,15 @@
 <dd></dd>
 <dt>type</dt>
 <dd></dd>
-<dt>right_mouse</dt>
+<dt>right-mouse</dt>
 <dd></dd>
-<dt>can_target</dt>
+<dt>can-target</dt>
 <dd></dd>
-<dt>repair_range</dt>
-<dd>Range that a unit can repair from, eg. repair_range 1</dd>
 <dt>flags</dt>
 <dd></dd>
 <dt>sounds</dt>
 <dd></dd>
-<dt>attack_sound</dt>
+<dt>attack-sound</dt>
 <dd></dd>
 </dl>
 
@@ -593,7 +605,7 @@
 <h4>Not Used</h4>
 
 <hr>
-Last changed: $Id: unittype.html,v 1.28 2003/09/11 22:07:52 n0body Exp $<br>
+Last changed: $Id: unittype.html,v 1.29 2003/09/12 17:44:36 n0body Exp $<br>
 All trademarks and copyrights on this page are owned by their respective 
owners.
 <address>(c) 2002-2003 by <a href="http://stratagus.org";>
 The Stratagus Project</a></address></body></html>
Index: stratagus/src/action/action_build.c
diff -u stratagus/src/action/action_build.c:1.95 
stratagus/src/action/action_build.c:1.96
--- stratagus/src/action/action_build.c:1.95    Wed Sep 10 18:28:21 2003
+++ stratagus/src/action/action_build.c Fri Sep 12 13:44:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_build.c,v 1.95 2003/09/10 22:28:21 mr-russ Exp $
+//     $Id: action_build.c,v 1.96 2003/09/12 17:44:36 n0body Exp $
 
 //@{
 
@@ -319,6 +319,7 @@
     Unit* worker;
     UnitType* type;
     int n;
+    int progress;
 
     type=unit->Type;
     
@@ -327,12 +328,15 @@
            (type->Stats->Costs[TimeCost]*600)-unit->HP;
     //  This below is most often 0
     if (type->BuilderOutside) {
-       unit->Data.Builded.Progress+=unit->Type->AutoBuildRate;
+       progress=unit->Type->AutoBuildRate;
     } else {
-       unit->Data.Builded.Progress+=100;
+       progress=100;
            // FIXME: implement this below:
            //unit->Data.Builded.Worker->Type->BuilderSpeedFactor;
     }
+    //  Building speeds increase or decrease.
+    progress*=SpeedBuild;
+    unit->Data.Builded.Progress+=progress;
     //  Keep the same level of damage while increasing HP.
     unit->HP=(unit->Data.Builded.Progress*unit->Stats->HitPoints)/
            (type->Stats->Costs[TimeCost]*600)-n;
Index: stratagus/src/action/action_demolish.c
diff -u stratagus/src/action/action_demolish.c:1.34 
stratagus/src/action/action_demolish.c:1.35
--- stratagus/src/action/action_demolish.c:1.34 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_demolish.c      Fri Sep 12 13:44:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_demolish.c,v 1.34 2003/07/11 14:35:29 n0body Exp $
+//     $Id: action_demolish.c,v 1.35 2003/09/12 17:44:36 n0body Exp $
 
 //@{
 
@@ -50,8 +50,8 @@
 --     Functions
 ----------------------------------------------------------------------------*/
 
-/**
-**     Unit Demolishs
+/*
+**     Unit Demolishes
 **
 **     @param unit     Unit, for that the demolish is handled.
 */
@@ -74,8 +74,24 @@
        case 0:                         // first entry.
            NewResetPath(unit);
            unit->SubAction=1;
+           //
+           //  Already at target? FIXME: duplicate code.
+           //
+           if( (goal=unit->Orders[0].Goal) ) {
+               if( MapDistanceToUnit(unit->X,unit->Y,goal)<=1 ) {
+                   unit->State=0;
+                   unit->SubAction=2;
+                   HandleActionDemolish(unit);
+                   return;
+               }
+           } else if( MapDistance(unit->X,unit->Y
+                   ,unit->Orders[0].X,unit->Orders[0].Y)<=1 ) {
+               unit->State=0;
+               unit->SubAction=2;
+               HandleActionDemolish(unit);
+               return;
+           } 
            // FALL THROUGH
-
        case 1:
            // FIXME: reset first!! why? (johns)
            err=DoActionMove(unit);
@@ -142,49 +158,53 @@
                unit->Orders[0].Goal=NoUnitP;
            }
 
-           xmin = unit->X - 2;
-           ymin = unit->Y - 2;
-           xmax = unit->X + 2;
-           ymax = unit->Y + 2;
-           if (xmin<0) xmin=0;
-           if (xmax > TheMap.Width-1) xmax = TheMap.Width-1;
-           if (ymin<0) ymin=0;
-           if (ymax > TheMap.Height-1) ymax = TheMap.Height-1;
-
-           // FIXME: Must play explosion sound
-
-           //  FIXME: Currently we take the X fields, the original only the O
-           //          XXXXX ..O..
-           //          XXXXX .OOO.
-           //          XX.XX OO.OO
-           //          XXXXX .OOO.
-           //          XXXXX ..O..
-           //
+           if (unit->Type->DemolishRange) {
+               xmin = unit->X - unit->Type->DemolishRange;
+               ymin = unit->Y - unit->Type->DemolishRange;
+               xmax = unit->X + unit->Type->DemolishRange;
+               ymax = unit->Y + unit->Type->DemolishRange;
+               if (xmin<0) xmin=0;
+               if (xmax > TheMap.Width-1) xmax = TheMap.Width-1;
+               if (ymin<0) ymin=0;
+               if (ymax > TheMap.Height-1) ymax = TheMap.Height-1;
+
+               // FIXME: Must play explosion sound
+
+               //      FIXME: Currently we take the X fields, the original 
only the O
+               //              XXXXX ..O..
+               //              XXXXX .OOO.
+               //              XX.XX OO.OO
+               //              XXXXX .OOO.
+               //              XXXXX ..O..
+               //
 
-           //
-           //   Effect of the explosion on units.
-           //
-            n=SelectUnits(xmin,ymin, xmax, ymax,table);
-            for( i=0; i<n; ++i ) {
-               if( table[i]->Type->UnitType!=UnitTypeFly && table[i]->HP
-                   && table[i] != unit ) {
-                   // Don't hit flying units!
-                   HitUnit(unit,table[i],DEMOLISH_DAMAGE);
+               //
+               //       Effect of the explosion on units. Don't bother if 
damage is 0
+               //
+               if (unit->Type->DemolishDamage) {
+                   n=SelectUnits(xmin,ymin, xmax, ymax,table);
+                   for( i=0; i<n; ++i ) {
+                       if( table[i]->Type->UnitType!=UnitTypeFly && 
table[i]->HP
+                           && table[i] != unit ) {
+                           // Don't hit flying units!
+                           HitUnit(unit,table[i],unit->Type->DemolishDamage);
+                       }
+                   }
                }
-            }
 
-           //
-           //  Terrain effect of the explosion
-           //
-            for( ix=xmin; ix<=xmax; ix++ ) {
-               for( iy=ymin; iy<=ymax; iy++ ) {
-                   n=TheMap.Fields[ix+iy*TheMap.Width].Flags;
-                   if( n&MapFieldWall ) {
-                       MapRemoveWall(ix,iy);
-                   } else if( n&MapFieldRocks ) {
-                       MapRemoveRock(ix,iy);
-                   } else if( n&MapFieldForest ) {
-                       MapRemoveWood(ix,iy);
+               //
+               //      Terrain effect of the explosion
+               //
+               for( ix=xmin; ix<=xmax; ix++ ) {
+                   for( iy=ymin; iy<=ymax; iy++ ) {
+                       n=TheMap.Fields[ix+iy*TheMap.Width].Flags;
+                       if( n&MapFieldWall ) {
+                           MapRemoveWall(ix,iy);
+                       } else if( n&MapFieldRocks ) {
+                           MapRemoveRock(ix,iy);
+                       } else if( n&MapFieldForest ) {
+                           MapRemoveWood(ix,iy);
+                       }
                    }
                }
            }
Index: stratagus/src/action/action_repair.c
diff -u stratagus/src/action/action_repair.c:1.51 
stratagus/src/action/action_repair.c:1.52
--- stratagus/src/action/action_repair.c:1.51   Wed Sep  3 05:27:51 2003
+++ stratagus/src/action/action_repair.c        Fri Sep 12 13:44:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_repair.c,v 1.51 2003/09/03 09:27:51 mr-russ Exp $
+//     $Id: action_repair.c,v 1.52 2003/09/12 17:44:36 n0body Exp $
 
 //@{
 
@@ -150,7 +150,7 @@
        DebugLevel3("Repair animation is %d cycles long\n" _C_ animlength);
        // FIXME: implement this below:
        //unit->Data.Builded.Worker->Type->BuilderSpeedFactor;
-       goal->Data.Builded.Progress+=100*animlength;
+       goal->Data.Builded.Progress+=100*animlength*SpeedBuild;
        //  Keep the same level of damage while increasing HP.
        goal->HP=(goal->Data.Builded.Progress*goal->Stats->HitPoints)/
                (goal->Type->Stats->Costs[TimeCost]*600)-hp;
Index: stratagus/src/action/action_resource.c
diff -u stratagus/src/action/action_resource.c:1.53 
stratagus/src/action/action_resource.c:1.54
--- stratagus/src/action/action_resource.c:1.53 Thu Sep 11 18:07:53 2003
+++ stratagus/src/action/action_resource.c      Fri Sep 12 13:44:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_resource.c,v 1.53 2003/09/11 22:07:53 n0body Exp $
+//     $Id: action_resource.c,v 1.54 2003/09/12 17:44:36 n0body Exp $
 
 //@{
 
@@ -36,6 +36,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "stratagus.h"
 #include "player.h"
@@ -150,7 +151,7 @@
        DebugCheck(!ForestOnMap(unit->Orders->X,unit->Orders->Y));
        
UnitHeadingFromDeltaXY(unit,unit->Orders->X-unit->X,unit->Orders->Y-unit->Y);
        if (resinfo->WaitAtResource) {
-           unit->Data.ResWorker.TimeToHarvest=resinfo->WaitAtResource;
+           
unit->Data.ResWorker.TimeToHarvest=resinfo->WaitAtResource/SpeedResourcesHarvest[resinfo->ResourceId];
        } else {
            unit->Data.ResWorker.TimeToHarvest=1;
        }
@@ -238,7 +239,7 @@
        unit->Y=goal->Y;
     }
 
-    unit->Data.ResWorker.TimeToHarvest=resinfo->WaitAtResource;
+    
unit->Data.ResWorker.TimeToHarvest=resinfo->WaitAtResource/SpeedResourcesHarvest[resinfo->ResourceId];
 
     unit->Data.ResWorker.DoneHarvesting=0;
 
@@ -306,8 +307,8 @@
        // No wood? Freeze!!!
     }
 
-    if 
(!unit->Data.ResWorker.DoneHarvesting&&unit->Data.ResWorker.TimeToHarvest<0) {
-       unit->Data.ResWorker.TimeToHarvest+=resinfo->WaitAtResource;
+    while 
((!unit->Data.ResWorker.DoneHarvesting)&&unit->Data.ResWorker.TimeToHarvest<0) {
+       
unit->Data.ResWorker.TimeToHarvest+=resinfo->WaitAtResource/SpeedResourcesHarvest[resinfo->ResourceId];
        
        //
        //  Calculate how much we can load.
@@ -605,7 +606,7 @@
        MustRedraw|=RedrawResources;
     }
 
-    unit->Wait=resinfo->WaitAtDepot;
+    unit->Wait=resinfo->WaitAtDepot/SpeedResourcesReturn[resinfo->ResourceId];
 
     return 1;
 }
@@ -709,8 +710,10 @@
 {
     int ret,newres;
 
-    DebugLevel3Fn("%s(%d) SubAction %d\n"
-       _C_ unit->Type->Ident _C_ UnitNumber(unit) _C_ unit->SubAction);
+    DebugLevel3Fn("%s(%d) SubAction %d TTH %d res %s goal %ul\n"
+       _C_ unit->Type->Ident _C_ UnitNumber(unit) _C_ unit->SubAction
+       _C_ unit->Data.ResWorker.TimeToHarvest _C_ 
DefaultResourceNames[unit->CurrentResource]
+       _C_ (unsigned int)unit->Orders->Goal);
     
     // Let's start mining.
     if ( unit->SubAction==SUB_START_RESOURCE ) {
@@ -804,6 +807,15 @@
     if (unit->SubAction==SUB_RETURN_RESOURCE) {
        if( WaitInDepot(unit) ) {
            unit->SubAction=SUB_START_RESOURCE;
+           //
+           //  It's posible, though very rare that the unit's goal blows up
+           //  this cycle, but after this unit. Thus, next frame the unit
+           //  will start mining a destroyed site. If, on the otherhand we
+           //  are already in SUB_MOVE_TO_RESOURCE then we can handle it.
+           //  So, we pass through SUB_START_RESOURCE the very instant it
+           //  goes out of the depot.
+           //
+           HandleActionResource(unit);
        }
        return;
     }
Index: stratagus/src/action/action_still.c
diff -u stratagus/src/action/action_still.c:1.68 
stratagus/src/action/action_still.c:1.69
--- stratagus/src/action/action_still.c:1.68    Thu Sep 11 06:49:09 2003
+++ stratagus/src/action/action_still.c Fri Sep 12 13:44:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_still.c,v 1.68 2003/09/11 10:49:09 n0body Exp $
+//     $Id: action_still.c,v 1.69 2003/09/12 17:44:36 n0body Exp $
 
 //@{
 
@@ -109,9 +109,10 @@
     }
 
     //
-    // Critters:       are moving random around.
+    // Some units, like critter are moving random around randomly
     //
-    if( type->Critter && type==UnitTypeCritter) {
+    if( type->RandomMovementProbability &&
+           ((SyncRand()%100)<=type->RandomMovementProbability)) {
        int x;
        int y;
 
Index: stratagus/src/action/command.c
diff -u stratagus/src/action/command.c:1.103 
stratagus/src/action/command.c:1.104
--- stratagus/src/action/command.c:1.103        Fri Sep  5 14:10:55 2003
+++ stratagus/src/action/command.c      Fri Sep 12 13:44:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: command.c,v 1.103 2003/09/05 18:10:55 n0body Exp $
+//     $Id: command.c,v 1.104 2003/09/12 17:44:36 n0body Exp $
 
 //@{
 
@@ -400,12 +400,12 @@
 {
     Order* order;
 
-    IfDebug(
+#if DEBUG
        if( x<0 || y<0 || x>=TheMap.Width || y>=TheMap.Height ) {
            DebugLevel0Fn("Internal movement error\n");
            return;
        }
-    );
+#endif
 
     //
     // Check if unit is still valid? (NETWORK!)
Index: stratagus/src/clone/selection.c
diff -u stratagus/src/clone/selection.c:1.48 
stratagus/src/clone/selection.c:1.49
--- stratagus/src/clone/selection.c:1.48        Sun Aug 17 11:57:06 2003
+++ stratagus/src/clone/selection.c     Fri Sep 12 13:44:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: selection.c,v 1.48 2003/08/17 15:57:06 n0body Exp $
+//     $Id: selection.c,v 1.49 2003/09/12 17:44:36 n0body Exp $
 
 //@{
 
@@ -85,12 +85,13 @@
 }
 
 /**
-**     Handle a critter being clicked.
+**     Handle a an suicide unit click
 **
-**     @param unit     Critter unit.
+**     @param unit     suicide unit.
 */
-local void HandleCritterClick(Unit* unit)
+local void HandleSuicideClick(Unit* unit)
 {
+    DebugCheck(!unit->Type->ClicksToExplode);
     if( GameObserve ) {
        return;
     }
@@ -102,8 +103,8 @@
     }
 
     // FIXME: make this configurable
-    if( unit->Value==10 ) {
-       SendCommandAttack(unit,unit->X,unit->Y,unit,FlushCommands);
+    if( unit->Value==unit->Type->ClicksToExplode ) {
+       SendCommandDemolish(unit,unit->X,unit->Y,0,FlushCommands);
        unit->Value=0;
     }
 }
@@ -122,8 +123,8 @@
 
     DebugCheck( count>MaxSelectable );
 
-    if( count==1 && units[0]->Type->Critter ) {
-       HandleCritterClick(units[0]);
+    if( count==1 && units[0]->Type->ClicksToExplode ) {
+       HandleSuicideClick(units[0]);
     }
 
     UnSelectAll();
@@ -280,8 +281,8 @@
        return 0;
     }
 
-    if( base->Type->Critter ) {
-       HandleCritterClick(base);
+    if( base->Type->ClicksToExplode ) {
+       HandleSuicideClick(base);
     }
 
     UnSelectAll();
@@ -677,8 +678,7 @@
        if( type->Building && !UnitVisibleOnMap(unit) ) {
            continue;
        }
-       if( type->Critter || 
-               (type->GivesResource && !unit->Removed) ) { // no built 
resources.
+       if( (type->GivesResource && !unit->Removed) ) { // no built resources.
            SelectSingleUnit(unit);
            return 1;
        }
@@ -975,7 +975,7 @@
     char *ref;
 
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: selection $Id: selection.c,v 1.48 2003/08/17 
15:57:06 n0body Exp $\n\n");
+    CLprintf(file,";;; MODULE: selection $Id: selection.c,v 1.49 2003/09/12 
17:44:36 n0body Exp $\n\n");
 
     CLprintf(file,"(set-group-id! %d)\n",GroupId);
     CLprintf(file,"(selection %d '(",NumSelected);
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.105 
stratagus/src/include/unittype.h:1.106
--- stratagus/src/include/unittype.h:1.105      Thu Sep 11 06:49:10 2003
+++ stratagus/src/include/unittype.h    Fri Sep 12 13:44:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.h,v 1.105 2003/09/11 10:49:10 n0body Exp $
+//     $Id: unittype.h,v 1.106 2003/09/12 17:44:36 n0body Exp $
 
 #ifndef __UNITTYPE_H__
 #define __UNITTYPE_H__
@@ -253,7 +253,18 @@
 **
 **     UnitType::Points
 **
-**             How many points you get for unit
+**             How many points you get for unit. Used in the final score table.
+**
+**     UnitType::DemolishRange
+**
+**             If non-zero This is the range for units that can demolish.
+**             The demolished area is a square, sorry.
+**
+**     UnitType::DemolishDamage
+**
+**             Damage dealt to unit affected by demolition. This can be 0,
+**             in this case only terrain will be affected. Units have to be in
+**             DemolishRange to be affected.
 **
 **     UnitType::CanTarget
 **
@@ -286,6 +297,16 @@
 **             Unit is marked as critter. The effect of this is that when
 **             idle the unit will move around randomly.
 **
+**     UnitType::RandomMovementProbability
+**
+**             When the unit is idle this is the probability that it will
+**             take a step in a random direction, in percents.
+**
+**     UnitType::ClickToExplode
+**
+**             If this is non-zero, then after that many clicks the unit will
+**             commit suicide. Doesn't work with resource workers/resources.
+**
 **     UnitType::Wall
 **
 **             This Unit is a wall, and should exihibit joining properties
@@ -724,6 +745,8 @@
     unsigned SeaUnit : 1;              /// Sea animated
     unsigned ExplodeWhenKilled : 1;    /// Death explosion animated
     unsigned Critter : 1;              /// Unit is controlled by nobody
+    unsigned int RandomMovementProbability;/// Probability to move randomly.
+    unsigned int ClicksToExplode;      /// Number of consecutive clicks until 
unit suicides.
     unsigned Wall : 1;                 /// Wall
     unsigned Building : 1;             /// Building
     unsigned PermanentCloak : 1;       /// Is only visible by CloakDetectors.
@@ -737,6 +760,8 @@
     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 int DemolishRange;                /// Unit will Demolish around 
when dead.
+    unsigned int DemolishDamage;       /// Damage dealt to unit affected by 
demolition.
     unsigned int RepairRange;          /// Units repair range.
     unsigned BuilderOutside : 1;       /// The builder stays outside during 
the build.
     unsigned BuilderLost : 1;          /// The builder is lost after the build.
Index: stratagus/src/include/video.h
diff -u stratagus/src/include/video.h:1.90 stratagus/src/include/video.h:1.91
--- stratagus/src/include/video.h:1.90  Fri Jul 11 10:35:30 2003
+++ stratagus/src/include/video.h       Fri Sep 12 13:44:37 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: video.h,v 1.90 2003/07/11 14:35:30 n0body Exp $
+//     $Id: video.h,v 1.91 2003/09/12 17:44:37 n0body Exp $
 
 #ifndef __VIDEO_H__
 #define __VIDEO_H__
@@ -141,7 +141,7 @@
     ColorGreen = 250,
     ColorYellow = 251,
     ColorBlinkRed = 252,
-    ColorViolett = 253,
+    ColorViolet = 253,
 };
 
 extern int ColorWaterCycleStart;       /// color # start for color cycling
Index: stratagus/src/map/map_draw.c
diff -u stratagus/src/map/map_draw.c:1.47 stratagus/src/map/map_draw.c:1.48
--- stratagus/src/map/map_draw.c:1.47   Thu Sep 11 18:07:53 2003
+++ stratagus/src/map/map_draw.c        Fri Sep 12 13:44:37 2003
@@ -29,7 +29,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: map_draw.c,v 1.47 2003/09/11 22:07:53 n0body Exp $
+//     $Id: map_draw.c,v 1.48 2003/09/12 17:44:37 n0body Exp $
 
 //@{
 
@@ -89,7 +89,7 @@
 
 #define noUSE_TILECACHE                        /// defined use tile cache
 #define USE_SMART_TILECACHE            /// defined use a smart tile cache
-#define noGRID         1               /// Map is shown with a grid, if 1
+#define GRID           1               /// Map is shown with a grid, if 1
 
 
 #ifdef DEBUG
Index: stratagus/src/map/minimap.c
diff -u stratagus/src/map/minimap.c:1.62 stratagus/src/map/minimap.c:1.63
--- stratagus/src/map/minimap.c:1.62    Thu Sep 11 18:07:53 2003
+++ stratagus/src/map/minimap.c Fri Sep 12 13:44:37 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: minimap.c,v 1.62 2003/09/11 22:07:53 n0body Exp $
+//     $Id: minimap.c,v 1.63 2003/09/12 17:44:37 n0body Exp $
 
 //@{
 
@@ -298,8 +298,11 @@
 
        if( !BuildingVisibleOnMap(*table) && (*table)->SeenState!=3
                && !(*table)->SeenDestroyed && (type=(*table)->SeenType) ) {
+           //
+           //  FIXME: We should force unittypes to have a certain color on the 
minimap.
+           //
            if( (*table)->Player->Player==PlayerNumNeutral ) {
-               if( type->Critter ) {
+               if( type->ClicksToExplode ) {
                    color=ColorNPC;
                } else if( type->GivesResource==OilCost ) {
                    color=ColorBlack;
@@ -352,8 +355,11 @@
        // FIXME: submarine not visible
 
        type=unit->Type;
+       //
+       //  FIXME: We should force unittypes to have a certain color on the 
minimap.
+       //
        if( unit->Player->Player==PlayerNumNeutral ) {
-           if( type->Critter ) {
+           if( type->ClicksToExplode ) {
                color=ColorNPC;
            } else if( type->GivesResource==OilCost ) {
                color=ColorBlack;
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.82 
stratagus/src/unit/ccl_unittype.c:1.83
--- stratagus/src/unit/ccl_unittype.c:1.82      Thu Sep 11 06:49:12 2003
+++ stratagus/src/unit/ccl_unittype.c   Fri Sep 12 13:44:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unittype.c,v 1.82 2003/09/11 10:49:12 n0body Exp $
+//     $Id: ccl_unittype.c,v 1.83 2003/09/12 17:44:38 n0body Exp $
 
 //@{
 
@@ -376,6 +376,12 @@
            type->GroundAttack=1;
        } else if( gh_eq_p(value,gh_symbol2scm("can-attack")) ) {
            type->CanAttack=1;
+       } else if( gh_eq_p(value,gh_symbol2scm("demolish-range"))){
+           type->DemolishRange=gh_scm2int(gh_car(list));
+           list=gh_cdr(list);
+       } else if( gh_eq_p(value,gh_symbol2scm("demolish-damage"))){
+           type->DemolishDamage=gh_scm2int(gh_car(list));
+           list=gh_cdr(list);
        } else if( gh_eq_p(value,gh_symbol2scm("repair-range")) ) {
            type->RepairRange=gh_scm2int(gh_car(list));
            list=gh_cdr(list);
@@ -419,6 +425,12 @@
            type->SeaUnit=1;
        } else if( gh_eq_p(value,gh_symbol2scm("critter")) ) {
            type->Critter=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")) ) {
@@ -427,8 +439,6 @@
            type->Transporter=1;
        } else if( gh_eq_p(value,gh_symbol2scm("coward")) ) {
            type->Coward=1;
-       } else if( gh_eq_p(value,gh_symbol2scm("harvester")) ) {
-           type->Harvester=1;
        } else if( gh_eq_p(value,gh_symbol2scm("can-gather-resource")) ) {
            sublist=gh_car(list);
            list=gh_cdr(list);
@@ -474,6 +484,7 @@
                   DebugCheck( 1 );
                }
            }
+           type->Harvester=1;
            if (!res->FinalResource) {
                res->FinalResource=res->ResourceId;
            }
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.95 stratagus/src/unit/unittype.c:1.96
--- stratagus/src/unit/unittype.c:1.95  Thu Sep 11 06:49:13 2003
+++ stratagus/src/unit/unittype.c       Fri Sep 12 13:44:38 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.c,v 1.95 2003/09/11 10:49:13 n0body Exp $
+//     $Id: unittype.c,v 1.96 2003/09/12 17:44:38 n0body Exp $
 
 //@{
 
@@ -843,6 +843,12 @@
     if( type->RepairRange ) {
        CLprintf(file,"  'repair-range %d\n",type->RepairRange);
     }
+    if( type->DemolishRange ) {
+       CLprintf(file,"  'demolish-range %d\n",type->DemolishRange);
+    }
+    if( type->DemolishRange ) {
+       CLprintf(file,"  'demolish-damage %d\n",type->DemolishDamage);
+    }
     if( type->CanTarget ) {
        CLprintf(file,"  ");
        if( type->CanTarget&CanTargetLand ) {
@@ -888,6 +894,12 @@
     if( type->Critter ) {
        CLprintf(file,"  'critter\n");
     }
+    if( type->RandomMovementProbability ) {
+       CLprintf(file,"  'random-movement-probability 
%d\n",type->RandomMovementProbability);
+    }
+    if( type->ClicksToExplode ) {
+       CLprintf(file,"  'clicks-to-explode %d\n",type->ClicksToExplode);
+    }
     if( type->Revealer ) {
        CLprintf(file,"  'revealer\n");
     }
@@ -909,7 +921,6 @@
     }
     
     if( type->Harvester ) {
-       CLprintf(file,"  'harvester\n");
        for (i=0;i<MaxCosts;i++) {
            if (type->ResInfo[i]) {
                res=type->ResInfo[i];
@@ -1085,7 +1096,7 @@
     char **sp;
 
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.95 2003/09/11 
10:49:13 n0body Exp $\n\n");
+    CLprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.96 2003/09/12 
17:44:38 n0body Exp $\n\n");
 
     // Original number to internal unit-type name.
 




reply via email to

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