mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- fixed an instance of wrong assignment strings
- prisoner decision messagebox now allows to select a specific prison - Fix: under certain conditions, calling militia reinforcements with militia equipment selection could get sector items with invalid GridNo to become lost git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5888 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2829,7 +2829,7 @@ void DrawCharacterInfo(INT16 sCharNumber)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames )
|
||||
if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < ON_DUTY )
|
||||
swprintf( sString, L"%s", SquadNames[ pSoldier->bAssignment ].squadname );
|
||||
else
|
||||
wcscpy( sString, pAssignmentStrings[ pSoldier->bAssignment ] );
|
||||
|
||||
@@ -3726,17 +3726,17 @@ void SearchItemRetrieval( WORLDITEM* pWorldItem, ItemSearchStruct* pSi, SOLDIERC
|
||||
if ( pSi->found && !pSi->done )
|
||||
{
|
||||
UINT8 usRealTake = min(usTake, pWorldItem[ pSi->pos ].object.ubNumberOfObjects);
|
||||
pWorldItem[ pSi->pos ].object.MoveThisObjectTo(gTempObject, usRealTake );
|
||||
pWorldItem[ pSi->pos ].object.MoveThisObjectTo(pp->Inv[ pSi->soldierslot ], usRealTake );
|
||||
|
||||
for ( UINT8 i = 0; i < usRealTake; ++i )
|
||||
gTempObject[i]->data.sObjectFlag |= TAKEN_BY_MILITIA;
|
||||
|
||||
pp->Inv[ pSi->soldierslot ] = gTempObject;
|
||||
(pp->Inv[ pSi->soldierslot ])[i]->data.sObjectFlag |= TAKEN_BY_MILITIA;
|
||||
|
||||
if ( pWorldItem[ pSi->pos ].object.ubNumberOfObjects < 1 )
|
||||
{
|
||||
RemoveItemFromPool(pWorldItem[ pSi->pos ].sGridNo, (pSi->pos), pWorldItem[ pSi->pos ].ubLevel);
|
||||
pWorldItem[ pSi->pos ].fExists = FALSE;
|
||||
|
||||
// setting this to false can lead to cases where we 'forget' items without a valid gridno - though I am unsure why.
|
||||
//pWorldItem[ pSi->pos ].fExists = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4684,6 +4684,14 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
|
||||
|
||||
// Exit: Save changed inventory
|
||||
|
||||
#ifdef JA2TESTVERSION
|
||||
std::vector<std::pair<BOOLEAN, UINT16> > overviewvector2;
|
||||
for( uiCount = 0; uiCount < uiTotalNumberOfRealItems; ++uiCount )
|
||||
{
|
||||
overviewvector2.push_back( std::pair<BOOLEAN, UINT16>(pWorldItem[ uiCount ].fExists, pWorldItem[ uiCount ].object.usItem) );
|
||||
}
|
||||
#endif
|
||||
|
||||
// save the changed inventory
|
||||
// open sector inv
|
||||
if( ( sMapX == gWorldSectorX )&&( gWorldSectorY == sMapY ) && (gbWorldSectorZ == sMapZ ) )
|
||||
|
||||
+73
-38
@@ -6634,10 +6634,10 @@ void DeathNoMessageTimerCallback( void )
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN GetPlayerControlledPrisonSectorId(UINT32& auSectorID)
|
||||
// get a vector of all player-controlled sectors with prison facilities. It is assumed that a sector has max. one of these
|
||||
BOOLEAN GetPlayerControlledPrisonList( std::vector<UINT32>& arSectorIDVector )
|
||||
{
|
||||
auSectorID = 0;
|
||||
UINT16 highestprisonsize = 0;
|
||||
arSectorIDVector.clear();
|
||||
|
||||
for(INT16 sX = 1; sX < MAP_WORLD_X - 1; ++sX )
|
||||
{
|
||||
@@ -6658,10 +6658,9 @@ BOOLEAN GetPlayerControlledPrisonSectorId(UINT32& auSectorID)
|
||||
if (gFacilityLocations[SECTOR(sX, sY)][cnt].fFacilityHere)
|
||||
{
|
||||
// we determine wether this is a prison by checking for usPrisonBaseLimit
|
||||
if ( gFacilityTypes[cnt].AssignmentData[FAC_INTERROGATE_PRISONERS].usPrisonBaseLimit > highestprisonsize )
|
||||
if ( gFacilityTypes[cnt].AssignmentData[FAC_INTERROGATE_PRISONERS].usPrisonBaseLimit > 0 )
|
||||
{
|
||||
highestprisonsize = gFacilityTypes[cnt].AssignmentData[FAC_INTERROGATE_PRISONERS].usPrisonBaseLimit;
|
||||
auSectorID = SECTOR(sX, sY);
|
||||
arSectorIDVector.push_back( SECTOR(sX, sY) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -6669,14 +6668,35 @@ BOOLEAN GetPlayerControlledPrisonSectorId(UINT32& auSectorID)
|
||||
}
|
||||
}
|
||||
|
||||
return (highestprisonsize > 0);
|
||||
return ( arSectorIDVector.size() > 0 );
|
||||
}
|
||||
|
||||
extern INT32 giReinforcementPool;
|
||||
|
||||
void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
if (ubExitValue == MSG_BOX_RETURN_NO)
|
||||
UINT32 usSectorID = 0;
|
||||
|
||||
// Get a list of all available prisons, and create a fitting messagebox
|
||||
std::vector<UINT32> prisonsectorvector;
|
||||
if ( GetPlayerControlledPrisonList( prisonsectorvector ) )
|
||||
{
|
||||
UINT8 cnt = 1;
|
||||
std::vector<UINT32>::iterator itend = prisonsectorvector.end();
|
||||
for (std::vector<UINT32>::iterator it = prisonsectorvector.begin(); it != itend; ++it)
|
||||
{
|
||||
if ( ubExitValue == cnt )
|
||||
{
|
||||
usSectorID = (*it);
|
||||
break;
|
||||
}
|
||||
|
||||
++cnt;
|
||||
}
|
||||
}
|
||||
|
||||
// if sector is still not set, then we did not select one - release prisoners
|
||||
if ( usSectorID == 0 )
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_RELEASED] );
|
||||
}
|
||||
@@ -6691,23 +6711,19 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
|
||||
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
|
||||
|
||||
if (ubExitValue == MSG_BOX_RETURN_YES)
|
||||
if ( usSectorID > 0)
|
||||
{
|
||||
UINT32 uSectorID = 0;
|
||||
if ( GetPlayerControlledPrisonSectorId(uSectorID) )
|
||||
SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ usSectorID ] );
|
||||
|
||||
if ( pPrisonSectorInfo )
|
||||
{
|
||||
SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ uSectorID ] );
|
||||
success = TRUE;
|
||||
|
||||
if ( pPrisonSectorInfo )
|
||||
{
|
||||
success = TRUE;
|
||||
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
|
||||
|
||||
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
|
||||
|
||||
CHAR16 wString[ 64 ];
|
||||
GetShortSectorString( (INT16)((uSectorID % MAP_WORLD_X) + 1), (INT16)((uSectorID / MAP_WORLD_X) + 2), wString );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_SENTTOSECTOR], wString );
|
||||
}
|
||||
CHAR16 wString[ 64 ];
|
||||
GetShortSectorString( SECTORX(usSectorID), SECTORY(usSectorID), wString );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_SENTTOSECTOR], wString );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6719,23 +6735,19 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
|
||||
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
|
||||
|
||||
if (ubExitValue == MSG_BOX_RETURN_YES)
|
||||
if ( usSectorID > 0)
|
||||
{
|
||||
UINT32 uSectorID = 0;
|
||||
if ( GetPlayerControlledPrisonSectorId(uSectorID) )
|
||||
SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ usSectorID ] );
|
||||
|
||||
if ( pPrisonSectorInfo )
|
||||
{
|
||||
SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ uSectorID ] );
|
||||
success = TRUE;
|
||||
|
||||
if ( pPrisonSectorInfo )
|
||||
{
|
||||
success = TRUE;
|
||||
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
|
||||
|
||||
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
|
||||
|
||||
CHAR16 wString[ 64 ];
|
||||
GetShortSectorString( (INT16)(uSectorID % MAP_WORLD_X), (INT16)(uSectorID / MAP_WORLD_X), wString );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_SENTTOSECTOR], wString );
|
||||
}
|
||||
CHAR16 wString[ 64 ];
|
||||
GetShortSectorString( SECTORX(usSectorID), SECTORY(usSectorID), wString );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_SENTTOSECTOR], wString );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6881,10 +6893,33 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
|
||||
if ( ubNumPrisoners )
|
||||
{
|
||||
//if ( guiCurrentScreen == GAME_SCREEN )
|
||||
UINT32 uSectorID = 0;
|
||||
if ( GetPlayerControlledPrisonSectorId(uSectorID) )
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ PRISONER_DECIDE_STR ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, PrisonerMessageBoxCallBack, NULL );
|
||||
// Get a list of all available prisons, and create a fitting messagebox
|
||||
std::vector<UINT32> prisonsectorvector;
|
||||
if ( GetPlayerControlledPrisonList( prisonsectorvector ) )
|
||||
{
|
||||
UINT8 cnt = 0;
|
||||
std::vector<UINT32>::iterator itend = prisonsectorvector.end();
|
||||
for (std::vector<UINT32>::iterator it = prisonsectorvector.begin(); it != itend; ++it)
|
||||
{
|
||||
UINT32 usSectorID = (*it);
|
||||
CHAR16 zShortTownIDString[ 50 ];
|
||||
|
||||
GetShortSectorString( SECTORX(usSectorID), SECTORY(usSectorID), zShortTownIDString );
|
||||
|
||||
// Set string for generic button
|
||||
swprintf( gzUserDefinedButton[ cnt++ ], L"%s", zShortTownIDString );
|
||||
|
||||
if ( cnt >= 7 )
|
||||
break;
|
||||
}
|
||||
|
||||
for ( ; cnt < 8; ++cnt)
|
||||
{
|
||||
wcscpy( gzUserDefinedButton[ cnt ], TacticalStr[ PRISONER_LETGO_STR ] );
|
||||
}
|
||||
|
||||
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ PRISONER_DECIDE_STR ], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS, PrisonerMessageBoxCallBack, NULL );
|
||||
}
|
||||
else
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ PRISONER_NO_PRISONS_STR ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL );
|
||||
}
|
||||
|
||||
@@ -942,6 +942,7 @@ enum
|
||||
WEAPON_CLEANING_STR,
|
||||
PRISONER_NO_PRISONS_STR,
|
||||
PRISONER_DECIDE_STR,
|
||||
PRISONER_LETGO_STR,
|
||||
PRISONER_OFFER_SURRENDER,
|
||||
PRISONER_DEMAND_SURRENDER_STR,
|
||||
PRISONER_OFFER_SURRENDER_STR,
|
||||
|
||||
@@ -2929,7 +2929,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"你现在没有可用的监狱关押这些俘虏,你不得不放他们走。", //L"You have no prison for these prisoners, you have to let them go",
|
||||
L"Yes - 将俘虏送入监狱 No - 放俘虏离开这里", //L"Yes - Send prisoners to jail No - Let them go",
|
||||
L"Where do you want to send the prisoners?",//TODO.Translate
|
||||
L"Let them go",
|
||||
L"你想要做什么?",
|
||||
L"劝说敌人投降",
|
||||
L"Offer surrender",//TODO.Translate
|
||||
|
||||
@@ -2926,7 +2926,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"You have no prison for these prisoners, you have to let them go",
|
||||
L"Yes - Send prisoners to jail No - Let them go",
|
||||
L"Where do you want to send the prisoners?",//TODO.Translate
|
||||
L"Let them go",
|
||||
L"What do you want to do?",
|
||||
L"Demand surrender",
|
||||
L"Offer surrender",
|
||||
|
||||
@@ -2928,7 +2928,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"You have no prison for these prisoners, you have to let them go",
|
||||
L"Yes - Send prisoners to jail No - Let them go",
|
||||
L"Where do you want to send the prisoners?",
|
||||
L"Let them go",
|
||||
L"What do you want to do?",
|
||||
L"Demand surrender",
|
||||
L"Offer surrender",
|
||||
|
||||
@@ -2933,7 +2933,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"You have no prison for these prisoners, you have to let them go",
|
||||
L"Yes - Send prisoners to jail No - Let them go",
|
||||
L"Where do you want to send the prisoners?",//TODO.Translate
|
||||
L"Let them go",
|
||||
L"What do you want to do?",
|
||||
L"Demand surrender",
|
||||
L"Offer surrender",
|
||||
|
||||
@@ -2931,12 +2931,13 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"Sie haben kein Gefängnis für die Gefangenen und müssen diese nun laufen lassen",
|
||||
L"Ja - Gefangene ins Gefängnis bringen Nein - Laßt sie gehen",
|
||||
L"Wohin mit den Gefangenen?",
|
||||
L"Entlassen",
|
||||
L"Was möchten Sie tun?",
|
||||
L"Aufgabe einfordern",
|
||||
L"Aufgabe anbieten",
|
||||
L"Kapitulation fordern",
|
||||
L"Kapitulation anbieten",
|
||||
L"Sprechen",
|
||||
L"Militia inspection",//TODO.Translate
|
||||
L"Miliz inspizieren",
|
||||
L"unused",
|
||||
};
|
||||
|
||||
|
||||
@@ -2921,7 +2921,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"You have no prison for these prisoners, you have to let them go",
|
||||
L"Yes - Send prisoners to jail No - Let them go",
|
||||
L"Where do you want to send the prisoners?",//TODO.Translate
|
||||
L"Let them go",
|
||||
L"What do you want to do?",
|
||||
L"Demand surrender",
|
||||
L"Offer surrender",
|
||||
|
||||
@@ -2936,7 +2936,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"You have no prison for these prisoners, you have to let them go",
|
||||
L"Yes - Send prisoners to jail No - Let them go",
|
||||
L"Where do you want to send the prisoners?",//TODO.Translate
|
||||
L"Let them go",
|
||||
L"What do you want to do?",
|
||||
L"Demand surrender",
|
||||
L"Offer surrender",
|
||||
|
||||
@@ -2928,7 +2928,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"У вас нет тюрьмы для содержания заключённых, придётся отпустить их",
|
||||
L"Да - Отправить заключенных в тюрьму Нет - Отпустит",
|
||||
L"Where do you want to send the prisoners?",//TODO.Translate
|
||||
L"Let them go",
|
||||
L"Что вы хотите сделать?",
|
||||
L"Требовать сдаться",
|
||||
L"Предлоить сдаться",
|
||||
|
||||
@@ -2930,7 +2930,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
|
||||
|
||||
// added by Flugente: decide what to do with prisoners
|
||||
L"You have no prison for these prisoners, you have to let them go",
|
||||
L"Yes - Send prisoners to jail No - Let them go",
|
||||
L"Where do you want to send the prisoners?",//TODO.Translate
|
||||
L"Let them go",
|
||||
L"What do you want to do?",
|
||||
L"Demand surrender",
|
||||
L"Offer surrender",
|
||||
|
||||
Reference in New Issue
Block a user