Fix to gathering script

This was SVN commit r2142.
This commit is contained in:
MarkT 2005-04-16 16:05:49 +00:00
parent a10ac6b379
commit 26d3f69ebf

View File

@ -135,7 +135,7 @@ function entity_event_targetchanged( evt )
( evt.target.traits.id.civ_code.toString() != this.traits.id.civ_code.toString() ) ) ( evt.target.traits.id.civ_code.toString() != this.traits.id.civ_code.toString() ) )
evt.defaultAction = ORDER_ATTACK; evt.defaultAction = ORDER_ATTACK;
if( this.actions.gather && evt.target.traits.supply && if( this.actions.gather && evt.target.traits.supply &&
this.actions.gather.valueOf()[evt.target.traits.supply.type] && this.actions.gather[evt.target.traits.supply.type] &&
( ( evt.target.traits.supply.curr > 0 ) || ( evt.target.traits.supply.max == 0 ) ) ) ( ( evt.target.traits.supply.curr > 0 ) || ( evt.target.traits.supply.max == 0 ) ) )
evt.defaultAction = ORDER_GATHER; evt.defaultAction = ORDER_GATHER;
} }
@ -166,9 +166,10 @@ function entity_event_prepareorder( evt )
break; break;
case ORDER_GATHER: case ORDER_GATHER:
if( !this.actions.gather || if( !this.actions.gather ||
!this.actions.gather.valueOf()[evt.target.traits.supply.type] || !( this.actions.gather[evt.target.traits.supply.type] ) ||
( ( evt.target.traits.supply.curr == 0 ) && ( evt.target.traits.supply.max > 0 ) ) ) ( ( evt.target.traits.supply.curr == 0 ) && ( evt.target.traits.supply.max > 0 ) ) )
evt.preventDefault(); evt.preventDefault();
break;
default: default:
evt.preventDefault(); evt.preventDefault();
} }