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

« back to all changes in this revision

Viewing changes to src/formation.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
84
84
 
85
85
        while (psFormationList)
86
86
        {
87
 
                debug( LOG_NEVER, "formation with %d units still attached\n", psFormationList->refCount );
 
87
                debug(LOG_NEVER, "formation with %d units still attached", psFormationList->refCount);
88
88
                psNext = psFormationList->psNext;
89
89
                free(psFormationList);
90
90
                psFormationList = psNext;
100
100
        FORMATION       *psNew = malloc(sizeof(FORMATION));
101
101
 
102
102
        // get a heap structure
 
103
        ASSERT(psNew, "Out of memory");
103
104
        if (psNew == NULL)
104
105
        {
105
 
                debug(LOG_ERROR, "formationNew: Out of memory");
106
106
                return false;
107
107
        }
108
108
 
109
 
//      debug( LOG_NEVER, "formationNew: type %d, at (%d,%d), dir %d\n", type, x, y, dir );
 
109
        // debug(LOG_NEVER, "type %d, at (%d,%d), dir %d", type, x, y, dir);
110
110
 
111
111
        // initialise it
112
112
        psNew->refCount = 0;
170
170
 
171
171
        for (psFormation = psFormationList; psFormation; psFormation = psFormation->psNext)
172
172
        {
173
 
                // see if the positioin is close to the formation
 
173
                // see if the position is close to the formation
174
174
                const int xdiff = psFormation->x - x;
175
175
                const int ydiff = psFormation->y - y;
176
176
                const int distSq = xdiff*xdiff + ydiff*ydiff;
223
223
        ASSERT( psFormation != NULL,
224
224
                "formationJoin: invalid formation" );
225
225
 
226
 
//      debug( LOG_NEVER, "formationJoin: %p, obj %d\n", psFormation, psObj->id );
227
 
 
228
226
        psFormation->refCount += 1;
229
227
 
230
228
        rankDist = formationObjRadius(psDroid) * 2;
257
255
        ASSERT( psFormation->refCount > 0,
258
256
                "formationLeave: refcount is zero" );
259
257
 
260
 
//      debug( LOG_NEVER, "formationLeave: %p, obj %d\n", psFormation, psDroid->id );
261
 
 
262
258
        asMembers = psFormation->asMembers;
263
259
 
264
260
        // see if the unit is a member
433
429
                        {
434
430
                                // calculate the position on the line
435
431
                                formationCalcPos(psFormation, line, currDist+objRadius, &x,&y);
436
 
                                if (fpathBlockingTile(map_coord(x), map_coord(y)))
 
432
                                if (fpathBlockingTile(map_coord(x), map_coord(y), getPropulsionStats(psDroid)->propulsionType))
437
433
                                {
438
434
                                        // blocked, try the next rank
439
435
                                        found = false;
627
623
                }
628
624
 
629
625
                // calculate its position
630
 
                formationCalcPos(psFormation, asMembers[member].line, asMembers[member].dist,
631
 
                                                        &x,&y);
632
 
/*              // a unit has just joined the formation - find a location for it
633
 
                formationFindFree(psFormation, psDroid, &x,&y);
634
 
                debug( LOG_NEVER, "formation new member : (%d, %d)n",
635
 
                                        x,y));*/
 
626
                formationCalcPos(psFormation, asMembers[member].line, asMembers[member].dist, &x, &y);
636
627
        }
637
628
        else
638
629
        {