Disentangled ESCORT_WORTH and ESCORTING_FLAGSHIP for better readability

and to get rid of a warning.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1392 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2004-06-17 05:03:28 +00:00
parent 2f84f38c4b
commit 7e5fd86b2c
+23 -17
View File
@@ -123,38 +123,44 @@ ActivateStarShip (COUNT which_ship, SIZE state)
return (which_ship);
}
case ESCORT_WORTH:
which_ship = 0;
case ESCORTING_FLAGSHIP:
{
COUNT ShipCost[] =
{
RACE_SHIP_COST
};
COUNT total = 0;
for (hStarShip = GetHeadLink (&GLOBAL (built_ship_q));
hStarShip; hStarShip = hNextShip)
{
SHIP_FRAGMENTPTR StarShipPtr;
StarShipPtr = (SHIP_FRAGMENTPTR) LockStarShip (
&GLOBAL (built_ship_q), hStarShip);
hNextShip = _GetSuccLink (StarShipPtr);
total += ShipCost[GET_RACE_ID (StarShipPtr)];
UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);
}
return total;
}
case ESCORTING_FLAGSHIP:
{
for (hStarShip = GetHeadLink (&GLOBAL (built_ship_q));
hStarShip; hStarShip = hNextShip)
{
BYTE ship_type;
SHIP_FRAGMENTPTR StarShipPtr;
StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (built_ship_q), hStarShip
);
StarShipPtr = (SHIP_FRAGMENTPTR) LockStarShip (
&GLOBAL (built_ship_q), hStarShip);
hNextShip = _GetSuccLink (StarShipPtr);
if (state == ESCORT_WORTH)
which_ship += ShipCost[GET_RACE_ID (StarShipPtr)];
else
ship_type = GET_RACE_ID (StarShipPtr);
UnlockStarShip (
&GLOBAL (built_ship_q), hStarShip
);
ship_type = GET_RACE_ID (StarShipPtr);
UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);
if (state != ESCORT_WORTH
&& (COUNT)ship_type == which_ship)
return (1);
if ((COUNT) ship_type == which_ship)
return 1;
}
return (state == ESCORTING_FLAGSHIP ? 0 : which_ship);
return 0;
}
case FEASIBILITY_STUDY:
return (MAX_BUILT_SHIPS