~ubuntu-branches/ubuntu/lucid/warzone2100/lucid

« back to all changes in this revision

Viewing changes to src/ai.c

  • Committer: Bazaar Package Importer
  • Author(s): Paul Wise
  • Date: 2008-12-04 01:13:26 UTC
  • mfrom: (1.1.7 upstream) (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20081204011326-be9aos1swwhq2agu
Tags: 2.1.0~1.rc2-1
* New upstream release candidate
* Remove Linas Žvirblis from uploaders since he hasn't been
  heard from for a very long time.
* Improve the cross-build support slightly

Show diffs side-by-side

added added

removed removed

Lines of Context:
897
897
        {
898
898
                return;         // we should not order this droid around
899
899
        }
900
 
 
901
 
        lookForTarget = true;
902
 
        updateTarget = true;
903
 
 
 
900
        
 
901
        lookForTarget = false;
 
902
        updateTarget = false;
 
903
        
 
904
        // look for a target if doing nothing
 
905
        if (orderState(psDroid, DORDER_NONE) ||
 
906
                orderState(psDroid, DORDER_GUARD))
 
907
        {
 
908
                lookForTarget = true;
 
909
        }
 
910
        // but do not choose another target if doing anything while guarding
 
911
        if (orderState(psDroid, DORDER_GUARD) &&
 
912
                (psDroid->action != DACTION_NONE))
 
913
        {
 
914
                lookForTarget = false;
 
915
        }
 
916
        // except when self-repairing
 
917
        if (psDroid->action == DACTION_DROIDREPAIR &&
 
918
            psDroid->psActionTarget[0] == (BASE_OBJECT *)psDroid)
 
919
        {
 
920
                lookForTarget = true;
 
921
        }
904
922
        // don't look for a target if sulking
905
923
        if (psDroid->action == DACTION_SULK)
906
924
        {
907
925
                lookForTarget = false;
908
 
                updateTarget = false;
909
 
        }
910
 
        // don't look for a target if doing something else
911
 
        if (!orderState(psDroid, DORDER_NONE) &&
912
 
                !orderState(psDroid, DORDER_GUARD))
913
 
        {
914
 
                lookForTarget = false;
915
926
        }
916
927
 
917
928
        /* Only try to update target if already have some target */
918
 
        if (psDroid->action != DACTION_ATTACK &&
919
 
                psDroid->action != DACTION_MOVEFIRE &&
920
 
                psDroid->action != DACTION_MOVETOATTACK &&
921
 
                psDroid->action != DACTION_ROTATETOATTACK)
 
929
        if (psDroid->action == DACTION_ATTACK ||
 
930
                psDroid->action == DACTION_MOVEFIRE ||
 
931
                psDroid->action == DACTION_MOVETOATTACK ||
 
932
                psDroid->action == DACTION_ROTATETOATTACK)
922
933
        {
923
 
                updateTarget = false;
 
934
                updateTarget = true;
924
935
        }
925
936
 
926
937
        /* Don't update target if we are sent to attack and reached
962
973
                updateTarget = false;
963
974
        }
964
975
 
965
 
        // do not choose another target if doing anything while guarding
966
 
        if (orderState(psDroid, DORDER_GUARD) &&
967
 
                (psDroid->action != DACTION_NONE))
968
 
        {
969
 
                lookForTarget = false;
970
 
        }
971
 
 
972
976
        // do not look for a target if droid is currently under direct control.
973
977
        if(driveModeActive() && (psDroid == driveGetDriven())) {
974
978
                lookForTarget = false;