The "Select next Factory", "Select next Cyborg Factory" and "Select next Research Factory" keybinds just move the camera
view to the next structure. They do not really select it. Now they do. When the "Select next Factory" key is pressed, the manufacture widgets are opened, and the next factory is selected. Closes ticket:826, patch by nux. git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8015 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
773c6f7a4e
commit
bd12285797
|
@ -1705,12 +1705,34 @@ void kf_ToggleWeather( void )
|
|||
// --------------------------------------------------------------------------
|
||||
void kf_SelectNextFactory(void)
|
||||
{
|
||||
STRUCTURE *psCurr;
|
||||
|
||||
selNextSpecifiedBuilding(REF_FACTORY);
|
||||
|
||||
//deselect factories of other types
|
||||
for(psCurr = apsStructLists[selectedPlayer]; psCurr; psCurr = psCurr->psNext)
|
||||
{
|
||||
if( psCurr->selected &&
|
||||
( (psCurr->pStructureType->type == REF_CYBORG_FACTORY) ||
|
||||
(psCurr->pStructureType->type == REF_VTOL_FACTORY) ) )
|
||||
{
|
||||
psCurr->selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (intCheckReticuleButEnabled(IDRET_MANUFACTURE))
|
||||
{
|
||||
setKeyButtonMapping(IDRET_MANUFACTURE);
|
||||
}
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
void kf_SelectNextResearch(void)
|
||||
{
|
||||
selNextSpecifiedBuilding(REF_RESEARCH);
|
||||
if (intCheckReticuleButEnabled(IDRET_RESEARCH))
|
||||
{
|
||||
setKeyButtonMapping(IDRET_RESEARCH);
|
||||
}
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
void kf_SelectNextPowerStation(void)
|
||||
|
@ -1720,7 +1742,25 @@ void kf_SelectNextPowerStation(void)
|
|||
// --------------------------------------------------------------------------
|
||||
void kf_SelectNextCyborgFactory(void)
|
||||
{
|
||||
STRUCTURE *psCurr;
|
||||
|
||||
selNextSpecifiedBuilding(REF_CYBORG_FACTORY);
|
||||
|
||||
//deselect factories of other types
|
||||
for(psCurr = apsStructLists[selectedPlayer]; psCurr; psCurr = psCurr->psNext)
|
||||
{
|
||||
if( psCurr->selected &&
|
||||
( (psCurr->pStructureType->type == REF_FACTORY) ||
|
||||
(psCurr->pStructureType->type == REF_VTOL_FACTORY) ) )
|
||||
{
|
||||
psCurr->selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (intCheckReticuleButEnabled(IDRET_MANUFACTURE))
|
||||
{
|
||||
setKeyButtonMapping(IDRET_MANUFACTURE);
|
||||
}
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ UDWORD selNameSelect ( char *droidName, UDWORD player, BOOL bOnScreen );
|
|||
|
||||
static DROID *psOldRD = NULL; // pointer to last selected repair unit
|
||||
static DROID *psOldNS = NULL;
|
||||
static STRUCTURE *psOldStruct = NULL;
|
||||
|
||||
UDWORD selDroidSelection( UDWORD player, SELECTION_CLASS droidClass,
|
||||
SELECTIONTYPE droidType, BOOL bOnScreen )
|
||||
|
@ -526,6 +525,7 @@ void selNextSpecifiedBuilding(UDWORD structType)
|
|||
{
|
||||
STRUCTURE *psCurr;
|
||||
STRUCTURE *psResult;
|
||||
STRUCTURE *psOldStruct;
|
||||
STRUCTURE *psFirst;
|
||||
BOOL bLaterInList;
|
||||
|
||||
|
@ -533,52 +533,54 @@ BOOL bLaterInList;
|
|||
ASSERT( structType>=REF_HQ && structType<=NUM_DIFF_BUILDINGS,
|
||||
"Invalid structure type in selNextSpecifiedBuilding" );
|
||||
|
||||
for(psCurr = apsStructLists[selectedPlayer], psFirst = NULL,psResult = NULL,bLaterInList = false;
|
||||
for(psCurr = apsStructLists[selectedPlayer], psFirst = NULL,psResult = NULL,psOldStruct=NULL,bLaterInList = false;
|
||||
psCurr && !psResult; psCurr = psCurr->psNext)
|
||||
{
|
||||
if( (psCurr->pStructureType->type == structType) &&
|
||||
(psCurr->status == SS_BUILT) )
|
||||
{
|
||||
if(psCurr->pStructureType->type == structType)
|
||||
if(!psFirst)
|
||||
{
|
||||
if(!psFirst)
|
||||
{
|
||||
psFirst = psCurr;
|
||||
}
|
||||
if(psCurr == psOldStruct)
|
||||
{
|
||||
bLaterInList = true;
|
||||
}
|
||||
if(!psOldStruct)
|
||||
{
|
||||
psResult = psCurr;
|
||||
}
|
||||
else if(psCurr!=psOldStruct && bLaterInList)
|
||||
{
|
||||
psResult = psCurr;
|
||||
}
|
||||
psFirst = psCurr;
|
||||
}
|
||||
if(psCurr->selected)
|
||||
{
|
||||
bLaterInList = true;
|
||||
psOldStruct=psCurr;
|
||||
}
|
||||
else if(bLaterInList)
|
||||
{
|
||||
psResult = psCurr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!psResult)
|
||||
if(!psResult)
|
||||
{
|
||||
if(psFirst)
|
||||
{
|
||||
if(psFirst)
|
||||
{
|
||||
psResult = psFirst;
|
||||
}
|
||||
psResult = psFirst;
|
||||
}
|
||||
}
|
||||
|
||||
if(psResult && !psResult->died)
|
||||
if(psResult && !psResult->died)
|
||||
{
|
||||
if(getWarCamStatus())
|
||||
{
|
||||
if(getWarCamStatus())
|
||||
{
|
||||
camToggleStatus();
|
||||
}
|
||||
setViewPos(map_coord(psResult->pos.x), map_coord(psResult->pos.y), false);
|
||||
psOldStruct = psResult;
|
||||
camToggleStatus();
|
||||
}
|
||||
else
|
||||
setViewPos(map_coord(psResult->pos.x), map_coord(psResult->pos.y), false);
|
||||
if(psOldStruct)
|
||||
{
|
||||
// Can't find required building
|
||||
addConsoleMessage("Cannot find required building!",LEFT_JUSTIFY,SYSTEM_MESSAGE);
|
||||
psOldStruct->selected = false;
|
||||
}
|
||||
psResult->selected = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can't find required building
|
||||
addConsoleMessage("Cannot find required building!",LEFT_JUSTIFY,SYSTEM_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue