stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus ./Makefile data/ccl/units.ccl data/cc...


From: Russell Smith
Subject: [Stratagus-CVS] stratagus ./Makefile data/ccl/units.ccl data/cc...
Date: Wed, 03 Sep 2003 05:27:55 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Russell Smith <address@hidden>  03/09/03 05:27:53

Modified files:
        .              : Makefile 
        data/ccl       : units.ccl 
        data/ccl/human : units.ccl 
        data/ccl/orc   : units.ccl 
        doc            : ChangeLog.html 
        doc/ccl        : unittype.html 
        src/action     : action_attack.c action_repair.c 
        src/include    : player.h unittype.h 
        src/pathfinder : astar.c 
        src/ui         : mouse.c 
        src/unit       : ccl_unittype.c unittype.c 

Log message:
        Pathfinder fixes for moving goals.
        Added repair flexibility. repair-hp, and repair-costs.
        Began Walls off map Allowance.

Patches:
Index: stratagus/Makefile
diff -u stratagus/Makefile:1.178 stratagus/Makefile:1.179
--- stratagus/Makefile:1.178    Thu Jul  3 13:48:47 2003
+++ stratagus/Makefile  Wed Sep  3 05:27:49 2003
@@ -21,7 +21,7 @@
 ##     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ##     GNU General Public License for more details.
 ##
-##     $Id: Makefile,v 1.178 2003/07/03 17:48:47 ingo Exp $
+##     $Id: Makefile,v 1.179 2003/09/03 09:27:49 mr-russ Exp $
 ##
 
 TOPDIR=        .
@@ -371,9 +371,9 @@
        $(MAKE) distclean
        $(MAKE) depend
        $(MAKE) bin-dist
-       $(MAKE) win32new
-       $(MAKE) win32-bin-dist
-       $(MAKE) win32distclean
+#      $(MAKE) win32new
+#      $(MAKE) win32-bin-dist
+#      $(MAKE) win32distclean
        $(MAKE) dist
 
 ##############################################################################
Index: stratagus/data/ccl/human/units.ccl
diff -u stratagus/data/ccl/human/units.ccl:1.30 
stratagus/data/ccl/human/units.ccl:1.31
--- stratagus/data/ccl/human/units.ccl:1.30     Mon Sep  1 08:32:15 2003
+++ stratagus/data/ccl/human/units.ccl  Wed Sep  3 05:27:50 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.30 2003/09/01 12:32:15 mr-russ Exp $
+;;     $Id: units.ccl,v 1.31 2003/09/03 09:27:50 mr-russ Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -567,6 +567,8 @@
   'size '(72 72)
   'animations 'animations-human-transport 'icon 'icon-alliance-transport
   'costs '(time 70 gold 600 wood 200 oil 500)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'speed 10
   'hit-points 150
   'draw-level 40
@@ -893,6 +895,8 @@
   'size '(64 64)
   'animations 'animations-building 'icon 'icon-farm
   'costs '(time 100 gold 500 wood 250)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 400
@@ -921,6 +925,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-alliance-barracks
   'costs '(time 200 gold 700 wood 450)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 800
@@ -948,6 +954,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-church
   'costs '(time 175 gold 900 wood 500)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 700
@@ -975,6 +983,8 @@
   'size '(64 64)
   'animations 'animations-building 'icon 'icon-alliance-watch-tower
   'costs '(time 60 gold 550 wood 200)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 100
@@ -1004,6 +1014,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-stables
   'costs '(time 150 gold 1000 wood 300)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 500
@@ -1031,6 +1043,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-gnomish-inventor
   'costs '(time 150 gold 1000 wood 400)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 500
@@ -1058,6 +1072,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-gryphon-aviary
   'costs '(time 150 gold 1000 wood 400)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 500
@@ -1085,6 +1101,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-alliance-shipyard
   'costs '(time 200 gold 800 wood 450)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-alliance-shipyard
   'speed 0
   'hit-points 1100
@@ -1115,6 +1133,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-elven-lumber-mill
   'costs '(time 150 gold 600 wood 450)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'improve-production '(wood 25)
   'construction 'construction-land
   'speed 0
@@ -1144,6 +1164,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-alliance-foundry
   'costs '(time 175 gold 700 wood 400 oil 400)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'construction 'construction-alliance-foundry
   'speed 0
   'hit-points 750
@@ -1172,6 +1194,8 @@
   'size '(128 128)
   'animations 'animations-building 'icon 'icon-town-hall
   'costs '(time 255 gold 1200 wood 800)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 1200
@@ -1201,6 +1225,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-mage-tower
   'costs '(time 125 gold 1000 wood 200)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 500
@@ -1228,6 +1254,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-alliance-blacksmith
   'costs '(time 200 gold 800 wood 450 oil 100)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'construction 'construction-land
   'speed 0
   'hit-points 775
@@ -1255,6 +1283,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-alliance-refinery
   'costs '(time 225 gold 800 wood 350 oil 200)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'improve-production '(oil 25)
   'construction 'construction-alliance-refinery
   'speed 0
@@ -1315,6 +1345,8 @@
   'size '(128 128)
   'animations 'animations-building 'icon 'icon-keep
   'costs '(time 200 gold 2000 wood 1000 oil 200)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'improve-production '(gold 10)
   'construction 'construction-land
   'speed 0
@@ -1345,6 +1377,8 @@
   'size '(128 128)
   'animations 'animations-building 'icon 'icon-castle
   'costs '(time 200 gold 2500 wood 1200 oil 500)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'improve-production '(gold 20)
   'construction 'construction-land
   'speed 0
@@ -1396,6 +1430,8 @@
   'size '(64 64)
   'animations 'animations-human-guard-tower 'icon 'icon-alliance-guard-tower
   'costs '(time 140 gold 500 wood 150)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 130
@@ -1428,6 +1464,8 @@
   'size '(64 64)
   'animations 'animations-human-cannon-tower 'icon 'icon-alliance-cannon-tower
   'costs '(time 190 gold 1000 wood 300)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 160
Index: stratagus/data/ccl/orc/units.ccl
diff -u stratagus/data/ccl/orc/units.ccl:1.34 
stratagus/data/ccl/orc/units.ccl:1.35
--- stratagus/data/ccl/orc/units.ccl:1.34       Mon Sep  1 08:32:16 2003
+++ stratagus/data/ccl/orc/units.ccl    Wed Sep  3 05:27:50 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.34 2003/09/01 12:32:16 mr-russ Exp $
+;;     $Id: units.ccl,v 1.35 2003/09/03 09:27:50 mr-russ Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -567,6 +567,8 @@
   'size '(72 72)
   'animations 'animations-human-transport 'icon 'icon-mythical-transport
   'costs '(time 70 gold 600 wood 200 oil 500)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'speed 10
   'hit-points 150
   'draw-level 40
@@ -981,6 +983,8 @@
   'size '(64 64)
   'animations 'animations-building 'icon 'icon-pig-farm
   'costs '(time 100 gold 500 wood 250)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 400
@@ -1009,6 +1013,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-mythical-barracks
   'costs '(time 200 gold 700 wood 450)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 800
@@ -1036,6 +1042,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-altar-of-storms
   'costs '(time 175 gold 900 wood 500)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 700
@@ -1063,6 +1071,8 @@
   'size '(64 64)
   'animations 'animations-building 'icon 'icon-mythical-watch-tower
   'costs '(time 60 gold 550 wood 200)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 100
@@ -1092,6 +1102,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-ogre-mound
   'costs '(time 150 gold 1000 wood 300)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 500
@@ -1119,6 +1131,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-alchemist
   'costs '(time 150 gold 1000 wood 400)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 500
@@ -1146,6 +1160,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-dragon-roost
   'costs '(time 150 gold 1000 wood 400)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 500
@@ -1173,6 +1189,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-mythical-shipyard
   'costs '(time 200 gold 800 wood 450)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-mythical-shipyard
   'speed 0
   'hit-points 1100
@@ -1202,6 +1220,8 @@
   'size '(128 128)
   'animations 'animations-building 'icon 'icon-great-hall
   'costs '(time 255 gold 1200 wood 800)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 1200
@@ -1232,6 +1252,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-troll-lumber-mill
   'costs '(time 150 gold 600 wood 450)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'improve-production '(wood 25)
   'construction 'construction-land
   'speed 0
@@ -1261,6 +1283,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-mythical-foundry
   'costs '(time 175 gold 700 wood 400 oil 400)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'construction 'construction-mythical-foundry
   'speed 0
   'hit-points 750
@@ -1289,6 +1313,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-temple-of-the-damned
   'costs '(time 125 gold 1000 wood 200)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 500
@@ -1316,6 +1342,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-mythical-blacksmith
   'costs '(time 200 gold 800 wood 450 oil 100)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'construction 'construction-land
   'speed 0
   'hit-points 775
@@ -1343,6 +1371,8 @@
   'size '(96 96)
   'animations 'animations-building 'icon 'icon-mythical-refinery
   'costs '(time 225 gold 800 wood 350 oil 200)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'improve-production '(oil 25)
   'construction 'construction-mythical-refinery
   'speed 0
@@ -1403,6 +1433,8 @@
   'size '(128 128)
   'animations 'animations-building 'icon 'icon-stronghold
   'costs '(time 200 gold 2000 wood 1000 oil 200)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'improve-production '(gold 10)
   'construction 'construction-land
   'speed 0
@@ -1433,6 +1465,8 @@
   'size '(128 128)
   'animations 'animations-building 'icon 'icon-fortress
   'costs '(time 200 gold 2500 wood 1200 oil 500)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'improve-production '(gold 20)
   'construction 'construction-land
   'speed 0
@@ -1484,6 +1518,8 @@
   'size '(64 64)
   'animations 'animations-human-guard-tower 'icon 'icon-mythical-guard-tower
   'costs '(time 140 gold 500 wood 150)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 130
@@ -1516,6 +1552,8 @@
   'size '(64 64)
   'animations 'animations-human-cannon-tower 'icon 'icon-mythical-cannon-tower
   'costs '(time 190 gold 1000 wood 300)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land
   'speed 0
   'hit-points 160
Index: stratagus/data/ccl/units.ccl
diff -u stratagus/data/ccl/units.ccl:1.43 stratagus/data/ccl/units.ccl:1.44
--- stratagus/data/ccl/units.ccl:1.43   Mon Aug 25 07:21:14 2003
+++ stratagus/data/ccl/units.ccl        Wed Sep  3 05:27:50 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.43 2003/08/25 11:21:14 mr-russ Exp $
+;;     $Id: units.ccl,v 1.44 2003/09/03 09:27:50 mr-russ Exp $
 
 ;; Load the animations for the units.
 (ccl:load "ccl/anim.ccl")
@@ -261,6 +261,8 @@
   'size '(128 128)
   'animations 'animations-building 'icon 'icon-dark-portal
   'costs '(time 100 gold 3000 wood 3000 oil 1000)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1 oil 1)
   'construction 'construction-land2
   'speed 0
   'hit-points 5000
@@ -290,6 +292,8 @@
   'size '(64 64)
   'animations 'animations-building 'icon 'icon-runestone
   'costs '(time 175 gold 900 wood 500)
+  'repair-hp 4
+  'repair-costs '(gold 1 wood 1)
   'construction 'construction-land2
   'speed 0
   'hit-points 5000
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.519 stratagus/doc/ChangeLog.html:1.520
--- stratagus/doc/ChangeLog.html:1.519  Mon Sep  1 08:32:16 2003
+++ stratagus/doc/ChangeLog.html        Wed Sep  3 05:27:50 2003
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-----   $Id: ChangeLog.html,v 1.519 2003/09/01 12:32:16 mr-russ Exp $
+----   $Id: ChangeLog.html,v 1.520 2003/09/03 09:27:50 mr-russ Exp $
 
 ----   (c) Copyright 1998-2003 by Lutz Sammer
 
@@ -36,6 +36,8 @@
 <li>Future 1.19 Release<p>
     <ul>
     <li>++
+    <li>Pathfinder fixes for when the goal moves (EXPERIMENTAL) (from Russell 
Smith).
+    <li>Added repair-costs and repair-hp for units that can be repaired (from 
Russell Smith).
     <li>Changed can-repair to repair-range, allows flexible repair distances 
(from Russell Smith).
     <li>Added Income improvements to ccl, removed hard coded versions (from 
Russell Smith).
     <li>Fixed Pathfinder cost bug, which stopped units from moving (from 
Russell Smith).
Index: stratagus/doc/ccl/unittype.html
diff -u stratagus/doc/ccl/unittype.html:1.23 
stratagus/doc/ccl/unittype.html:1.24
--- stratagus/doc/ccl/unittype.html:1.23        Tue Sep  2 15:23:08 2003
+++ stratagus/doc/ccl/unittype.html     Wed Sep  3 05:27:51 2003
@@ -255,14 +255,26 @@
 </dd>
 <dt>improve_production</dt>
 <dd>Define the production increase from defaults that this unit adds. It is an 
array of '(
-rosource-name amount) pairs. 
+resource-name amount) pairs.
 Gold is the amount it increase the default gold by. All other defined 
resources are
 treated the same way.
 F.E.: 'improve-production '( gold 20 wood 5 ).<p>
 </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>
+<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.
+Wood and Oil are the same.
+F.E.: '( gold 2 wood 1 oil 1 ).<p>
+</dd>
 <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. 
+be bigger than one tile. A list of X (width) and Y (height) sizes.
 F.E. '( 1 1 ), '( 2 2 ).
 </dd>
 <dt>box_size</dt>
@@ -557,7 +569,7 @@
 <h4>Not Used</h4>
 
 <hr>
-Last changed: $Id: unittype.html,v 1.23 2003/09/02 19:23:08 martinxyz Exp $<br>
+Last changed: $Id: unittype.html,v 1.24 2003/09/03 09:27:51 mr-russ 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_attack.c
diff -u stratagus/src/action/action_attack.c:1.80 
stratagus/src/action/action_attack.c:1.81
--- stratagus/src/action/action_attack.c:1.80   Thu Aug 28 08:20:04 2003
+++ stratagus/src/action/action_attack.c        Wed Sep  3 05:27:51 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_attack.c,v 1.80 2003/08/28 12:20:04 mr-russ Exp $
+//     $Id: action_attack.c,v 1.81 2003/09/03 09:27:51 mr-russ Exp $
 
 //@{
 
@@ -575,9 +575,10 @@
            //
            DebugCheck( unit->State!=0 );
            //
-           //  Look for target, if already in range.
+           //  Look for target, if already in range. Attack if So
            //
            if( CheckForTargetInRange(unit) ) {
+               unit->SubAction=ATTACK_TARGET;
                return;
            }
 
Index: stratagus/src/action/action_repair.c
diff -u stratagus/src/action/action_repair.c:1.50 
stratagus/src/action/action_repair.c:1.51
--- stratagus/src/action/action_repair.c:1.50   Mon Sep  1 08:32:17 2003
+++ stratagus/src/action/action_repair.c        Wed Sep  3 05:27:51 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: action_repair.c,v 1.50 2003/09/01 12:32:17 mr-russ Exp $
+//     $Id: action_repair.c,v 1.51 2003/09/03 09:27:51 mr-russ Exp $
 
 //@{
 
@@ -82,22 +82,16 @@
 local void RepairUnit(Unit* unit, Unit* goal)
 {
     Player* player;
-    int costs[MaxCosts];
     int i;
     int animlength;
     Animation* anim;
     int hp;
-    int lrr;
     char buf[100];
 
-#define GIVES_HP       4
-#define COSTS          1
-
     //
     //  Calculate the repair points
     //          original per 100 hit points only 25 gold 25 wood
     //
-    hp = GIVES_HP;
 
     player = unit->Player;
 
@@ -107,37 +101,12 @@
        //
        DebugCheck(!goal->Stats->HitPoints);
 
-       for (i = 1; i < MaxCosts; ++i) {
-           if (goal->Stats->Costs[i]) {
-               costs[i] = COSTS;
-           } else {                    // Prepare for repair cycles
-               costs[i] = 0;
-           }
-       }
-       lrr = player->LastRepairResource;
-       for (i = player->LastRepairResource; i < MaxCosts; ++i) {
-           if (costs[i] && lrr == player->LastRepairResource) {
-               lrr = i;
-           }                           // Find next higher resource or...
-       }
-       if (lrr == player->LastRepairResource) {
-           for (i = player->LastRepairResource; i > 0; --i) {
-               if (costs[i]) {
-                   lrr = i;
-               }
-           }                           // ...go through the beginning
-       }
-       player->LastRepairResource = lrr;
-       // Thanx for the help, costs, you are reset!
-       for (i = 1; i < MaxCosts; ++i) {
-           costs[i] = 0;
-       }
-       costs[player->LastRepairResource] = COSTS;      // The one we need
+
        //
        //  Check if enough resources are available
        //
        for (i = 1; i < MaxCosts; ++i) {
-           if (player->Resources[i] < costs[i]) {
+           if (player->Resources[i] < goal->Type->_RepairCosts[i]) {
                snprintf(buf,100,"We need more %s for 
repair!",DefaultResourceNames[i]);
                NotifyPlayer(player, NotifyYellow, unit->X, unit->Y,buf);
                if( player->Ai ) {
@@ -160,9 +129,9 @@
        //
        //  Subtract the resources
        //
-       PlayerSubCosts(player, costs);
+       PlayerSubCosts(player, goal->Type->_RepairCosts);
     }
-    
+
     //
     //  Repair the unit
     //
@@ -177,7 +146,7 @@
        for 
(anim=unit->Type->Animations->Attack;!(anim->Flags&AnimationReset);anim++) {
            animlength+=anim->Sleep;
        }
-       
+
        DebugLevel3("Repair animation is %d cycles long\n" _C_ animlength);
        // FIXME: implement this below:
        //unit->Data.Builded.Worker->Type->BuilderSpeedFactor;
@@ -190,7 +159,7 @@
        }
        //  HandleActionBuilded will deal with most stuff.
     } else {
-       goal->HP += hp;
+       goal->HP += goal->Type->RepairHP;
        if (goal->HP > goal->Stats->HitPoints) {
            goal->HP = goal->Stats->HitPoints;
        }
Index: stratagus/src/include/player.h
diff -u stratagus/src/include/player.h:1.72 stratagus/src/include/player.h:1.73
--- stratagus/src/include/player.h:1.72 Sun Aug 17 11:57:07 2003
+++ stratagus/src/include/player.h      Wed Sep  3 05:27:51 2003
@@ -1,4 +1,4 @@
-//       _________ __                 __                               
+//       _________ __                 __
 //      /   _____//  |_____________ _/  |______     ____  __ __  ______
 //      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
 //      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ |
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: player.h,v 1.72 2003/08/17 15:57:07 n0body Exp $
+//     $Id: player.h,v 1.73 2003/09/03 09:27:51 mr-russ Exp $
 
 #ifndef __PLAYER_H__
 #define __PLAYER_H__
@@ -215,11 +215,6 @@
 **             this.
 **             @note that all limits are always checked.
 **
-**     Player::LastRepairResource
-**
-**             Last resource used for repair cycles. Was introduced to
-**             reduce the repair speed.  @see RepairUnit.
-**
 **     Player::Score
 **
 **             Total number of points. You can get points for killing units,
@@ -342,7 +337,6 @@
     int                FoodUnitLimit;          /// # food units allowed
     int                BuildingLimit;          /// # buildings allowed
     int                TotalUnitLimit;         /// # total unit number allowed
-    int                LastRepairResource;     /// last resource for repair 
cycles
 
     int                Score;                  /// Points for killing ...
     int                TotalUnits;
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.101 
stratagus/src/include/unittype.h:1.102
--- stratagus/src/include/unittype.h:1.101      Mon Sep  1 08:32:17 2003
+++ stratagus/src/include/unittype.h    Wed Sep  3 05:27:51 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.h,v 1.101 2003/09/01 12:32:17 mr-russ Exp $
+//     $Id: unittype.h,v 1.102 2003/09/03 09:27:51 mr-russ Exp $
 
 #ifndef __UNITTYPE_H__
 #define __UNITTYPE_H__
@@ -161,6 +161,15 @@
 **
 **             How many resources needed
 **
+**     UnitType::RepairHP
+**
+**             The HP given to a unit each cycle it's repaired.
+**             If zero, unit cannot be repaired
+**
+**     UnitType::_RepairCosts[::MaxCosts]
+**
+**             Costs per repair cycle to fix a unit.
+**
 **     UnitType::TileWidth
 **
 **             Tile size on map width
@@ -277,6 +286,10 @@
 **             Unit is marked as critter. The effect of this is that when
 **             idle the unit will move around randomly.
 **
+**     UnitType::Wall
+**
+**             This Unit is a wall, and should exihibit joining properties
+**
 **     UnitType::Building
 **
 **             Unit is a Building
@@ -611,6 +624,8 @@
     int                Magic;                  /// Unit can cast spells
 
     int                _Costs[MaxCosts];       /// How many resources needed
+    int                RepairHP;               /// Amount of HP per repair
+    int                _RepairCosts[MaxCosts]; /// How much it costs to repair
 
     int                TileWidth;              /// Tile size on map width
     int                TileHeight;             /// Tile size on map height
@@ -655,6 +670,7 @@
     unsigned SeaUnit : 1;              /// Sea animated
     unsigned ExplodeWhenKilled : 1;    /// Death explosion animated
     unsigned Critter : 1;              /// Unit is controlled by nobody
+    unsigned Wall : 1;                 /// Wall
     unsigned Building : 1;             /// Building
     unsigned Submarine : 1;            /// Is only visible by CanSeeSubmarine
     unsigned CanSeeSubmarine : 1;      /// Only this units can see Submarine
Index: stratagus/src/pathfinder/astar.c
diff -u stratagus/src/pathfinder/astar.c:1.50 
stratagus/src/pathfinder/astar.c:1.51
--- stratagus/src/pathfinder/astar.c:1.50       Tue Sep  2 08:51:45 2003
+++ stratagus/src/pathfinder/astar.c    Wed Sep  3 05:27:51 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: astar.c,v 1.50 2003/09/02 12:51:45 mr-russ Exp $
+//     $Id: astar.c,v 1.51 2003/09/03 09:27:51 mr-russ Exp $
 
 //@{
 
@@ -723,7 +723,10 @@
     *pxd=0;
     *pyd=0;
 
-    if( unit->Data.Move.Length <= 0 ) {
+    // Goal has moved, need to recalculate path or no cached path
+    if( unit->Data.Move.Length <= 0 || 
+       ( unit->Goal && (unit->Goal->X != unit->Orders[0].X
+           || unit->Goal->Y != unit->Orders[0].Y)) ) {
         result=NewPath(unit);
         if( result==PF_UNREACHABLE ) {
            unit->Data.Move.Length=0;
@@ -732,7 +735,13 @@
        if( result==PF_REACHED ) {
            return result;
        }
+       if( unit->Goal ) {
+           // Update Orders
+           unit->Orders[0].X=unit->Goal->X;
+           unit->Orders[0].Y=unit->Goal->Y;
+       }
     }
+
     *pxd=Heading2X[(int)unit->Data.Move.Path[(int)unit->Data.Move.Length-1]];
     *pyd=Heading2Y[(int)unit->Data.Move.Path[(int)unit->Data.Move.Length-1]];
     result=unit->Data.Move.Length;
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.142 stratagus/src/ui/mouse.c:1.143
--- stratagus/src/ui/mouse.c:1.142      Mon Sep  1 08:32:17 2003
+++ stratagus/src/ui/mouse.c    Wed Sep  3 05:27:51 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: mouse.c,v 1.142 2003/09/01 12:32:17 mr-russ Exp $
+//     $Id: mouse.c,v 1.143 2003/09/03 09:27:51 mr-russ Exp $
 
 //@{
 
@@ -235,7 +235,7 @@
            }
            //  Go and repair
            if ( (unit->Type->RepairRange) && dest &&
-                   (dest->Type->Building || dest->Type->Transporter) &&
+                   (dest->Type->RepairHP) &&
                    dest->HP < dest->Stats->HitPoints  &&
                    (dest->Player==unit->Player || IsAllied(dest->Player,dest)) 
) {
                dest->Blink=4;
@@ -773,7 +773,7 @@
 
     // Check if the dest is repairable!
     if( (dest=UnitUnderCursor) && (dest->HP<dest->Stats->HitPoints) &&
-           (dest->Type->Building || dest->Type->Transporter) &&
+           (dest->Type->RepairHP) &&
            (dest->Player==ThisPlayer||IsAllied(ThisPlayer,dest))) {
        for( i=0; i<NumSelected; ++i ) {
            unit=Selected[i];
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.79 
stratagus/src/unit/ccl_unittype.c:1.80
--- stratagus/src/unit/ccl_unittype.c:1.79      Mon Sep  1 08:32:17 2003
+++ stratagus/src/unit/ccl_unittype.c   Wed Sep  3 05:27:52 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unittype.c,v 1.79 2003/09/01 12:32:17 mr-russ Exp $
+//     $Id: ccl_unittype.c,v 1.80 2003/09/03 09:27:52 mr-russ Exp $
 
 //@{
 
@@ -378,6 +378,18 @@
        } else if( gh_eq_p(value,gh_symbol2scm("repair-range")) ) {
            type->RepairRange=gh_scm2int(gh_car(list));
            list=gh_cdr(list);
+       } else if( gh_eq_p(value,gh_symbol2scm("repair-hp")) ) {
+           type->RepairHP=gh_scm2int(gh_car(list));
+           list=gh_cdr(list);
+       } else if( gh_eq_p(value,gh_symbol2scm("repair-costs")) ) {
+           sublist=gh_car(list);
+           list=gh_cdr(list);
+           while( !gh_null_p(sublist) ) {
+               value=gh_car(sublist);
+               sublist=gh_cdr(sublist);
+               
type->_RepairCosts[CclGetResourceByName(value)]=gh_scm2int(gh_car(sublist));
+               sublist=gh_cdr(sublist);
+           }
        } else if( gh_eq_p(value,gh_symbol2scm("can-target-land")) ) {
            type->CanTarget|=CanTargetLand;
        } else if( gh_eq_p(value,gh_symbol2scm("can-target-sea")) ) {
@@ -387,6 +399,8 @@
 
        } else if( gh_eq_p(value,gh_symbol2scm("building")) ) {
            type->Building=1;
+       } else if( gh_eq_p(value,gh_symbol2scm("wall")) ) {
+           type->Wall=1;
        } else if( gh_eq_p(value,gh_symbol2scm("builder-outside")) ) {
            type->BuilderOutside=1;
        } else if( gh_eq_p(value,gh_symbol2scm("builder-lost")) ) {
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.91 stratagus/src/unit/unittype.c:1.92
--- stratagus/src/unit/unittype.c:1.91  Mon Sep  1 08:32:17 2003
+++ stratagus/src/unit/unittype.c       Wed Sep  3 05:27:53 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.c,v 1.91 2003/09/01 12:32:17 mr-russ Exp $
+//     $Id: unittype.c,v 1.92 2003/09/03 09:27:53 mr-russ Exp $
 
 //@{
 
@@ -695,6 +695,25 @@
        CLprintf(file,")\n");
     }
 
+    for( i=flag=0; i<MaxCosts; ++i ) {
+       if( all || type->_Costs[i] ) {
+           if( !flag ) {
+               CLprintf(file,"  'repair-costs '(");
+               flag=1;
+           } else {
+               CLprintf(file," ");
+           }
+           CLprintf(file,"%s 
%d",DefaultResourceNames[i],type->_RepairCosts[i]);
+       }
+    }
+    if( flag ) {
+       CLprintf(file,")\n");
+    }
+
+    if( type->RepairHP ) {
+       CLprintf(file,"  'repair-hp %d\n",type->RepairHP);
+    }
+
     if( type->Construction ) {
        CLprintf(file,"  'construction '%s\n",type->Construction->Ident);
     }
@@ -1040,7 +1059,7 @@
     char **sp;
 
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.91 2003/09/01 
12:32:17 mr-russ Exp $\n\n");
+    CLprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.92 2003/09/03 
09:27:53 mr-russ Exp $\n\n");
 
     // Original number to internal unit-type name.
 




reply via email to

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