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:
meep-eep
2006-03-10 07:57:29 +00:00
parent 65d09cbd7d
commit 92a27386af
3 changed files with 61 additions and 0 deletions
+3
View File
@@ -1,6 +1,9 @@
Changes towards version 0.6: 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) - RMPLIFIED PRECURSOR BOMB is now AMPLIFIED, from Vorn (bug #812)
-Michael -Michael
Changes towards version 0.5: Changes towards version 0.5:
- Innocent origiginal c&p bug fixed, from bpoint. - Innocent origiginal c&p bug fixed, from bpoint.
- Handle relative dirs in -C correctly, from Jan Lönnberg (part of bug #738). - Handle relative dirs in -C correctly, from Jan Lönnberg (part of bug #738).
+52
View File
@@ -63,6 +63,7 @@ debugKeyPressed (void)
{ {
// State modifying: // State modifying:
equipShip (); equipShip ();
resetCrewBattle ();
instantMove = !instantMove; instantMove = !instantMove;
showSpheres (); showSpheres ();
activateAllShips (); 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 */ #endif /* DEBUG */
+6
View File
@@ -19,6 +19,7 @@
#include "clock.h" #include "clock.h"
#include "planets/planets.h" #include "planets/planets.h"
#include "races.h"
#include "libs/compiler.h" #include "libs/compiler.h"
#include <stdio.h> #include <stdio.h>
@@ -141,6 +142,11 @@ const char *densityString (BYTE density);
const char *depositQualityString (BYTE quality); 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. // Move instantly across hyperspace/quasispace.