Fix indentation and remove some dead code.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3228 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-12-29 19:39:31 +00:00
parent 52aa90d200
commit 3550e701f6
3 changed files with 42 additions and 74 deletions

View File

@ -676,9 +676,7 @@ BOOL droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS])
{
CHECK_DROID(psDroid);
if(!driveDroidKilled(psDroid)) { // Tell the driver system it's gone.
}
driveDroidKilled(psDroid); // Tell the driver system it's gone.
//tell the power system its gone
powerDestroyObject((BASE_OBJECT *)psDroid);
@ -689,14 +687,6 @@ BOOL droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS])
return FALSE;
}
/* remove animation if present - do this when the droid is destroyed*/
/*if ( psDroid->psCurAnim != NULL )
{
bRet = animObj_Remove( psDroid->psCurAnim, psDroid->psCurAnim->psAnim->uwID );
ASSERT( bRet == TRUE, "droidRemove: animObj_Remove failed" );
psDroid->psCurAnim = NULL;
}*/
// leave the current formation if any
if (psDroid->sMove.psFormation)
{
@ -711,7 +701,7 @@ BOOL droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS])
psDroid->psGroup = NULL;
}
//reset the baseStruct
// reset the baseStruct
setDroidBase(psDroid, NULL);
// remove the droid from the cluster systerm
@ -722,7 +712,7 @@ BOOL droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS])
removeDroid(psDroid, pList);
//tell the power system its gone
// tell the power system it is gone
powerDestroyObject((BASE_OBJECT *)psDroid);
if (psDroid->player == selectedPlayer)
@ -730,7 +720,7 @@ BOOL droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS])
intRefreshScreen();
}
return TRUE;
return TRUE;
}
static void droidFlameFallCallback( ANIM_OBJECT * psObj )

View File

@ -47,8 +47,6 @@ UDWORD gridWidth, gridHeight;
GRID_ARRAY *apsMapGrid[GRID_MAXAREA];
#define GridIndex(a,b) (((b)*gridWidth) + (a))
//GRID_ARRAY *apsMapGrid[GRID_WIDTH][GRID_HEIGHT];
// which grid to garbage collect on next
SDWORD garbageX, garbageY;
@ -74,7 +72,6 @@ SDWORD gridObjRange(BASE_OBJECT *psObj);
// initialise the grid system
BOOL gridInitialise(void)
{
// memset(apsMapGrid, 0, sizeof(GRID_ARRAY *) * GRID_WIDTH * GRID_HEIGHT);
memset(apsMapGrid, 0, sizeof(GRID_ARRAY *) * GRID_MAXAREA);
garbageX = 0;
@ -97,13 +94,11 @@ void gridClear(void)
{
for(y = 0; y < gridHeight; ++y)
{
// for(psCurr = apsMapGrid[x][y]; psCurr; psCurr = psNext)
for(psCurr = apsMapGrid[GridIndex(x,y)]; psCurr != NULL; psCurr = psNext)
{
psNext = psCurr->psNext;
free(psCurr);
}
// apsMapGrid[x][y] = NULL;
apsMapGrid[GridIndex(x,y)] = NULL;
}
}
@ -239,7 +234,6 @@ void gridRemoveObject(BASE_OBJECT *psObj)
{
for(y = 0; y < gridHeight; y++)
{
// for (psCurr = apsMapGrid[x][y]; psCurr; psCurr = psCurr->psNext)
for (psCurr = apsMapGrid[GridIndex(x,y)]; psCurr; psCurr = psCurr->psNext)
{
for (i = 0; i < MAX_GRID_ARRAY_CHUNK; i++)
@ -269,7 +263,6 @@ void gridStartIterate(SDWORD x, SDWORD y)
x = x / GRID_UNITS;
y = y / GRID_UNITS;
// psIterateGrid = apsMapGrid[x][y];
psIterateGrid = apsMapGrid[GridIndex(x,y)];
iterateEntry = 0;
}
@ -341,7 +334,6 @@ void gridGarbageCollect(void)
BASE_OBJECT *psObj;
check = 0;
// psCheck = apsMapGrid[garbageX][garbageY];
psCheck = apsMapGrid[GridIndex(garbageX,garbageY)];
while (psCheck != NULL)
{
@ -350,7 +342,6 @@ void gridGarbageCollect(void)
{
// see if there is a duplicate element in the array
curr = 0;
// psCurr = apsMapGrid[garbageX][garbageY];
psCurr = apsMapGrid[GridIndex(garbageX,garbageY)];
while ( psCurr != NULL )
{
@ -391,7 +382,6 @@ void gridAddArrayObject(SDWORD x, SDWORD y, BASE_OBJECT *psObj)
// see if there is an empty slot in the currently allocated array
psPrev = NULL;
// for (psCurr = apsMapGrid[x][y]; psCurr; psCurr=psCurr->psNext)
for (psCurr = apsMapGrid[GridIndex(x,y)]; psCurr; psCurr=psCurr->psNext)
{
for(i=0; i<MAX_GRID_ARRAY_CHUNK; i++)
@ -421,7 +411,6 @@ void gridAddArrayObject(SDWORD x, SDWORD y, BASE_OBJECT *psObj)
// add the chunk to the end of the list
if (psPrev == NULL)
{
// apsMapGrid[x][y] = psNew;
apsMapGrid[GridIndex(x,y)] = psNew;
}
else
@ -437,7 +426,6 @@ void gridRemoveArrayObject(SDWORD x, SDWORD y, BASE_OBJECT *psObj)
GRID_ARRAY *psCurr;
SDWORD i;
// for (psCurr = apsMapGrid[x][y]; psCurr; psCurr = psCurr->psNext)
for (psCurr = apsMapGrid[GridIndex(x,y)]; psCurr; psCurr = psCurr->psNext)
{
for (i=0; i<MAX_GRID_ARRAY_CHUNK; i++)
@ -458,7 +446,6 @@ void gridCompactArray(SDWORD x, SDWORD y)
GRID_ARRAY *psDone, *psMove, *psPrev, *psNext;
SDWORD done, move;
// psDone = psMove = apsMapGrid[x][y];
psDone = psMove = apsMapGrid[GridIndex(x,y)];
done = move = 0;
@ -499,7 +486,6 @@ void gridCompactArray(SDWORD x, SDWORD y)
// now release any unused chunks
if (psPrev == NULL)
{
// apsMapGrid[x][y] = NULL;
apsMapGrid[GridIndex(x,y)] = NULL;
}
else
@ -528,7 +514,6 @@ void gridDisplayCoverage(BASE_OBJECT *psObj)
{
for(y = 0; y < gridHeight; y++)
{
// psCurr = apsMapGrid[x][y];
psCurr = apsMapGrid[GridIndex(x, y)];
i = 0;
while (psCurr != NULL)
@ -651,6 +636,3 @@ SDWORD gridObjRange(BASE_OBJECT *psObj)
return (TILE_UNITS * 20);
}

View File

@ -780,50 +780,46 @@ void orderUpdateDroid(DROID *psDroid)
}
break;
case DORDER_EMBARK:
//only place it can be trapped - in multiPlayer can only put cyborgs onto a Transporter
if (bMultiPlayer && !cyborgDroid(psDroid))
{
psDroid->order = DORDER_NONE;
// only place it can be trapped - in multiPlayer can only put cyborgs onto a Transporter
if (bMultiPlayer && !cyborgDroid(psDroid))
{
psDroid->order = DORDER_NONE;
actionDroid(psDroid, DACTION_NONE);
}
else
{
// don't want the droids to go into a formation for this order
if (psDroid->sMove.psFormation != NULL)
{
formationLeave(psDroid->sMove.psFormation, (BASE_OBJECT *)psDroid);
psDroid->sMove.psFormation = NULL;
}
}
else
{
// don't want the droids to go into a formation for this order
if (psDroid->sMove.psFormation != NULL)
{
formationLeave(psDroid->sMove.psFormation, (BASE_OBJECT *)psDroid);
psDroid->sMove.psFormation = NULL;
}
// Wait for the action to finish then assign to Transporter (if not already flying)
if ( (psDroid->psTarget == NULL) ||
//(((DROID *)psDroid->psTarget)->order != DORDER_NONE &&
//(((DROID *)psDroid->psTarget)->order != DORDER_GUARD)))
transporterFlying((DROID *)psDroid->psTarget))
{
psDroid->order = DORDER_NONE;
actionDroid(psDroid, DACTION_NONE);
}
else if ( (abs((SDWORD)psDroid->pos.x - (SDWORD)psDroid->psTarget->pos.x) < TILE_UNITS) &&
(abs((SDWORD)psDroid->pos.y - (SDWORD)psDroid->psTarget->pos.y) < TILE_UNITS) )
{
//if in multiPlayer, only want to process if this player's droid
if (!bMultiPlayer || psDroid->player == selectedPlayer)
{
//psDroid->order = DORDER_NONE;
transporterAddDroid((DROID *)psDroid->psTarget, psDroid);
//order the droid to stop so moveUpdateDroid does not process this unit
orderDroid(psDroid, DORDER_STOP);
setDroidTarget(psDroid, NULL);
psDroid->psTarStats = NULL;
secondarySetState(psDroid, DSO_RETURN_TO_LOC, DSS_NONE);
}
}
else if(psDroid->action == DACTION_NONE)
{
actionDroidLoc(psDroid, DACTION_MOVE, psDroid->psTarget->pos.x,psDroid->psTarget->pos.y);
}
}
// Wait for the action to finish then assign to Transporter (if not already flying)
if (psDroid->psTarget == NULL || transporterFlying((DROID *)psDroid->psTarget))
{
psDroid->order = DORDER_NONE;
actionDroid(psDroid, DACTION_NONE);
}
else if (abs((SDWORD)psDroid->pos.x - (SDWORD)psDroid->psTarget->pos.x) < TILE_UNITS
&& abs((SDWORD)psDroid->pos.y - (SDWORD)psDroid->psTarget->pos.y) < TILE_UNITS)
{
// if in multiPlayer, only want to process if this player's droid
if (!bMultiPlayer || psDroid->player == selectedPlayer)
{
transporterAddDroid((DROID *)psDroid->psTarget, psDroid);
// order the droid to stop so moveUpdateDroid does not process this unit
orderDroid(psDroid, DORDER_STOP);
setDroidTarget(psDroid, NULL);
psDroid->psTarStats = NULL;
secondarySetState(psDroid, DSO_RETURN_TO_LOC, DSS_NONE);
}
}
else if (psDroid->action == DACTION_NONE)
{
actionDroidLoc(psDroid, DACTION_MOVE, psDroid->psTarget->pos.x,psDroid->psTarget->pos.y);
}
}
// Do we need to clear the secondary order "DSO_EMBARK" here? (PD)
break;