Fix: if no squad name is provided in xml, fall back on hardcoded name

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8867 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2020-07-15 21:23:53 +00:00
parent e14444f14a
commit ce61a0b85b
15 changed files with 94 additions and 103 deletions
+13 -5
View File
@@ -968,6 +968,8 @@ template<> void DropDownTemplate<DROPDOWNNR_MERCCOMPARE_SQUADSELECTION>::SetRefr
fMercCompareMatrixRedraw = TRUE; fMercCompareMatrixRedraw = TRUE;
} }
CHAR16 sSquadString[NUMBER_OF_SQUADS][80];
BOOLEAN EnterMercCompareMatrix( ) BOOLEAN EnterMercCompareMatrix( )
{ {
InitDefaults( ); InitDefaults( );
@@ -976,7 +978,7 @@ BOOLEAN EnterMercCompareMatrix( )
std::vector<std::pair<INT16, STR16> > dropdownvector; std::vector<std::pair<INT16, STR16> > dropdownvector;
// create a map of all current squads with at least 2 members // create a map of all current squads with at least 2 members
std::map<UINT8, UINT8> squadmap; std::map<INT16, INT16> squadmap;
SOLDIERTYPE* pSoldier = NULL; SOLDIERTYPE* pSoldier = NULL;
UINT16 id = gTacticalStatus.Team[gbPlayerNum].bFirstID; UINT16 id = gTacticalStatus.Team[gbPlayerNum].bFirstID;
@@ -992,16 +994,22 @@ BOOLEAN EnterMercCompareMatrix( )
} }
} }
std::map<UINT8, UINT8>::iterator itend = squadmap.end(); int squadcnt = 0;
for ( std::map<UINT8, UINT8>::iterator it = squadmap.begin(); it != itend; ++it ) for ( std::map<INT16, INT16>::iterator it = squadmap.begin(), itend = squadmap.end(); it != itend; ++it )
{ {
if ( (*it).second > 1 ) if ( (*it).second > 1 )
{ {
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && ( *it ).first < gSquadNameVector.size() )
dropdownvector.push_back( std::make_pair( (*it).first, SquadNames[(*it).first].squadname ) ); {
swprintf( sSquadString[squadcnt], L"%s", gSquadNameVector[( *it ).first].c_str() );
dropdownvector.push_back( std::make_pair( ( *it ).first, sSquadString[squadcnt] ) );
}
else else
dropdownvector.push_back( std::make_pair( (*it).first, pSquadMenuStrings[(*it).first] ) ); dropdownvector.push_back( std::make_pair( (*it).first, pSquadMenuStrings[(*it).first] ) );
} }
++squadcnt;
} }
if ( !dropdownvector.empty() ) if ( !dropdownvector.empty() )
+2 -2
View File
@@ -1287,8 +1287,8 @@ void DisplayCharName( INT32 iId, INT32 iSlot )
//Display the mercs name //Display the mercs name
mprintf( sX + iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y, sString ); mprintf( sX + iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y, sString );
if ( Menptr[iId].bAssignment < ON_DUTY && gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && Menptr[iId].bAssignment < min(ON_DUTY, gSquadNameVector.size() ) )
swprintf( sString, L"%s", SquadNames[ Menptr[iId].bAssignment ].squadname); swprintf( sString, L"%s", gSquadNameVector[Menptr[iId].bAssignment].c_str() );
else else
swprintf( sString, L"%s", pPersonnelAssignmentStrings[Menptr[iId].bAssignment]); swprintf( sString, L"%s", pPersonnelAssignmentStrings[Menptr[iId].bAssignment]);
+10 -10
View File
@@ -12957,8 +12957,8 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
switch( bCanJoinSquad ) switch( bCanJoinSquad )
{ {
case CHARACTER_CANT_JOIN_SQUAD_SQUAD_MOVING: case CHARACTER_CANT_JOIN_SQUAD_SQUAD_MOVING:
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && iValue < gSquadNameVector.size() )
swprintf( sString, pMapErrorString[ 36 ], pSoldier->GetName(), SquadNames[ iValue ].squadname ); swprintf( sString, pMapErrorString[ 36 ], pSoldier->GetName(), gSquadNameVector[iValue].c_str() );
else else
swprintf( sString, pMapErrorString[ 36 ], pSoldier->GetName(), pLongAssignmentStrings[ iValue ] ); swprintf( sString, pMapErrorString[ 36 ], pSoldier->GetName(), pLongAssignmentStrings[ iValue ] );
break; break;
@@ -12966,14 +12966,14 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
swprintf( sString, pMapErrorString[ 37 ], pSoldier->GetName() ); swprintf( sString, pMapErrorString[ 37 ], pSoldier->GetName() );
break; break;
case CHARACTER_CANT_JOIN_SQUAD_TOO_FAR: case CHARACTER_CANT_JOIN_SQUAD_TOO_FAR:
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && iValue < gSquadNameVector.size() )
swprintf( sString, pMapErrorString[ 20 ], pSoldier->GetName(), SquadNames[ iValue ].squadname ); swprintf( sString, pMapErrorString[ 20 ], pSoldier->GetName(), gSquadNameVector[iValue].c_str() );
else else
swprintf( sString, pMapErrorString[ 20 ], pSoldier->GetName(), pLongAssignmentStrings[ iValue ] ); swprintf( sString, pMapErrorString[ 20 ], pSoldier->GetName(), pLongAssignmentStrings[ iValue ] );
break; break;
case CHARACTER_CANT_JOIN_SQUAD_FULL: case CHARACTER_CANT_JOIN_SQUAD_FULL:
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && iValue < gSquadNameVector.size() )
swprintf( sString, pMapErrorString[ 19 ], pSoldier->GetName(), SquadNames[ iValue ].squadname ); swprintf( sString, pMapErrorString[ 19 ], pSoldier->GetName(), gSquadNameVector[iValue].c_str() );
else else
swprintf( sString, pMapErrorString[ 19 ], pSoldier->GetName(), pLongAssignmentStrings[ iValue ] ); swprintf( sString, pMapErrorString[ 19 ], pSoldier->GetName(), pLongAssignmentStrings[ iValue ] );
break; break;
@@ -14382,8 +14382,8 @@ void CreateSquadBox( void )
{ {
// get info about current squad and put in string // get info about current squad and put in string
//SQUAD10 FIX //SQUAD10 FIX
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && uiCounter < gSquadNameVector.size() )
swprintf( sString, L"%s ( %d/%d )", SquadNames[ uiCounter ].squadname, NumberOfPeopleInSquad( ( INT8 )uiCounter ), gGameOptions.ubSquadSize ); swprintf( sString, L"%s ( %d/%d )", gSquadNameVector[uiCounter].c_str(), NumberOfPeopleInSquad( ( INT8 )uiCounter ), gGameOptions.ubSquadSize );
else else
swprintf( sString, L"%s ( %d/%d )", pSquadMenuStrings[uiCounter], NumberOfPeopleInSquad( ( INT8 )uiCounter ), gGameOptions.ubSquadSize ); swprintf( sString, L"%s ( %d/%d )", pSquadMenuStrings[uiCounter], NumberOfPeopleInSquad( ( INT8 )uiCounter ), gGameOptions.ubSquadSize );
@@ -15303,8 +15303,8 @@ void CreateAssignmentsBox( void )
if( ( uiCounter == ASSIGN_MENU_ON_DUTY ) && ( pSoldier != NULL ) && ( pSoldier->bAssignment < ON_DUTY ) ) if( ( uiCounter == ASSIGN_MENU_ON_DUTY ) && ( pSoldier != NULL ) && ( pSoldier->bAssignment < ON_DUTY ) )
{ {
// show his squad # in brackets // show his squad # in brackets
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < gSquadNameVector.size() )
swprintf( sString, L"%s(%s)", pAssignMenuStrings[uiCounter], SquadNames[ pSoldier->bAssignment ].squadname ); swprintf( sString, L"%s(%s)", pAssignMenuStrings[uiCounter], gSquadNameVector[uiCounter].c_str() );
else else
swprintf( sString, L"%s(%d)", pAssignMenuStrings[uiCounter], pSoldier->bAssignment + 1 ); swprintf( sString, L"%s(%d)", pAssignMenuStrings[uiCounter], pSoldier->bAssignment + 1 );
} }
+2 -2
View File
@@ -1720,8 +1720,8 @@ void PlotPathForCharacter( SOLDIERTYPE *pCharacter, INT16 sX, INT16 sY, BOOLEAN
} }
else // squad else // squad
{ {
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && pCharacter->bAssignment < gSquadNameVector.size() )
MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%s %s", SquadNames[ pCharacter->bAssignment ].squadname, gsUndergroundString[0] ); MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%s %s", gSquadNameVector[pCharacter->bAssignment].c_str(), gsUndergroundString[0] );
else else
MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%s %s", pLongAssignmentStrings[ pCharacter->bAssignment ], gsUndergroundString[0] ); MapScreenMessage( FONT_MCOLOR_DKRED, MSG_INTERFACE, L"%s %s", pLongAssignmentStrings[ pCharacter->bAssignment ], gsUndergroundString[0] );
} }
+4 -6
View File
@@ -375,8 +375,6 @@ SGPPoint OrigSnitchSectorPosition={320,150};
SGPPoint OrigPrisonerPosition = {320, 150}; SGPPoint OrigPrisonerPosition = {320, 150};
SQUAD_NAMES SquadNames[20];
//extern BOOLEAN fMapExitDueToMessageBox; //extern BOOLEAN fMapExitDueToMessageBox;
// at least one merc was hired at some time // at least one merc was hired at some time
@@ -3845,15 +3843,15 @@ void AddStringsToMoveBox( void )
// add this squad, now add all the grunts in it // add this squad, now add all the grunts in it
if( fSquadIsMoving[ iCount ] ) if( fSquadIsMoving[ iCount ] )
{ {
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && iSquadMovingList[iCount] < gSquadNameVector.size() )
swprintf( sString, L"*%s*", SquadNames[ iSquadMovingList[ iCount ] ].squadname ); swprintf( sString, L"*%s*", gSquadNameVector[iSquadMovingList[iCount]].c_str() );
else else
swprintf( sString, L"*%s*", pSquadMenuStrings[iSquadMovingList[ iCount ] ] ); swprintf( sString, L"*%s*", pSquadMenuStrings[iSquadMovingList[ iCount ] ] );
} }
else else
{ {
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && iSquadMovingList[iCount] < gSquadNameVector.size() )
swprintf( sString, L"%s", SquadNames[ iSquadMovingList[ iCount ] ].squadname ); swprintf( sString, L"%s", gSquadNameVector[iSquadMovingList[iCount]].c_str() );
else else
swprintf( sString, L"%s", pSquadMenuStrings[iSquadMovingList[ iCount ] ] ); swprintf( sString, L"%s", pSquadMenuStrings[iSquadMovingList[ iCount ] ] );
} }
+1 -7
View File
@@ -22,13 +22,7 @@ typedef struct FASTHELPREGION {
} FASTHELPREGION; } FASTHELPREGION;
// Flugente: externalised squad names // Flugente: externalised squad names
typedef struct extern std::vector<std::wstring> gSquadNameVector;
{
UINT32 uiIndex;
CHAR16 squadname[10];
} SQUAD_NAMES;
extern SQUAD_NAMES SquadNames[20];
extern UINT8 FIRSTmercTOdisplay ; extern UINT8 FIRSTmercTOdisplay ;
extern UINT8 maxNumberOfMercVisibleInStrategyList; extern UINT8 maxNumberOfMercVisibleInStrategyList;
+4 -4
View File
@@ -2102,8 +2102,8 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
{ {
// squad // squad
// HEADROCK HAM 3.6: Messages are no longer yellow by default. // HEADROCK HAM 3.6: Messages are no longer yellow by default.
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && pGroup->pPlayerList->pSoldier->bAssignment < gSquadNameVector.size() )
ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], SquadNames[ pGroup->pPlayerList->pSoldier->bAssignment ].squadname, pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ]); ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], gSquadNameVector[pGroup->pPlayerList->pSoldier->bAssignment].c_str(), pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ]);
else else
ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], pAssignmentStrings[ pGroup->pPlayerList->pSoldier->bAssignment ], pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ]); ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, pMessageStrings[ MSG_ARRIVE ], pAssignmentStrings[ pGroup->pPlayerList->pSoldier->bAssignment ], pMapVertIndex[ pGroup->pPlayerList->pSoldier->sSectorY ], pMapHortIndex[ pGroup->pPlayerList->pSoldier->sSectorX ]);
} }
@@ -5725,8 +5725,8 @@ BOOLEAN HandlePlayerGroupEnteringSectorToCheckForNPCsOfNote( GROUP *pGroup )
// build string for squad // build string for squad
GetSectorIDString( sSectorX, sSectorY, bSectorZ, wSectorName, FALSE ); GetSectorIDString( sSectorX, sSectorY, bSectorZ, wSectorName, FALSE );
if ( gGameExternalOptions.fUseXMLSquadNames && pGroup->pPlayerList->pSoldier->bAssignment < ON_DUTY ) if ( gGameExternalOptions.fUseXMLSquadNames && pGroup->pPlayerList->pSoldier->bAssignment < min(ON_DUTY, gSquadNameVector .size()) )
swprintf( sString, pLandMarkInSectorString[ 1 ], SquadNames[ pGroup->pPlayerList->pSoldier->bAssignment ].squadname, wSectorName ); swprintf( sString, pLandMarkInSectorString[ 1 ], gSquadNameVector[pGroup->pPlayerList->pSoldier->bAssignment].c_str(), wSectorName );
else else
swprintf( sString, pLandMarkInSectorString[ 0 ], pGroup->pPlayerList->pSoldier->bAssignment + 1, wSectorName ); swprintf( sString, pLandMarkInSectorString[ 0 ], pGroup->pPlayerList->pSoldier->bAssignment + 1, wSectorName );
+8 -30
View File
@@ -9,21 +9,19 @@
#include "XML.h" #include "XML.h"
#endif #endif
struct struct
{ {
PARSE_STAGE curElement; PARSE_STAGE curElement;
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
SQUAD_NAMES curSquadNames;
SQUAD_NAMES * curArray;
UINT32 maxArraySize;
UINT32 currentDepth; UINT32 currentDepth;
UINT32 maxReadDepth; UINT32 maxReadDepth;
} }
typedef squadnamesParseData; typedef squadnamesParseData;
std::vector<std::wstring> gSquadNameVector;
static void XMLCALL static void XMLCALL
squadnamesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) squadnamesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
{ {
@@ -35,16 +33,12 @@ squadnamesStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
{ {
pData->curElement = ELEMENT_LIST; pData->curElement = ELEMENT_LIST;
memset(pData->curArray,0,sizeof(SQUAD_NAMES)*pData->maxArraySize);
pData->maxReadDepth++; //we are not skipping this element pData->maxReadDepth++; //we are not skipping this element
} }
else if(strcmp(name, "SQUADNAME") == 0 && pData->curElement == ELEMENT_LIST) else if(strcmp(name, "SQUADNAME") == 0 && pData->curElement == ELEMENT_LIST)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
memset(&pData->curSquadNames,0,sizeof(SQUAD_NAMES));
pData->maxReadDepth++; //we are not skipping this element pData->maxReadDepth++; //we are not skipping this element
} }
else if(pData->curElement == ELEMENT && else if(pData->curElement == ELEMENT &&
@@ -60,7 +54,6 @@ squadnamesStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
} }
pData->currentDepth++; pData->currentDepth++;
} }
static void XMLCALL static void XMLCALL
@@ -75,7 +68,6 @@ squadnamesCharacterDataHandle(void *userData, const XML_Char *str, int len)
} }
} }
static void XMLCALL static void XMLCALL
squadnamesEndElementHandle(void *userData, const XML_Char *name) squadnamesEndElementHandle(void *userData, const XML_Char *name)
{ {
@@ -90,25 +82,22 @@ squadnamesEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "SQUADNAME") == 0) else if(strcmp(name, "SQUADNAME") == 0)
{ {
pData->curElement = ELEMENT_LIST; pData->curElement = ELEMENT_LIST;
if(pData->curSquadNames.uiIndex < pData->maxArraySize)
{
pData->curArray[pData->curSquadNames.uiIndex] = pData->curSquadNames; //write the squadnames into the table
}
} }
else if(strcmp(name, "uiIndex") == 0) else if(strcmp(name, "uiIndex") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
pData->curSquadNames.uiIndex = (UINT32) atol(pData->szCharData);
} }
else if(strcmp(name, "Squad") == 0) else if(strcmp(name, "Squad") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curSquadNames.squadname, sizeof(pData->curSquadNames.squadname)/sizeof(pData->curSquadNames.squadname[0]) ); CHAR16 bla[30];
pData->curSquadNames.squadname[sizeof(pData->curSquadNames.squadname)/sizeof(pData->curSquadNames.squadname[0]) - 1] = '\0';
}
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, bla, sizeof( bla ) / sizeof( bla[0] ) );
bla[sizeof( bla ) / sizeof( bla[0] ) - 1] = '\0';
gSquadNameVector.push_back( bla );
}
pData->maxReadDepth--; pData->maxReadDepth--;
} }
@@ -116,9 +105,6 @@ squadnamesEndElementHandle(void *userData, const XML_Char *name)
pData->currentDepth--; pData->currentDepth--;
} }
BOOLEAN ReadInSquadNamesStats(STR fileName) BOOLEAN ReadInSquadNamesStats(STR fileName)
{ {
HWFILE hFile; HWFILE hFile;
@@ -150,18 +136,13 @@ BOOLEAN ReadInSquadNamesStats(STR fileName)
FileClose( hFile ); FileClose( hFile );
XML_SetElementHandler(parser, squadnamesStartElementHandle, squadnamesEndElementHandle); XML_SetElementHandler(parser, squadnamesStartElementHandle, squadnamesEndElementHandle);
XML_SetCharacterDataHandler(parser, squadnamesCharacterDataHandle); XML_SetCharacterDataHandler(parser, squadnamesCharacterDataHandle);
memset(&pData,0,sizeof(pData)); memset(&pData,0,sizeof(pData));
pData.curArray = SquadNames;
pData.maxArraySize = 20;
XML_SetUserData(parser, &pData); XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{ {
CHAR8 errorBuf[511]; CHAR8 errorBuf[511];
@@ -175,15 +156,12 @@ BOOLEAN ReadInSquadNamesStats(STR fileName)
MemFree(lpcBuffer); MemFree(lpcBuffer);
XML_ParserFree(parser); XML_ParserFree(parser);
return( TRUE ); return( TRUE );
} }
BOOLEAN WriteSquadNamesStats() BOOLEAN WriteSquadNamesStats()
{ {
return( TRUE ); return( TRUE );
} }
+4 -4
View File
@@ -2849,8 +2849,8 @@ void DrawCharacterInfo(INT16 sCharNumber)
} }
else else
{ {
if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < ON_DUTY ) if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < min(ON_DUTY, gSquadNameVector.size()) )
swprintf( sString, L"%s", SquadNames[ pSoldier->bAssignment ].squadname ); swprintf( sString, L"%s", gSquadNameVector[pSoldier->bAssignment].c_str() );
else else
wcscpy( sString, pAssignmentStrings[ pSoldier->bAssignment ] ); wcscpy( sString, pAssignmentStrings[ pSoldier->bAssignment ] );
} }
@@ -15871,8 +15871,8 @@ void GetMapscreenMercAssignmentString( SOLDIERTYPE *pSoldier, CHAR16 sString[] )
} }
else else
{ {
if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < ON_DUTY ) if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < min(ON_DUTY, gSquadNameVector.size() ) )
swprintf( sString, L" %s", SquadNames[ pSoldier->bAssignment ].squadname ); swprintf( sString, L" %s", gSquadNameVector[pSoldier->bAssignment].c_str() );
else else
wcscpy(sString, pAssignmentStrings[ pSoldier->bAssignment ] ); wcscpy(sString, pAssignmentStrings[ pSoldier->bAssignment ] );
} }
+2 -2
View File
@@ -1549,8 +1549,8 @@ UINT32 UIHandleSelectMerc( UI_EVENT *pUIEvent )
// If different, display message // If different, display message
if ( CurrentSquad( ) != iCurrentSquad ) if ( CurrentSquad( ) != iCurrentSquad )
{ {
if ( gGameExternalOptions.fUseXMLSquadNames && CurrentSquad( ) + 1 < ON_DUTY ) if ( gGameExternalOptions.fUseXMLSquadNames && CurrentSquad( ) + 1 < min( ON_DUTY, gSquadNameVector.size() ) )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_SQUAD_ACTIVE_STRING], SquadNames[CurrentSquad( ) + 1].squadname ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_SQUAD_ACTIVE_STRING], gSquadNameVector[CurrentSquad() + 1].c_str() );
else else
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( CurrentSquad( ) + 1 ) ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( CurrentSquad( ) + 1 ) );
} }
+7 -7
View File
@@ -5553,21 +5553,21 @@ void RenderTEAMPanel( BOOLEAN fDirty )
if (gGameOptions.fNewTraitSystem) // SANDRO - old/new traits check if (gGameOptions.fNewTraitSystem) // SANDRO - old/new traits check
{ {
UINT8 ubTempSkillArray[30]; UINT8 ubTempSkillArray[30];
INT8 bNumSkillTraits = 0; int bNumSkillTraits = 0;
// lets rearrange our skills to a temp array // lets rearrange our skills to a temp array
// we also get the number of lines (skills) to be displayed // we also get the number of lines (skills) to be displayed
for ( UINT8 ubCnt = 1; ubCnt < NUM_SKILLTRAITS_NT; ubCnt++ ) for ( UINT8 ubCnt = 1; ubCnt < NUM_SKILLTRAITS_NT; ++ubCnt )
{ {
if ( ProfileHasSkillTrait( pSoldier->ubProfile, ubCnt ) == 2 ) if ( ProfileHasSkillTrait( pSoldier->ubProfile, ubCnt ) == 2 )
{ {
ubTempSkillArray[bNumSkillTraits] = (ubCnt + NEWTRAIT_MERCSKILL_EXPERTOFFSET); ubTempSkillArray[bNumSkillTraits] = (ubCnt + NEWTRAIT_MERCSKILL_EXPERTOFFSET);
bNumSkillTraits++; ++bNumSkillTraits;
} }
else if ( ProfileHasSkillTrait( pSoldier->ubProfile, ubCnt ) == 1 ) else if ( ProfileHasSkillTrait( pSoldier->ubProfile, ubCnt ) == 1 )
{ {
ubTempSkillArray[bNumSkillTraits] = ubCnt; ubTempSkillArray[bNumSkillTraits] = ubCnt;
bNumSkillTraits++; ++bNumSkillTraits;
} }
} }
@@ -5578,7 +5578,7 @@ void RenderTEAMPanel( BOOLEAN fDirty )
} }
else else
{ {
for ( UINT8 ubCnt = 0; ubCnt < bNumSkillTraits; ubCnt++ ) for ( int ubCnt = 0; ubCnt < bNumSkillTraits; ++ubCnt )
{ {
swprintf( sTemp, L"%s\n", gzMercSkillTextNew[ ubTempSkillArray[ubCnt] ] ); swprintf( sTemp, L"%s\n", gzMercSkillTextNew[ ubTempSkillArray[ubCnt] ] );
wcscat( pStr, sTemp ); wcscat( pStr, sTemp );
@@ -7157,8 +7157,8 @@ UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife
if ( pNewSoldier->bAssignment != iCurrentSquad ) if ( pNewSoldier->bAssignment != iCurrentSquad )
{ {
if ( gGameExternalOptions.fUseXMLSquadNames && pNewSoldier->bAssignment < ON_DUTY ) if ( gGameExternalOptions.fUseXMLSquadNames && pNewSoldier->bAssignment < min(ON_DUTY, gSquadNameVector.size()) )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_SQUAD_ACTIVE_STRING], SquadNames[pNewSoldier->bAssignment].squadname ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_SQUAD_ACTIVE_STRING], gSquadNameVector[pNewSoldier->bAssignment].c_str() );
else else
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( CurrentSquad( ) + 1 ) ); //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( CurrentSquad( ) + 1 ) );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( pNewSoldier->bAssignment + 1 ) ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( pNewSoldier->bAssignment + 1 ) );
+2 -2
View File
@@ -1987,8 +1987,8 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID )
} }
else if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bAssignment < ON_DUTY && pSoldier->bAssignment != CurrentSquad() && !( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) ) else if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bAssignment < ON_DUTY && pSoldier->bAssignment != CurrentSquad() && !( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) )
{ {
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < gSquadNameVector.size() )
swprintf( NameStr, SquadNames[ pSoldier->bAssignment ].squadname ); swprintf( NameStr, gSquadNameVector[pSoldier->bAssignment].c_str() );
else else
swprintf( NameStr, gzLateLocalizedString[ 34 ], ( pSoldier->bAssignment + 1 ) ); swprintf( NameStr, gzLateLocalizedString[ 34 ], ( pSoldier->bAssignment + 1 ) );
+4 -4
View File
@@ -2242,8 +2242,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
{ {
HandleLocateSelectMerc( pNewSoldier->ubID, LOCATEANDSELECT_MERC ); HandleLocateSelectMerc( pNewSoldier->ubID, LOCATEANDSELECT_MERC );
if ( gGameExternalOptions.fUseXMLSquadNames && pNewSoldier->bAssignment < ON_DUTY ) if ( gGameExternalOptions.fUseXMLSquadNames && pNewSoldier->bAssignment < min(ON_DUTY, gSquadNameVector.size() ) )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE_STRING ], SquadNames[pNewSoldier->bAssignment].squadname ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE_STRING ], gSquadNameVector[pNewSoldier->bAssignment].c_str() );
else else
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( CurrentSquad( ) + 1 ) ); //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( CurrentSquad( ) + 1 ) );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( pNewSoldier->bAssignment + 1 ) ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( pNewSoldier->bAssignment + 1 ) );
@@ -5961,8 +5961,8 @@ void ChangeCurrentSquad( INT32 iSquad )
//set active squad //set active squad
SetCurrentSquad( cnt, FALSE ); SetCurrentSquad( cnt, FALSE );
if ( gGameExternalOptions.fUseXMLSquadNames && cnt < ON_DUTY ) if ( gGameExternalOptions.fUseXMLSquadNames && cnt < min(ON_DUTY, gSquadNameVector.size()) )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE_STRING ], SquadNames[cnt].squadname ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE_STRING ], gSquadNameVector[cnt].c_str() );
else else
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( cnt + 1 ) ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ACTIVE ], ( cnt + 1 ) );
+20 -7
View File
@@ -847,6 +847,7 @@ void RenderSquadList( void )
// show list of squads // show list of squads
INT16 sCounter = 0; INT16 sCounter = 0;
INT16 sX, sY; INT16 sX, sY;
CHAR16 sString[40];
// clear region // clear region
// CHRISL: // CHRISL:
@@ -865,16 +866,24 @@ void RenderSquadList( void )
if( sCounter < NUMBER_OF_SQUADS / 2 ) if( sCounter < NUMBER_OF_SQUADS / 2 )
{ {
// CHRISL: // CHRISL:
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && sCounter < gSquadNameVector.size() )
FindFontCenterCoordinates( RADAR_WINDOW_TM_X , ( INT16 )( SQUAD_WINDOW_TM_Y + ( sCounter * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ) , SquadNames[ sCounter ].squadname , SQUAD_FONT, &sX, &sY); {
swprintf( sString, L"%s", gSquadNameVector[sCounter].c_str() );
FindFontCenterCoordinates( RADAR_WINDOW_TM_X, (INT16)( SQUAD_WINDOW_TM_Y + ( sCounter * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, (INT16)( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), sString, SQUAD_FONT, &sX, &sY );
}
else else
FindFontCenterCoordinates( RADAR_WINDOW_TM_X , ( INT16 )( SQUAD_WINDOW_TM_Y + ( sCounter * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ) ,pSquadMenuStrings[ sCounter ] , SQUAD_FONT, &sX, &sY); FindFontCenterCoordinates( RADAR_WINDOW_TM_X , ( INT16 )( SQUAD_WINDOW_TM_Y + ( sCounter * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ) , pSquadMenuStrings[ sCounter ] , SQUAD_FONT, &sX, &sY);
} }
else else
{ {
// CHRISL: // CHRISL:
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && sCounter < gSquadNameVector.size() )
FindFontCenterCoordinates(RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH / 2, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter - ( NUMBER_OF_SQUADS / 2) ) * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), SquadNames[ sCounter ].squadname , SQUAD_FONT, &sX, &sY); {
swprintf( sString, L"%s", gSquadNameVector[sCounter].c_str() );
FindFontCenterCoordinates( RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH / 2, (INT16)( SQUAD_WINDOW_TM_Y + ( ( sCounter - ( NUMBER_OF_SQUADS / 2 ) ) * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, (INT16)( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), sString, SQUAD_FONT, &sX, &sY );
}
else else
FindFontCenterCoordinates(RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH / 2, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter - ( NUMBER_OF_SQUADS / 2) ) * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), pSquadMenuStrings[ sCounter ] , SQUAD_FONT, &sX, &sY); FindFontCenterCoordinates(RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH / 2, ( INT16 )( SQUAD_WINDOW_TM_Y + ( ( sCounter - ( NUMBER_OF_SQUADS / 2) ) * ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), RADAR_WINDOW_WIDTH / 2 - 1, ( INT16 )( ( ( 2 * ( SQUAD_REGION_HEIGHT - SUBTRACTOR_FOR_SQUAD_LIST ) / NUMBER_OF_SQUADS ) ) ), pSquadMenuStrings[ sCounter ] , SQUAD_FONT, &sX, &sY);
} }
@@ -914,8 +923,12 @@ void RenderSquadList( void )
sX = RADAR_WINDOW_TM_X + ( RADAR_WINDOW_WIDTH / 2 ) - 2; sX = RADAR_WINDOW_TM_X + ( RADAR_WINDOW_WIDTH / 2 ) - 2;
} }
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && sCounter < gSquadNameVector.size() )
mprintf( sX, sY , SquadNames[ sCounter ].squadname); {
swprintf( sString, L"%s", gSquadNameVector[sCounter].c_str() );
mprintf( sX, sY , sString );
}
else else
mprintf( sX, sY , pSquadMenuStrings[ sCounter ]); mprintf( sX, sY , pSquadMenuStrings[ sCounter ]);
} }
+1 -1
View File
@@ -3025,7 +3025,7 @@ enum
// links to other pages // links to other pages
TEXT_MILITIAWEBSITE_SUBSITE1, TEXT_MILITIAWEBSITE_SUBSITE1,
TEXT_MILITIAWEBSITE_MAIN1 = TEXT_PMC_SUBSITE1 + 3, TEXT_MILITIAWEBSITE_MAIN1 = TEXT_MILITIAWEBSITE_SUBSITE1 + 3,
TEXT_MILITIAWEBSITE_MAX, TEXT_MILITIAWEBSITE_MAX,
}; };