Merge branch 'bugfixes'
commit
c3de482ab6
|
@ -10,7 +10,7 @@ SYNOPSIS
|
|||
--------
|
||||
*warzone2100* ['OPTIONS']
|
||||
|
||||
DESCIPTION
|
||||
DESCRIPTION
|
||||
----------
|
||||
|
||||
This manual page documents briefly the warzone2100 command.
|
||||
|
|
|
@ -2607,17 +2607,9 @@ STRUCTURE *psStructure;
|
|||
}
|
||||
// If this building is a factory/power generator/research facility
|
||||
// which isn't upgraded. Make the build icon available.
|
||||
else if(((psStructure->pStructureType->type == REF_FACTORY
|
||||
|| psStructure->pStructureType->type == REF_VTOL_FACTORY)
|
||||
&& psStructure->pFunctionality->factory.capacity < NUM_FACTORY_MODULES)
|
||||
|
||||
|| (psStructure->pStructureType->type == REF_POWER_GEN
|
||||
&& psStructure->pFunctionality->powerGenerator.capacity < NUM_POWER_MODULES)
|
||||
|
||||
|| (psStructure->pStructureType->type == REF_RESEARCH
|
||||
&& psStructure->pFunctionality->researchFacility.capacity < NUM_RESEARCH_MODULES))
|
||||
else if (nextModuleToBuild(psStructure, -1) > 0)
|
||||
{
|
||||
retVal = MT_OWNSTRINCOMP;
|
||||
retVal = MT_OWNSTRINCOMP;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1092,7 +1092,6 @@ static void updateGraviton(EFFECT *psEffect)
|
|||
{
|
||||
float accel;
|
||||
Vector3i dv;
|
||||
UDWORD groundHeight;
|
||||
MAPTILE *psTile;
|
||||
LIGHT light;
|
||||
|
||||
|
@ -1125,7 +1124,7 @@ static void updateGraviton(EFFECT *psEffect)
|
|||
return;
|
||||
}
|
||||
|
||||
groundHeight = map_Height(psEffect->position.x, psEffect->position.z);
|
||||
int groundHeight = map_Height(psEffect->position.x, psEffect->position.z);
|
||||
|
||||
/* If it's going up and it's still under the landscape, then remove it... */
|
||||
if (psEffect->position.y<groundHeight
|
||||
|
|
|
@ -984,6 +984,7 @@ void intRunOrder(void)
|
|||
//
|
||||
static bool SetSecondaryState(SECONDARY_ORDER sec, unsigned State)
|
||||
{
|
||||
// This code is similar to kfsf_SetSelectedDroidsState() in keybind.cpp. Unfortunately, it seems hard to un-duplicate the code.
|
||||
for (unsigned i = 0; i < SelectedDroids.size(); ++i)
|
||||
{
|
||||
if (SelectedDroids[i])
|
||||
|
|
|
@ -2435,9 +2435,11 @@ static void kfsf_SetSelectedDroidsState( SECONDARY_ORDER sec, SECONDARY_STATE st
|
|||
// This is a function to set unit orders via keyboard shortcuts. It should
|
||||
// _not_ be disallowed in multiplayer games.
|
||||
|
||||
// This code is similar to SetSecondaryState() in intorder.cpp. Unfortunately, it seems hard to un-duplicate the code.
|
||||
for(psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
|
||||
{
|
||||
if(psDroid->selected)
|
||||
// Only set the state if it's not a transporter.
|
||||
if (psDroid->selected && psDroid->droidType != DROID_TRANSPORTER && psDroid->droidType != DROID_SUPERTRANSPORTER)
|
||||
{
|
||||
secondarySetState(psDroid,sec,state);
|
||||
}
|
||||
|
|
|
@ -1449,12 +1449,12 @@ static void addGameOptions()
|
|||
IMAGE_EDIT_GAME_HI, MULTIOP_GNAME_ICON);
|
||||
// disable for one-player skirmish
|
||||
widgSetButtonState(psWScreen, MULTIOP_GNAME, WEDBS_DISABLE);
|
||||
widgSetButtonState(psWScreen, MULTIOP_GNAME_ICON, WBUT_DISABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
addMultiEditBox(MULTIOP_OPTIONS, MULTIOP_GNAME, MCOL0, MROW2, _("Select Game Name"), game.name, IMAGE_EDIT_GAME, IMAGE_EDIT_GAME_HI, MULTIOP_GNAME_ICON);
|
||||
}
|
||||
widgSetButtonState(psWScreen, MULTIOP_GNAME_ICON, WBUT_DISABLE);
|
||||
// map chooser
|
||||
addMultiEditBox(MULTIOP_OPTIONS, MULTIOP_MAP , MCOL0, MROW3, _("Select Map"), game.map, IMAGE_EDIT_MAP, IMAGE_EDIT_MAP_HI, MULTIOP_MAP_ICON);
|
||||
// disable for challenges
|
||||
|
|
|
@ -1570,6 +1570,12 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
|
|||
actionDroid(psDroid, DACTION_OBSERVE, psOrder->psObj);
|
||||
break;
|
||||
case DORDER_FIRESUPPORT:
|
||||
if (psDroid->droidType == DROID_TRANSPORTER || psDroid->droidType == DROID_SUPERTRANSPORTER)
|
||||
{
|
||||
debug(LOG_ERROR, "Sorry, transports cannot be assigned to commanders.");
|
||||
psDroid->order = DroidOrder(DORDER_NONE);
|
||||
break;
|
||||
}
|
||||
if (psDroid->asWeaps[0].nStat == 0)
|
||||
{
|
||||
break;
|
||||
|
@ -1587,6 +1593,12 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
|
|||
}
|
||||
break;
|
||||
case DORDER_COMMANDERSUPPORT:
|
||||
if (psDroid->droidType == DROID_TRANSPORTER || psDroid->droidType == DROID_SUPERTRANSPORTER)
|
||||
{
|
||||
debug(LOG_ERROR, "Sorry, transports cannot be assigned to commanders.");
|
||||
psDroid->order = DroidOrder(DORDER_NONE);
|
||||
break;
|
||||
}
|
||||
cmdDroidAddDroid((DROID *)psOrder->psObj, psDroid);
|
||||
break;
|
||||
case DORDER_RETREAT:
|
||||
|
@ -1747,11 +1759,21 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
|
|||
}
|
||||
break;
|
||||
case DORDER_EMBARK:
|
||||
{
|
||||
DROID *embarkee = castDroid(psOrder->psObj);
|
||||
if (psDroid->droidType == DROID_TRANSPORTER || psDroid->droidType == DROID_SUPERTRANSPORTER // Embarker must not be transporter.
|
||||
|| embarkee == NULL || !(embarkee->droidType == DROID_TRANSPORTER || embarkee->droidType == DROID_SUPERTRANSPORTER)) // Embarkee must be a transporter.
|
||||
{
|
||||
debug(LOG_ERROR, "Sorry, can only load things that aren't transporters into things that are.");
|
||||
psDroid->order = DroidOrder(DORDER_NONE);
|
||||
break;
|
||||
}
|
||||
// move the droid to the transporter location
|
||||
psDroid->order = *psOrder;
|
||||
psDroid->order.pos = removeZ(psOrder->psObj->pos);
|
||||
actionDroid(psDroid, DACTION_MOVE, psOrder->psObj->pos.x, psOrder->psObj->pos.y);
|
||||
break;
|
||||
}
|
||||
case DORDER_DISEMBARK:
|
||||
//only valid in multiPlayer mode
|
||||
if (bMultiPlayer)
|
||||
|
@ -2578,19 +2600,19 @@ DroidOrder chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj, bool altOrder)
|
|||
|
||||
if (altOrder && (psObj->type == OBJ_DROID || psObj->type == OBJ_STRUCTURE) && psDroid->player == psObj->player)
|
||||
{
|
||||
if ((psDroid->droidType == DROID_WEAPON) || cyborgDroid(psDroid) ||
|
||||
(psDroid->droidType == DROID_COMMAND))
|
||||
{
|
||||
return DroidOrder(DORDER_ATTACK, psObj);
|
||||
}
|
||||
else if (psDroid->droidType == DROID_SENSOR)
|
||||
if (psDroid->droidType == DROID_SENSOR)
|
||||
{
|
||||
return DroidOrder(DORDER_OBSERVE, psObj);
|
||||
}
|
||||
else if ((psDroid->droidType == DROID_REPAIR ||
|
||||
psDroid->droidType == DROID_CYBORG_REPAIR) && psObj->type == OBJ_DROID)
|
||||
{
|
||||
return DroidOrder(DORDER_REPAIR, psObj);
|
||||
return DroidOrder(DORDER_DROIDREPAIR, psObj);
|
||||
}
|
||||
else if ((psDroid->droidType == DROID_WEAPON) || cyborgDroid(psDroid) ||
|
||||
(psDroid->droidType == DROID_COMMAND))
|
||||
{
|
||||
return DroidOrder(DORDER_ATTACK, psObj);
|
||||
}
|
||||
}
|
||||
//check for transporters first
|
||||
|
|
|
@ -115,7 +115,7 @@ static unsigned int selSelectAllSameDroid(unsigned int player, DROID_TYPE droidT
|
|||
if (!bOnScreen || droidOnScreen(psDroid, 0))
|
||||
{
|
||||
/* Same as the droid type asked for*/
|
||||
if (psDroid->droidType == droidType)
|
||||
if (psDroid->droidType == droidType || (droidType == DROID_TRANSPORTER && psDroid->droidType == DROID_SUPERTRANSPORTER))
|
||||
{
|
||||
SelectDroid(psDroid);
|
||||
count++;
|
||||
|
|
|
@ -2094,7 +2094,8 @@ void assignFactoryCommandDroid(STRUCTURE *psStruct, DROID *psCommander)
|
|||
}
|
||||
|
||||
psFact->psCommander = NULL;
|
||||
syncDebug("Removed commander from factory %d", psStruct->id);
|
||||
// TODO: Synchronise .psCommander.
|
||||
//syncDebug("Removed commander from factory %d", psStruct->id);
|
||||
if (!missionIsOffworld())
|
||||
{
|
||||
addFlagPosition(psFact->psAssemblyPoint); // add the assembly point back into the list
|
||||
|
@ -2422,18 +2423,29 @@ static bool structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
|
|||
assignCommander = true;
|
||||
}
|
||||
|
||||
if ( psFact->psCommander != NULL )
|
||||
bool isTransporter = psNewDroid->droidType == DROID_TRANSPORTER || psNewDroid->droidType == DROID_SUPERTRANSPORTER;
|
||||
if (isVtolDroid(psNewDroid) && !isTransporter)
|
||||
{
|
||||
syncDebug("Has commander.");
|
||||
if (idfDroid(psNewDroid) ||
|
||||
moveToRearm(psNewDroid);
|
||||
}
|
||||
if (psFact->psCommander != NULL && myResponsibility(psStructure->player))
|
||||
{
|
||||
// TODO: Should synchronise .psCommander in all cases.
|
||||
//syncDebug("Has commander.");
|
||||
if (isTransporter)
|
||||
{
|
||||
// Transporters can't be assigned to commanders, due to abuse of .psGroup. Try to land on the commander instead. Hopefully the transport is heavy enough to crush the commander.
|
||||
orderDroidLoc(psNewDroid, DORDER_MOVE, psFact->psCommander->pos.x, psFact->psCommander->pos.y, ModeQueue);
|
||||
}
|
||||
else if (idfDroid(psNewDroid) ||
|
||||
isVtolDroid(psNewDroid))
|
||||
{
|
||||
orderDroidObj(psNewDroid, DORDER_FIRESUPPORT, psFact->psCommander, ModeImmediate);
|
||||
moveToRearm(psNewDroid);
|
||||
orderDroidObj(psNewDroid, DORDER_FIRESUPPORT, psFact->psCommander, ModeQueue);
|
||||
//moveToRearm(psNewDroid);
|
||||
}
|
||||
else
|
||||
{
|
||||
orderDroidObj(psNewDroid, DORDER_COMMANDERSUPPORT, psFact->psCommander, ModeImmediate);
|
||||
orderDroidObj(psNewDroid, DORDER_COMMANDERSUPPORT, psFact->psCommander, ModeQueue);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2450,10 +2462,6 @@ static bool structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
|
|||
}
|
||||
//if vtol droid - send it to ReArm Pad if one exists
|
||||
placed = false;
|
||||
if (isVtolDroid(psNewDroid) && (psNewDroid->droidType != DROID_TRANSPORTER && psNewDroid->droidType != DROID_SUPERTRANSPORTER))
|
||||
{
|
||||
moveToRearm(psNewDroid);
|
||||
}
|
||||
if (!placed)
|
||||
{
|
||||
//find flag in question.
|
||||
|
@ -2498,13 +2506,19 @@ static bool structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
|
|||
|
||||
static bool IsFactoryCommanderGroupFull(const FACTORY* psFactory)
|
||||
{
|
||||
if (bMultiPlayer)
|
||||
{
|
||||
// TODO: Synchronise .psCommander. Have to return false here, to avoid desynch.
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int DroidsInGroup;
|
||||
|
||||
// If we don't have a commander return false (group not full)
|
||||
if (psFactory->psCommander==NULL) return false;
|
||||
|
||||
// allow any number of IDF droids
|
||||
if (templateIsIDF((DROID_TEMPLATE *)psFactory->psSubject))
|
||||
if (templateIsIDF(psFactory->psSubject) || asPropulsionStats[psFactory->psSubject->asParts[COMP_PROPULSION]].propulsionType == PROPULSION_TYPE_LIFT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue