Added: Ctrl+Shift+E now fill LBE items in sector with other items and places them in vehicles first.

Added: Right-Click on remove attachments button on sector inventory screen will not empty LBE items in sector
Changed: SLAY_STAYS_FOREVER disables Slay's hourly chance to leave when unattended
Added: SLAY_HOURLY_CHANCE_TO_LEAVE setting to Ja2_Options.ini
Fixed: a bunch of array index out of bounds bugs
Fixed: a bunch of typos in if contitions
Fixed: BuildListFile() function loading items from index 1 instead 0
Added translation: Polish text for some map inventory screen items
Added translation: English texts for new functionality for other language files
Cleaned up some old TODOs

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8404 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
TheBob
2017-05-19 13:40:34 +00:00
parent dc350d724d
commit b60a94afc5
39 changed files with 565 additions and 146 deletions
+60 -11
View File
@@ -8248,7 +8248,8 @@ BOOLEAN ArmBomb( OBJECTTYPE * pObj, INT8 bSetting )
return( TRUE );
}
BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNewObj, UINT8 subObject, SOLDIERTYPE * pSoldier, BOOLEAN fForceInseperable, BOOLEAN fRemoveProhibited )
// pAttachment will be filled with garbage data, pass a new OBJECTTYPE as pNewObj to get the removed attachment or pass NULL to indicate the attachment is to be deleted
BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE * pAttachment, OBJECTTYPE * pNewObj, UINT8 subObject, SOLDIERTYPE * pSoldier, BOOLEAN fForceInseperable, BOOLEAN fRemoveProhibited )
{
BOOLEAN objDeleted = FALSE;
std::vector<UINT16> usAttachmentSlotIndexVector;
@@ -8280,20 +8281,31 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
//This is so that you can click to remove an attachment and it will take off THAT attachment and not the first one that just "looks" like it.
for (std::list<OBJECTTYPE>::iterator iter = (*this)[subObject]->attachments.begin();
iter != (*this)[subObject]->attachments.end(); ++iter){
//Compare the adress
if(&(*iter) == pAttachment)
{
removedAttachment = *pAttachment;
iter = (*this)[subObject]->RemoveAttachmentAtIter(iter);
pAttachment = NULL;
objDeleted = TRUE;
break;
}
// Bob: sanity check!
if (pAttachment != NULL && pAttachment->usItem > 0 && (pAttachment->ubNumberOfObjects != 1 || pAttachment->usItem > MAXITEMS || pAttachment->ubMission != 0)) {
__debugbreak();
}
//Compare the adress
if(&(*iter) == pAttachment)
{
removedAttachment = *pAttachment;
iter = (*this)[subObject]->RemoveAttachmentAtIter(iter);
pAttachment = NULL;
objDeleted = TRUE;
break;
}
}
//It is possible that the previous loop did not find the EXACT attachment we wanted to delete, look if there is one that is at least equal in data.
if(!objDeleted){
for (std::list<OBJECTTYPE>::iterator iter = (*this)[subObject]->attachments.begin();
iter != (*this)[subObject]->attachments.end(); ++iter){
// Bob: sanity check!
if (pAttachment != NULL && pAttachment->usItem > 0 && (pAttachment->ubNumberOfObjects != 1 || pAttachment->usItem > MAXITEMS || pAttachment->ubMission != 0)) {
__debugbreak();
}
//This compares the internal data of the objects.
if(*iter == *pAttachment)
{
@@ -8305,9 +8317,20 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
}
}
}
// Bob: sanity check!
if (pAttachment != NULL && pAttachment->usItem > 0 && (pAttachment->ubNumberOfObjects != 1 || pAttachment->usItem > MAXITEMS || pAttachment->ubMission != 0)) {
__debugbreak();
}
if(!objDeleted)
return( FALSE );
// Bob: this function tends to leave this pointer in a messed up state, leading to other code to deal with bogus item data
if (pAttachment != NULL) {
__debugbreak();
}
//After removing an attachment, the ammo capacity might have changed.
if ( Item[this->usItem].usItemClass == IC_GUN && (*this)[subObject]->data.gun.usGunAmmoItem != NONE && (*this)[subObject]->data.gun.ubGunShotsLeft > 0 && oldMagSize != GetMagSize(this, subObject) )
{
@@ -8399,8 +8422,23 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
RemoveProhibitedAttachments(pSoldier, &removedAttachment, removedAttachment.usItem);
RemoveProhibitedAttachments(pSoldier, this, this->usItem);
}
if(pNewObj != NULL)
// Bob: this function tends to leave this pointer in a messed up state, leading to other code to deal with bogus item data
if (pAttachment != NULL) {
__debugbreak();
}
if (pNewObj != NULL) {
*pNewObj = removedAttachment;
}
else {
*pAttachment = removedAttachment;
}
// Bob: this function tends to leave this pointer in a messed up state, leading to other code to deal with bogus item data
if (pAttachment != NULL) {
__debugbreak();
}
// Why is this here? By now, the object, pAttachment had been pointing to, has already been deconstructed via RemoveAttachmentAtIter.
@@ -8425,11 +8463,22 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
pNewObj->AttachObject(NULL, &tmp, FALSE, 0, -1, 0);
}
}
// Bob: this function tends to leave this pointer in a messed up state, leading other code to deal with bogus item data
if (pAttachment != NULL) {
__debugbreak();
}
//Removing an attachment can alter slots, check them.
if(UsingNewAttachmentSystem()==true && fRemoveProhibited){
RemoveProhibitedAttachments(pSoldier, this, this->usItem);
}
// Bob: this function tends to leave this pointer in a messed up state, leading to other code to deal with bogus item data
if (pAttachment != NULL) {
__debugbreak();
}
//ADB ubWeight has been removed, see comments in OBJECTTYPE
//this->ubWeight = CalculateObjectWeight( this );
return( TRUE );