- 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:
Flugente
2013-03-02 19:14:46 +00:00
parent a798d66ae4
commit 72dbd9e33f
13 changed files with 109 additions and 56 deletions
+1 -1
View File
@@ -2829,7 +2829,7 @@ void DrawCharacterInfo(INT16 sCharNumber)
} }
else else
{ {
if ( gGameExternalOptions.fUseXMLSquadNames ) if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < ON_DUTY )
swprintf( sString, L"%s", SquadNames[ pSoldier->bAssignment ].squadname ); swprintf( sString, L"%s", SquadNames[ pSoldier->bAssignment ].squadname );
else else
wcscpy( sString, pAssignmentStrings[ pSoldier->bAssignment ] ); wcscpy( sString, pAssignmentStrings[ pSoldier->bAssignment ] );
+13 -5
View File
@@ -3726,17 +3726,17 @@ void SearchItemRetrieval( WORLDITEM* pWorldItem, ItemSearchStruct* pSi, SOLDIERC
if ( pSi->found && !pSi->done ) if ( pSi->found && !pSi->done )
{ {
UINT8 usRealTake = min(usTake, pWorldItem[ pSi->pos ].object.ubNumberOfObjects); 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 ) for ( UINT8 i = 0; i < usRealTake; ++i )
gTempObject[i]->data.sObjectFlag |= TAKEN_BY_MILITIA; (pp->Inv[ pSi->soldierslot ])[i]->data.sObjectFlag |= TAKEN_BY_MILITIA;
pp->Inv[ pSi->soldierslot ] = gTempObject;
if ( pWorldItem[ pSi->pos ].object.ubNumberOfObjects < 1 ) if ( pWorldItem[ pSi->pos ].object.ubNumberOfObjects < 1 )
{ {
RemoveItemFromPool(pWorldItem[ pSi->pos ].sGridNo, (pSi->pos), pWorldItem[ pSi->pos ].ubLevel); 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 // 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 // save the changed inventory
// open sector inv // open sector inv
if( ( sMapX == gWorldSectorX )&&( gWorldSectorY == sMapY ) && (gbWorldSectorZ == sMapZ ) ) if( ( sMapX == gWorldSectorX )&&( gWorldSectorY == sMapY ) && (gbWorldSectorZ == sMapZ ) )
+73 -38
View File
@@ -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; arSectorIDVector.clear();
UINT16 highestprisonsize = 0;
for(INT16 sX = 1; sX < MAP_WORLD_X - 1; ++sX ) 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) if (gFacilityLocations[SECTOR(sX, sY)][cnt].fFacilityHere)
{ {
// we determine wether this is a prison by checking for usPrisonBaseLimit // 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; arSectorIDVector.push_back( SECTOR(sX, sY) );
auSectorID = SECTOR(sX, sY);
break; break;
} }
} }
@@ -6669,14 +6668,35 @@ BOOLEAN GetPlayerControlledPrisonSectorId(UINT32& auSectorID)
} }
} }
return (highestprisonsize > 0); return ( arSectorIDVector.size() > 0 );
} }
extern INT32 giReinforcementPool; extern INT32 giReinforcementPool;
void PrisonerMessageBoxCallBack( UINT8 ubExitValue ) 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] ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_RELEASED] );
} }
@@ -6691,23 +6711,19 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
pSectorInfo->uiNumberOfPrisonersOfWar = 0; pSectorInfo->uiNumberOfPrisonersOfWar = 0;
if (ubExitValue == MSG_BOX_RETURN_YES) if ( usSectorID > 0)
{ {
UINT32 uSectorID = 0; SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ usSectorID ] );
if ( GetPlayerControlledPrisonSectorId(uSectorID) )
if ( pPrisonSectorInfo )
{ {
SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ uSectorID ] ); success = TRUE;
if ( pPrisonSectorInfo ) pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
{
success = TRUE;
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved; CHAR16 wString[ 64 ];
GetShortSectorString( SECTORX(usSectorID), SECTORY(usSectorID), wString );
CHAR16 wString[ 64 ]; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_SENTTOSECTOR], wString );
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 );
}
} }
} }
} }
@@ -6719,23 +6735,19 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
pSectorInfo->uiNumberOfPrisonersOfWar = 0; pSectorInfo->uiNumberOfPrisonersOfWar = 0;
if (ubExitValue == MSG_BOX_RETURN_YES) if ( usSectorID > 0)
{ {
UINT32 uSectorID = 0; SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ usSectorID ] );
if ( GetPlayerControlledPrisonSectorId(uSectorID) )
if ( pPrisonSectorInfo )
{ {
SECTORINFO *pPrisonSectorInfo = &( SectorInfo[ uSectorID ] ); success = TRUE;
if ( pPrisonSectorInfo ) pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
{
success = TRUE;
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved; CHAR16 wString[ 64 ];
GetShortSectorString( SECTORX(usSectorID), SECTORY(usSectorID), wString );
CHAR16 wString[ 64 ]; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_SENTTOSECTOR], wString );
GetShortSectorString( (INT16)(uSectorID % MAP_WORLD_X), (INT16)(uSectorID / MAP_WORLD_X), 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 ( ubNumPrisoners )
{ {
//if ( guiCurrentScreen == GAME_SCREEN ) // Get a list of all available prisons, and create a fitting messagebox
UINT32 uSectorID = 0; std::vector<UINT32> prisonsectorvector;
if ( GetPlayerControlledPrisonSectorId(uSectorID) ) if ( GetPlayerControlledPrisonList( prisonsectorvector ) )
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ PRISONER_DECIDE_STR ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, PrisonerMessageBoxCallBack, NULL ); {
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 else
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ PRISONER_NO_PRISONS_STR ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ PRISONER_NO_PRISONS_STR ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL );
} }
+1
View File
@@ -942,6 +942,7 @@ enum
WEAPON_CLEANING_STR, WEAPON_CLEANING_STR,
PRISONER_NO_PRISONS_STR, PRISONER_NO_PRISONS_STR,
PRISONER_DECIDE_STR, PRISONER_DECIDE_STR,
PRISONER_LETGO_STR,
PRISONER_OFFER_SURRENDER, PRISONER_OFFER_SURRENDER,
PRISONER_DEMAND_SURRENDER_STR, PRISONER_DEMAND_SURRENDER_STR,
PRISONER_OFFER_SURRENDER_STR, PRISONER_OFFER_SURRENDER_STR,
+2 -1
View File
@@ -2929,7 +2929,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // 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"你现在没有可用的监狱关押这些俘虏,你不得不放他们走。", //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"劝说敌人投降", L"劝说敌人投降",
L"Offer surrender",//TODO.Translate L"Offer surrender",//TODO.Translate
+2 -1
View File
@@ -2926,7 +2926,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go", 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"What do you want to do?",
L"Demand surrender", L"Demand surrender",
L"Offer surrender", L"Offer surrender",
+2 -1
View File
@@ -2928,7 +2928,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go", 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"What do you want to do?",
L"Demand surrender", L"Demand surrender",
L"Offer surrender", L"Offer surrender",
+2 -1
View File
@@ -2933,7 +2933,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go", 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"What do you want to do?",
L"Demand surrender", L"Demand surrender",
L"Offer surrender", L"Offer surrender",
+5 -4
View File
@@ -2931,12 +2931,13 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // 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"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"Was möchten Sie tun?",
L"Aufgabe einfordern", L"Kapitulation fordern",
L"Aufgabe anbieten", L"Kapitulation anbieten",
L"Sprechen", L"Sprechen",
L"Militia inspection",//TODO.Translate L"Miliz inspizieren",
L"unused", L"unused",
}; };
+2 -1
View File
@@ -2921,7 +2921,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go", 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"What do you want to do?",
L"Demand surrender", L"Demand surrender",
L"Offer surrender", L"Offer surrender",
+2 -1
View File
@@ -2936,7 +2936,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go", 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"What do you want to do?",
L"Demand surrender", L"Demand surrender",
L"Offer surrender", L"Offer surrender",
+2 -1
View File
@@ -2928,7 +2928,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // added by Flugente: decide what to do with prisoners
L"У вас нет тюрьмы для содержания заключённых, придётся отпустить их", L"У вас нет тюрьмы для содержания заключённых, придётся отпустить их",
L"Да - Отправить заключенных в тюрьму Нет - Отпустит", L"Where do you want to send the prisoners?",//TODO.Translate
L"Let them go",
L"Что вы хотите сделать?", L"Что вы хотите сделать?",
L"Требовать сдаться", L"Требовать сдаться",
L"Предлоить сдаться", L"Предлоить сдаться",
+2 -1
View File
@@ -2930,7 +2930,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners // added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go", 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"What do you want to do?",
L"Demand surrender", L"Demand surrender",
L"Offer surrender", L"Offer surrender",