Changed can-repair to repair-range, allows flexible repair distances
This commit is contained in:
parent
9f2cb36669
commit
f9ed299f1a
11 changed files with 33 additions and 30 deletions
|
@ -36,6 +36,7 @@
|
|||
<li>Future 1.19 Release<p>
|
||||
<ul>
|
||||
<li>++
|
||||
<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).
|
||||
<li>Fixed Pathfinder bug and cleaned up vision table management (from Russell Smith).
|
||||
|
|
|
@ -201,7 +201,7 @@ Define unit stats.
|
|||
box_size attack_range computer_reaction_range human_reaction_range armor
|
||||
priorty damage piercing_damge weapon_upgradable armor_upgradeable
|
||||
decay annoy_factor points missle corpse type right_mouse can_target
|
||||
flags sounds attack_sound)</code>
|
||||
repair_range flags sounds attack_sound)</code>
|
||||
|
||||
<dl>
|
||||
<dt>ident</dt>
|
||||
|
@ -325,6 +325,8 @@ F.E. '( 1 1 ), '( 2 2 ).
|
|||
<dd></dd>
|
||||
<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>
|
||||
|
@ -357,7 +359,7 @@ F.E. '( 1 1 ), '( 2 2 ).
|
|||
'corpse-human
|
||||
'type-land
|
||||
'right-attack
|
||||
'can-target-land
|
||||
'can-target-land
|
||||
;; flags
|
||||
'land-unit
|
||||
'can-attack
|
||||
|
|
|
@ -296,7 +296,7 @@ global void HandleActionBuild(Unit* unit)
|
|||
unit->Orders[0].Action=UnitActionRepair;
|
||||
unit->Orders[0].Goal=build;
|
||||
unit->Orders[0].X=unit->Orders[0].Y=-1;
|
||||
unit->Orders[0].RangeX=unit->Orders[0].RangeY=REPAIR_RANGE;
|
||||
unit->Orders[0].RangeX=unit->Orders[0].RangeY=unit->Type->RepairRange;
|
||||
unit->SubAction=0;
|
||||
unit->Wait=1;
|
||||
RefsDebugCheck( !build->Refs );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// _________ __ __
|
||||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
|
@ -285,7 +285,7 @@ global void HandleActionRepair(Unit* unit)
|
|||
//
|
||||
// Have reached target? FIXME: could use return value
|
||||
//
|
||||
if(goal&&MapDistanceToUnit(unit->X,unit->Y,goal)<=REPAIR_RANGE
|
||||
if(goal&&MapDistanceToUnit(unit->X,unit->Y,goal)<=unit->Type->RepairRange
|
||||
&&goal->HP<goal->Type->Stats->HitPoints) {
|
||||
unit->State=0;
|
||||
unit->SubAction=2;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// _________ __ __
|
||||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
|
@ -373,13 +373,13 @@ global void CommandRepair(Unit* unit,int x,int y,Unit* dest,int flush)
|
|||
order->Goal=dest;
|
||||
RefsDebugCheck( !dest->Refs );
|
||||
dest->Refs++;
|
||||
order->RangeX=order->RangeY=REPAIR_RANGE;
|
||||
order->RangeX=order->RangeY=unit->Type->RepairRange;
|
||||
}
|
||||
} else {
|
||||
order->X=x;
|
||||
order->Y=y;
|
||||
order->Goal=NoUnitP;
|
||||
order->RangeX=order->RangeY=REPAIR_RANGE;
|
||||
order->RangeX=order->RangeY=unit->Type->RepairRange;
|
||||
}
|
||||
order->Type=NULL;
|
||||
order->Arg1=NULL;
|
||||
|
@ -670,8 +670,8 @@ global void CommandBuildBuilding(Unit* unit,int x,int y
|
|||
order->X=x;
|
||||
order->Y=y;
|
||||
if(what->BuilderOutside) {
|
||||
order->RangeX=REPAIR_RANGE;
|
||||
order->RangeY=REPAIR_RANGE;
|
||||
order->RangeX=unit->Type->RepairRange;
|
||||
order->RangeY=unit->Type->RepairRange;
|
||||
} else {
|
||||
// If building inside, but be next to stop
|
||||
order->RangeX=1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// _________ __ __
|
||||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
|
@ -1519,7 +1519,7 @@ local int AiRepairBuilding(const UnitType* type,Unit* building)
|
|||
nunits = FindPlayerUnitsByType(AiPlayer->Player,type,table);
|
||||
for (num = i = 0; i < nunits; i++) {
|
||||
unit = table[i];
|
||||
if ( unit->Type->CanRepair &&
|
||||
if ( unit->Type->RepairRange &&
|
||||
(unit->Orders[0].Action==UnitActionResource ||
|
||||
unit->Orders[0].Action==UnitActionStill) &&
|
||||
unit->OrderCount==1 ) {
|
||||
|
@ -1569,7 +1569,7 @@ local int AiRepairBuilding(const UnitType* type,Unit* building)
|
|||
unit=table[i];
|
||||
DebugLevel2Fn("Have an unit to repair %d :)\n" _C_ UnitNumber(unit));
|
||||
|
||||
if( UnitReachable(unit,building,REPAIR_RANGE) ) {
|
||||
if( UnitReachable(unit,building,unit->Type->RepairRange) ) {
|
||||
CommandRepair(unit, 0, 0, building,FlushCommands);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// _________ __ __
|
||||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
|
@ -558,9 +558,6 @@ extern long isqrt(long num);
|
|||
/// How near could a depot be build to a resource
|
||||
#define RESOURCE_DISTANCE 3
|
||||
|
||||
/// How near we could repair an unit
|
||||
#define REPAIR_RANGE 1
|
||||
|
||||
//@}
|
||||
|
||||
#endif // !__STRATAGUS_H__
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// _________ __ __
|
||||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
|
@ -397,12 +397,14 @@
|
|||
**
|
||||
** Unit is able to attack.
|
||||
**
|
||||
** UnitType::CanRepair
|
||||
** UnitType::RepairRange
|
||||
**
|
||||
** Unit can repair buildings. It will use the actack animation.
|
||||
** It will heal 4 points for every repair cycle, and cost 1 of
|
||||
** each resource, alternatively(1 cycle wood, 1 cycle gold)
|
||||
** FIXME: The above should be more configurable.
|
||||
** If units have a repair range, they can repair, and this is the
|
||||
** distance.
|
||||
**
|
||||
** UnitType::BuilderOutside
|
||||
**
|
||||
|
@ -665,7 +667,7 @@ struct _unit_type_ {
|
|||
unsigned ShoreBuilding : 1; /// Building must be build on coast.
|
||||
unsigned CanCastSpell : 1; /// Unit is able to use spells.
|
||||
unsigned CanAttack : 1; /// Unit can attack.
|
||||
unsigned CanRepair : 1; /// Unit can repair .
|
||||
unsigned 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.
|
||||
// FIXME: n0body: AutoBuildRate not implemented.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// _________ __ __
|
||||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
|
@ -234,7 +234,7 @@ global void DoRightButton(int sx,int sy)
|
|||
}
|
||||
}
|
||||
// Go and repair
|
||||
if ( (unit->Type->CanRepair) && dest &&
|
||||
if ( (unit->Type->RepairRange) && dest &&
|
||||
(dest->Type->Building || dest->Type->Transporter) &&
|
||||
dest->HP < dest->Stats->HitPoints &&
|
||||
(dest->Player==unit->Player || IsAllied(dest->Player,dest)) ) {
|
||||
|
@ -777,7 +777,7 @@ local void SendRepair(int sx,int sy)
|
|||
(dest->Player==ThisPlayer||IsAllied(ThisPlayer,dest))) {
|
||||
for( i=0; i<NumSelected; ++i ) {
|
||||
unit=Selected[i];
|
||||
if( unit->Type->CanRepair ) {
|
||||
if( unit->Type->RepairRange ) {
|
||||
SendCommandRepair(unit,x,y,dest,!(KeyModifiers&ModifierShift));
|
||||
} else {
|
||||
DebugLevel0Fn("Non-worker repairs\n");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// _________ __ __
|
||||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
|
@ -375,9 +375,9 @@ local SCM CclDefineUnitType(SCM list)
|
|||
type->GroundAttack=1;
|
||||
} else if( gh_eq_p(value,gh_symbol2scm("can-attack")) ) {
|
||||
type->CanAttack=1;
|
||||
} else if( gh_eq_p(value,gh_symbol2scm("can-repair")) ) {
|
||||
type->CanRepair=1;
|
||||
|
||||
} else if( gh_eq_p(value,gh_symbol2scm("repair-range")) ) {
|
||||
type->RepairRange=gh_scm2int(gh_car(list));
|
||||
list=gh_cdr(list);
|
||||
} 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")) ) {
|
||||
|
@ -548,6 +548,7 @@ local SCM CclDefineUnitType(SCM list)
|
|||
} else {
|
||||
// FIXME: this leaves a half initialized unit-type
|
||||
printf("\n%s\n",type->Name);
|
||||
DebugCheck( 1 );
|
||||
errl("Unsupported tag",value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// _________ __ __
|
||||
// _________ __ __
|
||||
// / _____// |_____________ _/ |______ ____ __ __ ______
|
||||
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
|
||||
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
|
||||
|
@ -819,8 +819,8 @@ local void SaveUnitType(CLFile* file,const UnitType* type,int all)
|
|||
if( type->CanAttack ) {
|
||||
CLprintf(file," 'can-attack\n");
|
||||
}
|
||||
if( type->CanRepair ) {
|
||||
CLprintf(file," 'can-repair\n");
|
||||
if( type->RepairRange ) {
|
||||
CLprintf(file," 'repair-range %d\n",type->RepairRange);
|
||||
}
|
||||
if( type->CanTarget ) {
|
||||
CLprintf(file," ");
|
||||
|
|
Loading…
Add table
Reference in a new issue