[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus data/ccl/ai.ccl data/ccl/units.ccl da...
From: |
Crestez Leonard |
Subject: |
[Stratagus-CVS] stratagus data/ccl/ai.ccl data/ccl/units.ccl da... |
Date: |
Thu, 11 Sep 2003 06:49:14 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Crestez Leonard <address@hidden> 03/09/11 06:49:13
Modified files:
data/ccl : ai.ccl units.ccl
data/ccl/human : units.ccl
data/ccl/orc : units.ccl
doc : ChangeLog.html
src/action : action_attack.c action_move.c action_still.c
src/ai : ai_local.h ai_resource.c ccl_ai.c new_ai.c
src/clone : mainloop.c unit.c unit_draw.c
src/include : unittype.h
src/ui : mouse.c
src/unit : ccl_unittype.c unittype.c
Log message:
Fixed attack-move bug.
Removed unused ai helper tables(for resource collectors).
Starting renaming Submarine to Cloak.
Patches:
Index: stratagus/data/ccl/ai.ccl
diff -u stratagus/data/ccl/ai.ccl:1.54 stratagus/data/ccl/ai.ccl:1.55
--- stratagus/data/ccl/ai.ccl:1.54 Fri Sep 5 14:10:54 2003
+++ stratagus/data/ccl/ai.ccl Thu Sep 11 06:49:07 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: ai.ccl,v 1.54 2003/09/05 18:10:54 n0body Exp $
+;; $Id: ai.ccl,v 1.55 2003/09/11 10:49:07 n0body Exp $
;(define (ai:sleep) () #t)
@@ -114,11 +114,6 @@
'unit-gryphon-aviary 'unit-dark-portal 'unit-runestone
'unit-alliance-transport)
;;
- ;; Workers can collect which resource.
- ;;
- (list 'collect 'unit-peasant 'gold 'wood 'ore 'stone 'coal)
- (list 'collect 'unit-human-oil-tanker 'oil )
- ;;
;; Reduce unit limits.
;;
(list 'unit-limit 'unit-farm 'food)
@@ -208,11 +203,6 @@
'unit-alchemist 'unit-ogre-mound 'unit-temple-of-the-damned
'unit-altar-of-storms 'unit-dragon-roost 'unit-dark-portal
'unit-runestone 'unit-mythical-transport)
- ;;
- ;; Workers can collect which resource.
- ;;
- (list 'collect 'unit-peon 'gold 'wood 'ore 'stone 'coal)
- (list 'collect 'unit-orc-oil-tanker 'oil )
;;
;; Reduce unit limits.
;;
Index: stratagus/data/ccl/human/units.ccl
diff -u stratagus/data/ccl/human/units.ccl:1.32
stratagus/data/ccl/human/units.ccl:1.33
--- stratagus/data/ccl/human/units.ccl:1.32 Fri Sep 5 14:10:54 2003
+++ stratagus/data/ccl/human/units.ccl Thu Sep 11 06:49:08 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.32 2003/09/05 18:10:54 n0body Exp $
+;; $Id: units.ccl,v 1.33 2003/09/11 10:49:08 n0body Exp $
;;=============================================================================
;; Define unit-types.
@@ -395,7 +395,7 @@
'can-attack
'can-target-land 'can-target-sea 'can-target-air
'air-unit
- 'can-see-submarine
+ 'detect-cloak
'organic
'selectable-by-rectangle
'sounds '(
@@ -595,8 +595,8 @@
'can-attack
'can-target-sea
'sea-unit
- 'submarine
- 'can-see-submarine
+ 'permanent-cloak
+ 'detect-cloak
'selectable-by-rectangle
'sounds '(
selected "gnomish-submarine-selected"
@@ -624,7 +624,7 @@
'type-fly
'right-move
'air-unit 'coward
- 'can-see-submarine
+ 'detect-cloak
'selectable-by-rectangle
'sounds '(
selected "gnomish-flying-machine-selected"
@@ -655,7 +655,7 @@
'can-attack
'can-target-land 'can-target-sea 'can-target-air
'air-unit
- 'can-see-submarine
+ 'detect-cloak
'organic
'selectable-by-rectangle
'sounds '(
@@ -912,7 +912,7 @@
'type-land
'can-target-land 'can-target-sea 'can-target-air
'building
- 'can-see-submarine
+ 'detect-cloak
'sounds '(
selected "human-watch-tower-selected"
acknowledge "human-watch-tower-acknowledge"
@@ -1361,7 +1361,7 @@
'can-attack
'can-target-land 'can-target-sea 'can-target-air
'building
- 'can-see-submarine
+ 'detect-cloak
'tower
'sounds '(
selected "human-guard-tower-selected"
@@ -1395,7 +1395,7 @@
'can-attack
'can-target-land 'can-target-sea
'building
- 'can-see-submarine
+ 'detect-cloak
'tower
'sounds '(
selected "human-cannon-tower-selected"
Index: stratagus/data/ccl/orc/units.ccl
diff -u stratagus/data/ccl/orc/units.ccl:1.36
stratagus/data/ccl/orc/units.ccl:1.37
--- stratagus/data/ccl/orc/units.ccl:1.36 Fri Sep 5 14:10:55 2003
+++ stratagus/data/ccl/orc/units.ccl Thu Sep 11 06:49:08 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.36 2003/09/05 18:10:55 n0body Exp $
+;; $Id: units.ccl,v 1.37 2003/09/11 10:49:08 n0body Exp $
;;=============================================================================
;; Define unit-types.
@@ -594,7 +594,7 @@
'can-attack
'can-target-land 'can-target-sea 'can-target-air
'air-unit
- 'can-see-submarine
+ 'detect-cloak
'organic
'selectable-by-rectangle
'sounds '(
@@ -628,8 +628,8 @@
'can-attack
'can-target-sea
'sea-unit
- 'submarine
- 'can-see-submarine
+ 'permanent-cloak
+ 'detect-cloak
'selectable-by-rectangle
'sounds '(
selected "giant-turtle-selected"
@@ -657,7 +657,7 @@
'type-fly
'right-move
'air-unit 'coward
- 'can-see-submarine
+ 'detect-cloak
'selectable-by-rectangle
'sounds '(
selected "goblin-zeppelin-selected"
@@ -687,7 +687,7 @@
'can-attack
'can-target-land 'can-target-sea 'can-target-air
'air-unit
- 'can-see-submarine
+ 'detect-cloak
'organic
'selectable-by-rectangle
'sounds '(
@@ -715,7 +715,7 @@
'type-fly
'right-move
'air-unit
- 'can-see-submarine
+ 'detect-cloak
'selectable-by-rectangle
'sounds '(
selected "eye-of-kilrogg-selected"
@@ -1002,7 +1002,7 @@
'type-land
'can-target-land 'can-target-sea 'can-target-air
'building
- 'can-see-submarine
+ 'detect-cloak
'sounds '(
selected "orc-watch-tower-selected"
acknowledge "orc-watch-tower-acknowledge"
@@ -1451,7 +1451,7 @@
'can-attack
'can-target-land 'can-target-sea 'can-target-air
'building
- 'can-see-submarine
+ 'detect-cloak
'tower
'sounds '(
selected "orc-guard-tower-selected"
@@ -1485,7 +1485,7 @@
'can-attack
'can-target-land 'can-target-sea
'building
- 'can-see-submarine
+ 'detect-cloak
'tower
'sounds '(
selected "orc-cannon-tower-selected"
Index: stratagus/data/ccl/units.ccl
diff -u stratagus/data/ccl/units.ccl:1.44 stratagus/data/ccl/units.ccl:1.45
--- stratagus/data/ccl/units.ccl:1.44 Wed Sep 3 05:27:50 2003
+++ stratagus/data/ccl/units.ccl Thu Sep 11 06:49:07 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.44 2003/09/03 09:27:50 mr-russ Exp $
+;; $Id: units.ccl,v 1.45 2003/09/11 10:49:07 n0body Exp $
;; Load the animations for the units.
(ccl:load "ccl/anim.ccl")
@@ -137,7 +137,7 @@
'can-target-land 'can-target-sea 'can-target-air
'air-unit
'critter
- 'can-see-submarine
+ 'detect-cloak
'organic
'selectable-by-rectangle
'sounds '(
@@ -417,7 +417,7 @@
'building
'revealer
'critter
- 'can-see-submarine
+ 'detect-cloak
'sounds '())
(define-unit-type 'unit-reveal-attacker 'name "Dummy unit"
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.523 stratagus/doc/ChangeLog.html:1.524
--- stratagus/doc/ChangeLog.html:1.523 Wed Sep 10 04:44:36 2003
+++ stratagus/doc/ChangeLog.html Thu Sep 11 06:49:08 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.523 2003/09/10 08:44:36 n0body Exp $
+---- $Id: ChangeLog.html,v 1.524 2003/09/11 10:49:08 n0body Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 1.19 Release<p>
<ul>
<li>++
+ <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).
<li>Applied patch #1885, updated msvc project files (from Jimmy Salmon).
Index: stratagus/src/action/action_attack.c
diff -u stratagus/src/action/action_attack.c:1.81
stratagus/src/action/action_attack.c:1.82
--- stratagus/src/action/action_attack.c:1.81 Wed Sep 3 05:27:51 2003
+++ stratagus/src/action/action_attack.c Thu Sep 11 06:49:09 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_attack.c,v 1.81 2003/09/03 09:27:51 mr-russ Exp $
+// $Id: action_attack.c,v 1.82 2003/09/11 10:49:09 n0body Exp $
//@{
@@ -51,6 +51,7 @@
#include "sound.h"
#include "map.h"
#include "pathfinder.h"
+#include <string.h>
#ifdef NEW_UI
#include "interface.h"
#endif
@@ -263,11 +264,6 @@
return 0;
}
-/**
-** Handle moving to the target.
-**
-** @param unit Unit, for that the attack is handled.
-*/
local void MoveToTarget(Unit* unit)
{
Unit* goal;
@@ -282,99 +278,111 @@
err=DoActionMove(unit);
- // NEW return codes supported, FIXME: but johns thinks not perfect.
-
-#ifdef HIERARCHIC_PATHFINDER
if( unit->Reset ) {
- if( CheckForTargetInRange(unit) ) {
- return;
- }
- }
- if (err==PF_REACHED) {
-#else /* HIERARCHIC_PATHDFINDER */
- if (err==PF_REACHED) {
//
- // Look if we have reached the target.
+ // Look if we have reached the target.
//
if( CheckForTargetInRange(unit) ) {
return;
}
-#endif /* HIERARCHIC_PATHDFINDER */
goal=unit->Orders[0].Goal;
-
+ if (err>=0) {
+ //
+ // Nothing to do, we're on the way moving.
+ //
+ DebugLevel3Fn("Nothing to do.\n");
+ return;
+ }
+ if (err==PF_REACHED) {
+ //
+ // Have reached target? FIXME: could use the new return code?
+ //
+ if( goal && MapDistanceToUnit(unit->X,unit->Y,goal)
+ <=unit->Stats->AttackRange ) {
+ DebugLevel3Fn("Reached another unit, now attacking it.\n");
+ unit->State=0;
+ if( !unit->Type->Tower ) {
+ UnitHeadingFromDeltaXY(unit,
+ goal->X+(goal->Type->TileWidth-1)/2-unit->X,
+ goal->Y+(goal->Type->TileHeight-1)/2-unit->Y);
+ // FIXME: only if heading changes
+ CheckUnitToBeDrawn(unit);
+ }
+ unit->SubAction++;
+ return;
+ }
+ //
+ // Attacking wall or ground.
+ //
+ if( !goal && (WallOnMap(unit->Orders[0].X,unit->Orders[0].Y)
+ || unit->Orders[0].Action==UnitActionAttackGround)
+ && MapDistance(unit->X,unit->Y
+ ,unit->Orders[0].X,unit->Orders[0].Y)
+ <=unit->Stats->AttackRange ) {
+ DebugLevel3Fn("Reached wall or ground, now attacking it.\n");
+ unit->State=0;
+ if( !unit->Type->Tower ) {
+ UnitHeadingFromDeltaXY(unit,unit->Orders[0].X-unit->X
+ ,unit->Orders[0].Y-unit->Y);
+ // FIXME: only if heading changes
+ CheckUnitToBeDrawn(unit);
+ }
+ unit->SubAction&=WEAK_TARGET;
+ unit->SubAction|=ATTACK_TARGET;
+ return;
+ }
+ }
//
- // Have reached target? FIXME: could use the new return code?
+ // Unreachable.
//
- if( goal && MapDistanceToUnit(unit->X,unit->Y,goal)
- <=unit->Stats->AttackRange ) {
- unit->State=0;
- if( !unit->Type->Tower ) {
- UnitHeadingFromDeltaXY(unit,
- goal->X+(goal->Type->TileWidth-1)/2-unit->X,
- goal->Y+(goal->Type->TileHeight-1)/2-unit->Y);
- // FIXME: only if heading changes
- CheckUnitToBeDrawn(unit);
- }
- unit->SubAction++;
- } else if( !goal && (WallOnMap(unit->Orders[0].X,unit->Orders[0].Y)
- || unit->Orders[0].Action==UnitActionAttackGround)
- && MapDistance(unit->X,unit->Y
- ,unit->Orders[0].X,unit->Orders[0].Y)
- <=unit->Stats->AttackRange ) {
- DebugLevel2Fn("Attacking wall or ground\n");
- unit->State=0;
- if( !unit->Type->Tower ) {
- UnitHeadingFromDeltaXY(unit,unit->Orders[0].X-unit->X
- ,unit->Orders[0].Y-unit->Y);
- // FIXME: only if heading changes
- CheckUnitToBeDrawn(unit);
- }
- unit->SubAction&=WEAK_TARGET;
- unit->SubAction|=ATTACK_TARGET;
- return;
- } else if( err<0 ) {
+ if( err==PF_UNREACHABLE ) {
unit->State=unit->SubAction=0;
- // Return to old task?
- if( err==PF_UNREACHABLE ) {
- DebugLevel3Fn("Target not reachable, unit: %d" _C_
UnitNumber(unit));
- if( goal ) {
- DebugLevel3(", target %d range %d\n" _C_ UnitNumber(goal)
_C_ unit->Orders[0].RangeX);
- } else {
- DebugLevel0(", (%d,%d) Tring with more range...\n" _C_
unit->Orders[0].X _C_ unit->Orders[0].Y);
- if( unit->Orders[0].RangeX < TheMap.Width
- || unit->Orders[0].RangeY < TheMap.Height ) {
- // Try again with more range
- unit->Orders[0].RangeX++;
- unit->Orders[0].RangeY++;
- return;
- }
+ DebugLevel3Fn("Target not reachable, unit: %d" _C_
UnitNumber(unit));
+ if( goal ) {
+ DebugLevel3(", target %d range %d\n" _C_ UnitNumber(goal) _C_
unit->Orders[0].RangeX);
+ } else {
+ //
+ // When attack-moving we have to allow a bigger range
+ //
+ DebugLevel3(", (%d,%d) Tring with more range...\n" _C_
unit->Orders[0].X _C_ unit->Orders[0].Y);
+ if( unit->Orders[0].RangeX < TheMap.Width
+ || unit->Orders[0].RangeY < TheMap.Height ) {
+ // Try again with more range
+ unit->Orders[0].RangeX++;
+ unit->Orders[0].RangeY++;
+ return;
}
}
- if( unit->Orders[0].Goal ) {
- RefsDebugCheck( !unit->Orders[0].Goal->Refs );
- unit->Orders[0].Goal->Refs--;
- RefsDebugCheck( !unit->Orders[0].Goal->Refs );
- }
- unit->Orders[0]=unit->SavedOrder;
- NewResetPath(unit);
-
- // Must finish, if saved command finishes
- unit->SavedOrder.Action=UnitActionStill;
- unit->SavedOrder.Goal=NoUnitP;
+ }
+ //
+ // Return to old task?
+ //
+ unit->State=unit->SubAction=0;
+ DebugLevel3Fn("Returning to old task.\n");
+ if( unit->Orders[0].Goal ) {
+ RefsDebugCheck( !unit->Orders[0].Goal->Refs );
+ unit->Orders[0].Goal->Refs--;
+ RefsDebugCheck( !unit->Orders[0].Goal->Refs );
+ }
+ unit->Orders[0]=unit->SavedOrder;
+ NewResetPath(unit);
+
+ // Must finish, if saved command finishes
+ unit->SavedOrder.Action=UnitActionStill;
+ unit->SavedOrder.Goal=NoUnitP;
- if( unit->Selected && unit->Player==ThisPlayer ) {
+ if( unit->Selected && unit->Player==ThisPlayer ) {
#ifndef NEW_UI
- MustRedraw|=RedrawButtonPanel;
+ MustRedraw|=RedrawButtonPanel;
#else
- SelectedUnitChanged();
+ SelectedUnitChanged();
#endif
- }
- return;
}
- DebugCheck( unit->Type->Vanishes || unit->Destroyed || unit->Removed );
- DebugCheck( unit->Orders[0].Action!=UnitActionAttack
- && unit->Orders[0].Action!=UnitActionAttackGround );
+ return;
}
+ DebugCheck( unit->Type->Vanishes || unit->Destroyed || unit->Removed );
+ DebugCheck( unit->Orders[0].Action!=UnitActionAttack
+ && unit->Orders[0].Action!=UnitActionAttackGround );
}
/**
@@ -561,7 +569,8 @@
*/
global void HandleActionAttack(Unit* unit)
{
- DebugLevel3Fn("Attack %d\n" _C_ UnitNumber(unit));
+ DebugLevel3Fn("Attack %d r %d,%d\n" _C_ UnitNumber(unit)
+ _C_ unit->Orders->RangeX _C_ unit->Orders->RangeY);
switch( unit->SubAction ) {
//
Index: stratagus/src/action/action_move.c
diff -u stratagus/src/action/action_move.c:1.64
stratagus/src/action/action_move.c:1.65
--- stratagus/src/action/action_move.c:1.64 Fri Sep 5 14:10:55 2003
+++ stratagus/src/action/action_move.c Thu Sep 11 06:49:09 2003
@@ -21,7 +21,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// $Id: action_move.c,v 1.64 2003/09/05 18:10:55 n0body Exp $
+// $Id: action_move.c,v 1.65 2003/09/11 10:49:09 n0body Exp $
//@{
@@ -168,7 +168,7 @@
}
// Reveal Submarines and stuff.
- if( unit->Type->CanSeeSubmarine ) {
+ if( unit->Type->DetectCloak ) {
MarkSubmarineSeen(unit->Player,x,y,unit->Stats->SightRange);
}
@@ -282,7 +282,7 @@
if( !unit->SubAction ) { // first entry
unit->SubAction=1;
NewResetPath(unit);
-
+
DebugCheck( unit->State!=0 );
}
Index: stratagus/src/action/action_still.c
diff -u stratagus/src/action/action_still.c:1.67
stratagus/src/action/action_still.c:1.68
--- stratagus/src/action/action_still.c:1.67 Thu Aug 21 17:55:45 2003
+++ stratagus/src/action/action_still.c Thu Sep 11 06:49:09 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_still.c,v 1.67 2003/08/21 21:55:45 n0body Exp $
+// $Id: action_still.c,v 1.68 2003/09/11 10:49:09 n0body Exp $
//@{
@@ -111,8 +111,7 @@
//
// Critters: are moving random around.
//
- // FIXME: critters: skeleton and daemon are also critters??????
- if( type->Critter && type==UnitTypeCritter ) {
+ if( type->Critter && type==UnitTypeCritter) {
int x;
int y;
@@ -149,6 +148,7 @@
unit->Orders[0].RangeX=unit->Orders[0].RangeY=0;
unit->Orders[0].X=x;
unit->Orders[0].Y=y;
+ unit->State=0;
}
}
// NOTE: critter couldn't attack automatic through the return
Index: stratagus/src/ai/ai_local.h
diff -u stratagus/src/ai/ai_local.h:1.34 stratagus/src/ai/ai_local.h:1.35
--- stratagus/src/ai/ai_local.h:1.34 Fri Jul 11 10:35:29 2003
+++ stratagus/src/ai/ai_local.h Thu Sep 11 06:49:09 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_local.h,v 1.34 2003/07/11 14:35:29 n0body Exp $
+// $Id: ai_local.h,v 1.35 2003/09/11 10:49:09 n0body Exp $
#ifndef __AI_LOCAL_H__
#define __AI_LOCAL_H__
@@ -247,18 +247,6 @@
*/
int RepairCount;
AiUnitTypeTable** Repair;
- /**
- ** The index is the costs that should be collected, giving a table of all
- ** units/buildings which could collect this resource.
- */
- int CollectCount;
- AiUnitTypeTable** Collect;
- /**
- ** The index is the costs that should be collected, giving a table of all
- ** units/buildings which could carray this resource.
- */
- int WithGoodsCount;
- AiUnitTypeTable** WithGoods;
/**
** The index is the unit-limit that should be solved, giving a table of all
** units/buildings which could reduce this unit-limit.
Index: stratagus/src/ai/ai_resource.c
diff -u stratagus/src/ai/ai_resource.c:1.67 stratagus/src/ai/ai_resource.c:1.68
--- stratagus/src/ai/ai_resource.c:1.67 Wed Sep 10 04:44:36 2003
+++ stratagus/src/ai/ai_resource.c Thu Sep 11 06:49:09 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ai_resource.c,v 1.67 2003/09/10 08:44:36 n0body Exp $
+// $Id: ai_resource.c,v 1.68 2003/09/11 10:49:09 n0body Exp $
#ifdef NEW_AI // {
@@ -959,7 +959,7 @@
//
if( AiAssignHarvester(unit,c) ) {
int n1,n2;
- DebugLevel0Fn("Assigned %d to %s\n" _C_ unit->Slot _C_
DefaultResourceNames[c]);
+ DebugLevel3Fn("Assigned %d to %s\n" _C_ unit->Slot _C_
DefaultResourceNames[c]);
units_assigned[num_units_assigned[c]++][c]=unit;
units_unassigned[i][c] =
units_unassigned[--num_units_unassigned[c]][c];
for( n1=0; n1<MaxCosts; ++n1 ) {
Index: stratagus/src/ai/ccl_ai.c
diff -u stratagus/src/ai/ccl_ai.c:1.66 stratagus/src/ai/ccl_ai.c:1.67
--- stratagus/src/ai/ccl_ai.c:1.66 Sun Aug 24 14:48:03 2003
+++ stratagus/src/ai/ccl_ai.c Thu Sep 11 06:49:09 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ai.c,v 1.66 2003/08/24 18:48:03 n0body Exp $
+// $Id: ccl_ai.c,v 1.67 2003/09/11 10:49:09 n0body Exp $
//@{
@@ -161,16 +161,12 @@
what=2;
} else if( gh_eq_p(value,gh_symbol2scm("research")) ) {
what=3;
- } else if( gh_eq_p(value,gh_symbol2scm("collect")) ) {
- what=4;
- } else if( gh_eq_p(value,gh_symbol2scm("with-goods")) ) {
- what=5;
} else if( gh_eq_p(value,gh_symbol2scm("unit-limit")) ) {
- what=6;
+ what=4;
} else if( gh_eq_p(value,gh_symbol2scm("unit-equiv")) ) {
- what=7;
+ what=5;
} else if( gh_eq_p(value,gh_symbol2scm("repair")) ) {
- what=8;
+ what=6;
} else {
fprintf(stderr,"unknown tag\n");
continue;
@@ -208,26 +204,7 @@
continue;
}
DebugLevel3Fn("> %s\n" _C_ upgrade->Ident);
- } else if( what==4 || what==5 ) {
- if( !strcmp(DefaultResourceNames[1],str) ) {
- cost=1;
- } else if( !strcmp(DefaultResourceNames[2],str) ) {
- cost=2;
- } else if( !strcmp(DefaultResourceNames[3],str) ) {
- cost=3;
- } else if( !strcmp(DefaultResourceNames[4],str) ) {
- cost=4;
- } else if( !strcmp(DefaultResourceNames[5],str) ) {
- cost=5;
- } else if( !strcmp(DefaultResourceNames[6],str) ) {
- cost=6;
- } else {
- fprintf(stderr,"unknown cost %s\n",str);
- free(str);
- continue;
- }
- DebugLevel3Fn("> %s\n" _C_ str);
- } else if( what==6 ) {
+ } else if( what==4 ) {
if( !strcmp("food",str) ) {
cost=0;
} else {
@@ -270,27 +247,17 @@
upgrade-Upgrades);
AiHelperInsert(AiHelpers.Research+(upgrade-Upgrades),base);
break;
- case 4: // collect
- AiHelperSetupTable(
- &AiHelpers.CollectCount,&AiHelpers.Collect,cost);
- AiHelperInsert(AiHelpers.Collect+cost,base);
- break;
- case 5: // with-goods
- AiHelperSetupTable(
- &AiHelpers.WithGoodsCount,&AiHelpers.WithGoods,cost);
- AiHelperInsert(AiHelpers.WithGoods+cost,base);
- break;
- case 6: // unit-limit
+ case 4: // unit-limit
AiHelperSetupTable(
&AiHelpers.UnitLimitCount,&AiHelpers.UnitLimit,cost);
AiHelperInsert(AiHelpers.UnitLimit+cost,base);
break;
- case 7: // equivalence
+ case 5: // equivalence
AiHelperSetupTable(
&AiHelpers.EquivCount,&AiHelpers.Equiv,base->Type);
AiHelperInsert(AiHelpers.Equiv+base->Type,type);
break;
- case 8: // repair
+ case 6: // repair
AiHelperSetupTable(
&AiHelpers.RepairCount,&AiHelpers.Repair,type->Type);
AiHelperInsert(AiHelpers.Repair+type->Type,base);
Index: stratagus/src/ai/new_ai.c
diff -u stratagus/src/ai/new_ai.c:1.71 stratagus/src/ai/new_ai.c:1.72
--- stratagus/src/ai/new_ai.c:1.71 Sun Aug 24 14:48:03 2003
+++ stratagus/src/ai/new_ai.c Thu Sep 11 06:49:09 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: new_ai.c,v 1.71 2003/08/24 18:48:03 n0body Exp $
+// $Id: new_ai.c,v 1.72 2003/09/11 10:49:09 n0body Exp $
#ifdef NEW_AI // {
@@ -570,17 +570,6 @@
AiHelpers.Repair);
//
- // Save collect table
- //
- SaveAiCostTable(file,"collect",AiHelpers.CollectCount,AiHelpers.Collect);
-
- //
- // Save resource table
- //
- SaveAiCostTable(file,"with-goods",AiHelpers.WithGoodsCount,
- AiHelpers.WithGoods);
-
- //
// Save limits table
//
SaveAiUnitLimitTable(file,"unit-limit",AiHelpers.UnitLimitCount,
@@ -816,7 +805,7 @@
global void SaveAi(CLFile* file)
{
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: AI $Id: new_ai.c,v 1.71 2003/08/24 18:48:03
n0body Exp $\n\n");
+ CLprintf(file,";;; MODULE: AI $Id: new_ai.c,v 1.72 2003/09/11 10:49:09
n0body Exp $\n\n");
SaveAiTypesWcName(file);
SaveAiHelper(file);
@@ -993,16 +982,6 @@
free(AiHelpers.Repair[i]);
}
free(AiHelpers.Repair);
-
- for( i=0; i<AiHelpers.CollectCount; ++i ) {
- free(AiHelpers.Collect[i]);
- }
- free(AiHelpers.Collect);
-
- for( i=0; i<AiHelpers.WithGoodsCount; ++i ) {
- free(AiHelpers.WithGoods[i]);
- }
- free(AiHelpers.WithGoods);
for( i=0; i<AiHelpers.UnitLimitCount; ++i ) {
free(AiHelpers.UnitLimit[i]);
Index: stratagus/src/clone/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.140
stratagus/src/clone/mainloop.c:1.141
--- stratagus/src/clone/mainloop.c:1.140 Fri Aug 8 06:16:43 2003
+++ stratagus/src/clone/mainloop.c Thu Sep 11 06:49:09 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainloop.c,v 1.140 2003/08/08 10:16:43 martinxyz Exp $
+// $Id: mainloop.c,v 1.141 2003/09/11 10:49:09 n0body Exp $
//@{
@@ -409,6 +409,10 @@
SetClipping(vp->X,vp->Y,vp->EndX,vp->EndY);
DrawMapBackgroundInViewport(vp,vp->MapX,vp->MapY);
+
+ //
+ // We find and sort units after draw level.
+ //
nunits=FindAndSortUnits(vp,table);
nmissiles=FindAndSortMissiles(vp,missiletable);
@@ -471,6 +475,16 @@
}
}
DrawMapFogOfWar(vp, vp->MapX, vp->MapY);
+ //
+ // Draw orders of selected units.
+ // Drawn here so that they are shown even when the unit is out of
the screen.
+ //
+ if( ShowOrders==SHOW_ORDERS_ALWAYS ||
+ ((ShowOrdersCount>=GameCycle ||(KeyModifiers&ModifierShift))) )
{
+ for (i=0;i<NumSelected;i++) {
+ ShowOrder(Selected[i]);
+ }
+ }
DrawConsole();
SetClipping(0,0,VideoWidth-1,VideoHeight-1);
}
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.292 stratagus/src/clone/unit.c:1.293
--- stratagus/src/clone/unit.c:1.292 Wed Sep 10 04:44:36 2003
+++ stratagus/src/clone/unit.c Thu Sep 11 06:49:10 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.292 2003/09/10 08:44:36 n0body Exp $
+// $Id: unit.c,v 1.293 2003/09/11 10:49:10 n0body Exp $
//@{
@@ -350,7 +350,7 @@
unit->Removed = 1;
// Invisible as default for submarines
- if (!type->Submarine) {
+ if (!type->PermanentCloak) {
unit->Visible = -1; // Visible as default
}
@@ -512,7 +512,7 @@
unit->CurrentSightRange=unit->Stats->SightRange;
MapMarkUnitSight(unit);
- if( type->CanSeeSubmarine ) {
+ if( type->DetectCloak ) {
MarkSubmarineSeen(unit->Player,x,y,unit->Stats->SightRange);
}
}
@@ -1583,7 +1583,7 @@
unit->Bloodlust _C_ unit->Haste _C_ unit->Slow _C_
unit->Invisible _C_ unit->UnholyArmor);
- if ( unit->Type->Submarine ) {
+ if ( unit->Type->PermanentCloak ) {
if( !flag && (unit->Visible&(1<<ThisPlayer->Player)) ) {
flag=CheckUnitToBeDrawn(unit);
}
@@ -1598,7 +1598,7 @@
//
for( table=Units; table<Units+NumUnits; table++ ) {
unit=*table;
- if( unit->Type->CanSeeSubmarine && !unit->Removed &&
+ if( unit->Type->DetectCloak && !unit->Removed &&
unit->Orders[0].Action!=UnitActionBuilded ) {
MarkSubmarineSeen(unit->Player,unit->X+unit->Type->TileWidth/2,
unit->Y+unit->Type->TileHeight/2,unit->Stats->SightRange);
@@ -3975,7 +3975,7 @@
int InRun, RunStart;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.292 2003/09/10 08:44:36
n0body Exp $\n\n");
+ CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.293 2003/09/11 10:49:10
n0body Exp $\n\n");
//
// Local variables
Index: stratagus/src/clone/unit_draw.c
diff -u stratagus/src/clone/unit_draw.c:1.157
stratagus/src/clone/unit_draw.c:1.158
--- stratagus/src/clone/unit_draw.c:1.157 Fri Sep 5 14:10:55 2003
+++ stratagus/src/clone/unit_draw.c Thu Sep 11 06:49:10 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.157 2003/09/05 18:10:55 n0body Exp $
+// $Id: unit_draw.c,v 1.158 2003/09/11 10:49:10 n0body Exp $
//@{
@@ -577,7 +577,7 @@
global void SaveDecorations(CLFile* file)
{
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: decorations $Id: unit_draw.c,v 1.157 2003/09/05
18:10:55 n0body Exp $\n\n");
+ CLprintf(file,";;; MODULE: decorations $Id: unit_draw.c,v 1.158 2003/09/11
10:49:10 n0body Exp $\n\n");
CLprintf(file,"(mana-sprite \"%s\" %d %d %d %d)\n",
ManaSprite.File,ManaSprite.HotX,ManaSprite.HotY,
@@ -1609,14 +1609,6 @@
,stats->AttackRange*TileSizeX);
}
}
- }
-
- //
- // Show order.
- //
- if( ShowOrders==SHOW_ORDERS_ALWAYS || (unit->Selected
- && (ShowOrdersCount>=GameCycle ||(KeyModifiers&ModifierShift))) ) {
- ShowOrder(unit);
}
// FIXME: johns: ugly check here, should be removed!
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.104
stratagus/src/include/unittype.h:1.105
--- stratagus/src/include/unittype.h:1.104 Wed Sep 10 04:44:36 2003
+++ stratagus/src/include/unittype.h Thu Sep 11 06:49:10 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.h,v 1.104 2003/09/10 08:44:36 n0body Exp $
+// $Id: unittype.h,v 1.105 2003/09/11 10:49:10 n0body Exp $
#ifndef __UNITTYPE_H__
#define __UNITTYPE_H__
@@ -294,13 +294,13 @@
**
** Unit is a Building
**
-** UnitType::Submarine
+** UnitType::PermanentCloak
**
-** Is only visible by CanSeeSubmarine
+** Unit is permanently cloaked.
**
-** UnitType::CanSeeSubmarine
+** UnitType::DetectCloak
**
-** Only this units can see Submarine
+** These units can detect Cloaked units.
**
** UnitType::Coward
**
@@ -726,8 +726,8 @@
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
+ unsigned PermanentCloak : 1; /// Is only visible by CloakDetectors.
+ unsigned DetectCloak : 1; /// Can see Cloaked units.
unsigned Coward : 1; /// Unit will only attack if instructed.
unsigned Transporter : 1; /// Can transport units
unsigned MaxOnBoard; /// Number of Transporter slots.
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.145 stratagus/src/ui/mouse.c:1.146
--- stratagus/src/ui/mouse.c:1.145 Wed Sep 10 04:44:36 2003
+++ stratagus/src/ui/mouse.c Thu Sep 11 06:49:12 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mouse.c,v 1.145 2003/09/10 08:44:36 n0body Exp $
+// $Id: mouse.c,v 1.146 2003/09/11 10:49:12 n0body Exp $
//@{
@@ -349,23 +349,18 @@
#endif
if (type->Building) {
- if( dest && dest->Type->GivesResource==OilCost ) {
+ if( dest && dest->Type->GivesResource ) {
dest->Blink=4;
- DebugLevel3("RALY POINT TO PLATFORM\n");
+ DebugLevel3("Set rally point to a resource.\n");
SendCommandResource(Selected[i],dest,!(KeyModifiers&ModifierShift));
continue;
- }
- if( dest && dest->Type->GivesResource==GoldCost ) {
- dest->Blink=4;
- DebugLevel3("RALY POINT TO GOLD-MINE\n");
-
SendCommandResource(Selected[i],dest,!(KeyModifiers&ModifierShift));
- continue;
}
if( IsMapFieldExplored(unit->Player,x,y) && ForestOnMap(x,y) ) {
- DebugLevel3("RALY POINT TO FOREST\n");
+ DebugLevel3("Set rally point to a forest.\n");
SendCommandResourceLoc(Selected[i],x,y,!(KeyModifiers&ModifierShift));
continue;
}
+ DebugLevel3("Set rally point to a location.\n");
SendCommandMove(unit,x,y,flush);
continue;
}
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.81
stratagus/src/unit/ccl_unittype.c:1.82
--- stratagus/src/unit/ccl_unittype.c:1.81 Fri Sep 5 14:10:56 2003
+++ stratagus/src/unit/ccl_unittype.c Thu Sep 11 06:49:12 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_unittype.c,v 1.81 2003/09/05 18:10:56 n0body Exp $
+// $Id: ccl_unittype.c,v 1.82 2003/09/11 10:49:12 n0body Exp $
//@{
@@ -419,10 +419,10 @@
type->SeaUnit=1;
} else if( gh_eq_p(value,gh_symbol2scm("critter")) ) {
type->Critter=1;
- } else if( gh_eq_p(value,gh_symbol2scm("submarine")) ) {
- type->Submarine=1;
- } else if( gh_eq_p(value,gh_symbol2scm("can-see-submarine")) ) {
- type->CanSeeSubmarine=1;
+ } else if( gh_eq_p(value,gh_symbol2scm("permanent-cloak")) ) {
+ type->PermanentCloak=1;
+ } else if( gh_eq_p(value,gh_symbol2scm("detect-cloak")) ) {
+ type->DetectCloak=1;
} else if( gh_eq_p(value,gh_symbol2scm("transporter")) ) {
type->Transporter=1;
} else if( gh_eq_p(value,gh_symbol2scm("coward")) ) {
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.94 stratagus/src/unit/unittype.c:1.95
--- stratagus/src/unit/unittype.c:1.94 Fri Sep 5 14:10:56 2003
+++ stratagus/src/unit/unittype.c Thu Sep 11 06:49:13 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.94 2003/09/05 18:10:56 n0body Exp $
+// $Id: unittype.c,v 1.95 2003/09/11 10:49:13 n0body Exp $
//@{
@@ -444,8 +444,8 @@
unittype->SeaUnit=BIT(3,v);
unittype->Critter=BIT(4,v);
unittype->Building=BIT(5,v);
- unittype->Submarine=BIT(6,v);
- unittype->CanSeeSubmarine=BIT(7,v);
+ unittype->PermanentCloak=BIT(6,v);
+ unittype->DetectCloak=BIT(7,v);
// Cowards
unittype->Coward=BIT(8,v)|BIT(26,v);
if (BIT(9,v)) {
@@ -891,11 +891,11 @@
if( type->Revealer ) {
CLprintf(file," 'revealer\n");
}
- if( type->Submarine ) {
- CLprintf(file," 'submarine\n");
+ if( type->PermanentCloak ) {
+ CLprintf(file," 'permanent-cloak\n");
}
- if( type->CanSeeSubmarine ) {
- CLprintf(file," 'can-see-submarine\n");
+ if( type->DetectCloak ) {
+ CLprintf(file," 'detect-cloak\n");
}
if( type->Transporter ) {
CLprintf(file," 'transporter\n");
@@ -1085,7 +1085,7 @@
char **sp;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.94 2003/09/05
18:10:56 n0body Exp $\n\n");
+ CLprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.95 2003/09/11
10:49:13 n0body Exp $\n\n");
// Original number to internal unit-type name.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus data/ccl/ai.ccl data/ccl/units.ccl da...,
Crestez Leonard <=