Debugging function to add crew during battle.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2266 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
Changes towards version 0.6:
|
||||
- Debugging function to add crew during battle. - SvdB
|
||||
- More documentation - SvdB.
|
||||
- RMPLIFIED PRECURSOR BOMB is now AMPLIFIED, from Vorn (bug #812)
|
||||
-Michael
|
||||
|
||||
Changes towards version 0.5:
|
||||
- Innocent origiginal c&p bug fixed, from bpoint.
|
||||
- Handle relative dirs in -C correctly, from Jan Lönnberg (part of bug #738).
|
||||
|
||||
@@ -63,6 +63,7 @@ debugKeyPressed (void)
|
||||
{
|
||||
// State modifying:
|
||||
equipShip ();
|
||||
resetCrewBattle ();
|
||||
instantMove = !instantMove;
|
||||
showSpheres ();
|
||||
activateAllShips ();
|
||||
@@ -1234,6 +1235,57 @@ depositQualityString (BYTE quality)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Which should be GOOD_GUY or BAD_GUY
|
||||
STARSHIPPTR
|
||||
findPlayerShip(ELEMENT_FLAGS which) {
|
||||
HELEMENT hElement, hNextElement;
|
||||
|
||||
for (hElement = GetHeadElement (); hElement; hElement = hNextElement)
|
||||
{
|
||||
ELEMENTPTR ElementPtr;
|
||||
|
||||
LockElement (hElement, &ElementPtr);
|
||||
hNextElement = GetSuccElement (ElementPtr);
|
||||
|
||||
if ((ElementPtr->state_flags & PLAYER_SHIP) &&
|
||||
(ElementPtr->state_flags & (GOOD_GUY | BAD_GUY)) == which)
|
||||
{
|
||||
STARSHIPPTR StarShipPtr;
|
||||
GetElementStarShip (ElementPtr, &StarShipPtr);
|
||||
UnlockElement (hElement);
|
||||
return StarShipPtr;
|
||||
}
|
||||
|
||||
UnlockElement (hElement);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
resetCrewBattle(void) {
|
||||
STARSHIPPTR StarShipPtr;
|
||||
COUNT delta;
|
||||
CONTEXT OldContext;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & IN_BATTLE))
|
||||
return;
|
||||
|
||||
StarShipPtr = findPlayerShip (GOOD_GUY);
|
||||
if (StarShipPtr == NULL || StarShipPtr->RaceDescPtr == NULL)
|
||||
return;
|
||||
|
||||
delta = StarShipPtr->RaceDescPtr->ship_info.max_crew -
|
||||
StarShipPtr->RaceDescPtr->ship_info.crew_level;
|
||||
|
||||
OldContext = SetContext (StatusContext);
|
||||
DeltaCrew (StarShipPtr->hShip, delta);
|
||||
SetContext (OldContext);
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "clock.h"
|
||||
#include "planets/planets.h"
|
||||
#include "races.h"
|
||||
#include "libs/compiler.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -141,6 +142,11 @@ const char *densityString (BYTE density);
|
||||
const char *depositQualityString (BYTE quality);
|
||||
|
||||
|
||||
// Find a player ship. Setting which to BAD_GUY is only meaningful in battle.
|
||||
STARSHIPPTR findPlayerShip(ELEMENT_FLAGS which);
|
||||
|
||||
// Resets the crew of the first player (the bottom one) to its maximum.
|
||||
void resetCrewBattle(void);
|
||||
|
||||
|
||||
// Move instantly across hyperspace/quasispace.
|
||||
|
||||
Reference in New Issue
Block a user