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

« back to all changes in this revision

Viewing changes to src/scriptai.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger, Paul Wise, Christoph Egger
  • Date: 2009-06-29 17:12:52 UTC
  • mfrom: (1.1.11 upstream) (2.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090629171252-5ddnlfg3zfchrega
Tags: 2.2.1+dfsg1-1
[ Paul Wise ]
* New upstream release (Closes: #534962)
* Adjust the flex build-depends to take account of the conflict
  with all the versions of flex 2.5.34 (LP: #372872)
* Make the -music Recommends more strict, 2.1 music doesn't work
  with 2.2.
* Upstream moved the downloads to sourceforge, update the watch file
* Bump Standards-Version, no changes needed
* Drop use of dh_desktop since it no longer does anything
* Recommend the new warzone2100-video package, version 2.2 or similar
* Mention the warzone2100 crash reports in the -dbg package description

[ Christoph Egger ]
* Replace CC-2.0 graphic from cybersphinx, create a new tarball
* Add myself to uploaders

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
        This file is part of Warzone 2100.
3
3
        Copyright (C) 1999-2004  Eidos Interactive
4
 
        Copyright (C) 2005-2007  Warzone Resurrection Project
 
4
        Copyright (C) 2005-2009  Warzone Resurrection Project
5
5
 
6
6
        Warzone 2100 is free software; you can redistribute it and/or modify
7
7
        it under the terms of the GNU General Public License as published by
399
399
                return false;
400
400
        }
401
401
 
402
 
        debug( LOG_NEVER, "scrOrderGroup: group %p (%d) order %d\n", psGroup, grpNumMembers(psGroup), order);
 
402
        debug(LOG_NEVER, "group %p (%u) order %d", psGroup, grpNumMembers(psGroup), order);
403
403
        orderGroup(psGroup, order);
404
404
 
405
405
        return true;
433
433
         || y < 0
434
434
         || y > world_coord(mapHeight))
435
435
        {
436
 
                ASSERT( false,
437
 
                        "scrOrderGroupLoc: Invalid location" );
 
436
                ASSERT(false, "Invalid map location (%d, %d), max is (%d, %d)", x, y, world_coord(mapWidth), world_coord(mapHeight));
438
437
                return false;
439
438
        }
440
439
 
441
 
        debug( LOG_NEVER, "scrOrderGroupLoc: group %p (%d) order %d (%d,%d)\n",
 
440
        debug(LOG_NEVER, "group %p (%u) order %d (%d,%d)",
442
441
                psGroup, grpNumMembers(psGroup), order, x,y);
443
442
        orderGroupLoc(psGroup, order, (UDWORD)x,(UDWORD)y);
444
443
 
477
476
                return false;
478
477
        }
479
478
 
480
 
        debug( LOG_NEVER, "scrOrderGroupObj: group %p (%d) order %d,  obj type %d player %d id %d\n",
 
479
        debug(LOG_NEVER, "group %p (%u) order %d,  obj type %d player %d id %d",
481
480
                psGroup, grpNumMembers(psGroup), order, psObj->type, psObj->player, psObj->id);
482
481
 
483
482
        orderGroupObj(psGroup, order, psObj);
508
507
                order != DORDER_DESTRUCT &&
509
508
                order != DORDER_RTR &&
510
509
                order != DORDER_RTB &&
511
 
                order != DORDER_RUN)
 
510
                order != DORDER_RUN &&
 
511
                order != DORDER_NONE )
512
512
        {
513
513
                ASSERT( false,
514
514
                        "scrOrderUnit: Invalid order" );
651
651
 
652
652
        // Don't allow scripts to order structure builds if players structure
653
653
        // limit has been reached.
654
 
        if(IsPlayerStructureLimitReached(psDroid->player) == false) {
 
654
        if (!IsPlayerStructureLimitReached(psDroid->player))
 
655
        {
 
656
                // HACK: FIXME: Looks like a script error in the player*.slo files
 
657
                // buildOnExactLocation() which references previously destroyed buildings from
 
658
                // _stat = rebuildStructStat[_count] causes this
 
659
                if (strcmp(psStats->pName, "A0ADemolishStructure") == 0)
 
660
                {
 
661
                        // I don't feel like spamming a ASSERT here, we *know* it is a issue. 
 
662
                        return true;
 
663
                }
 
664
 
655
665
                orderDroidStatsLoc(psDroid, order, psStats, (UDWORD)x,(UDWORD)y);
656
666
        }
657
667
 
1098
1108
        psPStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
1099
1109
        switch(psPStats->propulsionType)
1100
1110
        {
1101
 
        case WHEELED:
 
1111
        case PROPULSION_TYPE_WHEELED:
1102
1112
                mask |= SCR_DT_WHEEL;
1103
1113
                break;
1104
 
        case TRACKED:
 
1114
        case PROPULSION_TYPE_TRACKED:
1105
1115
                mask |= SCR_DT_TRACK;
1106
1116
                break;
1107
 
        case LEGGED:
1108
 
        case JUMP:
 
1117
        case PROPULSION_TYPE_LEGGED:
 
1118
        case PROPULSION_TYPE_JUMP:
1109
1119
                mask |= SCR_DT_LEGS;
1110
1120
                break;
1111
 
        case HOVER:
 
1121
        case PROPULSION_TYPE_HOVER:
1112
1122
                mask |= SCR_DT_HOVER;
1113
1123
                break;
1114
 
        case LIFT:
 
1124
        case PROPULSION_TYPE_LIFT:
1115
1125
                mask |= SCR_DT_VTOL;
1116
1126
                break;
1117
 
        case HALF_TRACKED:
 
1127
        case PROPULSION_TYPE_HALF_TRACKED:
1118
1128
                mask |= SCR_DT_HTRACK;
1119
1129
                break;
1120
 
        case PROPELLOR:
1121
 
        case SKI:
 
1130
        case PROPULSION_TYPE_PROPELLOR:
 
1131
                mask |= SCR_DT_PROPELLOR;
 
1132
                break;
 
1133
        case PROPULSION_TYPE_SKI:
1122
1134
        default:
1123
1135
                ASSERT( false,
1124
1136
                        "scrUnitTargetMask: unknown or invalid target unit propulsion type" );
1705
1717
                // vtol propulsion
1706
1718
                for(i=0;(i<numPropulsionStats);i++)
1707
1719
                {
1708
 
                        if((asPropulsionStats[i].propulsionType == LIFT)
 
1720
                        if((asPropulsionStats[i].propulsionType == PROPULSION_TYPE_LIFT)
1709
1721
                         && apCompLists[player][COMP_PROPULSION][i] == AVAILABLE)
1710
1722
                        {
1711
1723
                                scrFunctionResult.v.bval = true;
1917
1929
                        gX = (psGate->x1 + psGate->x2)/2;
1918
1930
                        gY = (psGate->y1 + psGate->y2)/2;
1919
1931
                        /* Estimate the distance to it */
1920
 
                        dist = dirtySqrt(x,y,gX,gY);
 
1932
                        dist = dirtyHypot(x - gX, y - gY);
1921
1933
                        /* Is it best we've found? */
1922
1934
                        if(dist<nearestSoFar && dist<30)
1923
1935
                        {