mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
cleaned up code: various stuff (out-of-bounds, null-pointer, uninitialized vars,...) (by CleaningWoman)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6101 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -4042,6 +4042,7 @@ void Console::CopyTextToClipboard() {
|
||||
// lock the handle and copy the text to the buffer.
|
||||
wchar_t* pszData = (wchar_t*)::GlobalLock(hglbData);
|
||||
|
||||
if (pszData)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nSelRows; ++i) {
|
||||
|
||||
@@ -1943,6 +1943,10 @@ BOOLEAN DisplayBigItemImage(UINT16 usIndex, UINT16 PosY)
|
||||
sOffsetX = hPixHandle->p16BPPObject->sOffsetX;
|
||||
sOffsetY = hPixHandle->p16BPPObject->sOffsetY;
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(false);
|
||||
}
|
||||
|
||||
// sCenX = PosX + ( abs( BOBBYR_GRID_PIC_WIDTH - usWidth ) / 2 );
|
||||
// sCenY = PosY + 8;
|
||||
|
||||
@@ -1104,7 +1104,7 @@ void DisplayPurchasedItems( BOOLEAN fCalledFromOrderPage, UINT16 usGridX, UINT16
|
||||
if( pBobbyRayPurchase[i].fUsed )
|
||||
{
|
||||
LoadBRName(pBobbyRayPurchase[i].usItemIndex,sBack);
|
||||
swprintf(sText, L"%s %s", "*", sBack);
|
||||
swprintf(sText, L"%s %s", L"*", sBack);
|
||||
}
|
||||
else
|
||||
LoadBRName(pBobbyRayPurchase[i].usItemIndex,sText);
|
||||
@@ -1309,7 +1309,7 @@ void DisplayShippingCosts( BOOLEAN fCalledFromOrderPage, INT32 iSubTotal, UINT16
|
||||
while(spi != gShipmentTable[iOrderNum]->ShipmentPackages.end())
|
||||
{
|
||||
uiPackageWeight += Item[((ShipmentPackageStruct&)*spi).usItemIndex].ubWeight;
|
||||
spi++;
|
||||
++spi;
|
||||
}
|
||||
|
||||
uiPackageWeight = uiPackageWeight > 20 ? uiPackageWeight : 20;
|
||||
@@ -2883,13 +2883,13 @@ BOOLEAN NewWayOfLoadingBobbyRMailOrdersToSaveGameFile( HWFILE hFile )
|
||||
{
|
||||
//Allocate memory for the list
|
||||
gpNewBobbyrShipments = (NewBobbyRayOrderStruct *) MemAlloc( sizeof( NewBobbyRayOrderStruct ) * giNumberOfNewBobbyRShipment );
|
||||
memset(gpNewBobbyrShipments, 0, (sizeof( NewBobbyRayOrderStruct ) * giNumberOfNewBobbyRShipment) );
|
||||
|
||||
if( gpNewBobbyrShipments == NULL )
|
||||
if( gpNewBobbyrShipments == NULL )
|
||||
{
|
||||
Assert(0);
|
||||
return(FALSE );
|
||||
}
|
||||
memset(gpNewBobbyrShipments, 0, (sizeof( NewBobbyRayOrderStruct ) * giNumberOfNewBobbyRShipment) );
|
||||
|
||||
//loop through and load all the mail order slots
|
||||
for( iCnt=0; iCnt<giNumberOfNewBobbyRShipment; iCnt++ )
|
||||
|
||||
@@ -164,7 +164,7 @@ void HandleCharProfile()
|
||||
if( fDoneLoadPending == FALSE )
|
||||
{
|
||||
//make sure we are not hosing memory
|
||||
Assert( iCurrentImpPage <= IMP_NUM_PAGES );
|
||||
Assert( iCurrentImpPage < IMP_NUM_PAGES );
|
||||
|
||||
|
||||
fFastLoadFlag = HasTheCurrentIMPPageBeenVisited( );
|
||||
@@ -808,7 +808,7 @@ BOOLEAN HasTheCurrentIMPPageBeenVisited( void )
|
||||
// returns if we have vsisted the current IMP PageAlready
|
||||
|
||||
//make sure we are not hosing memory
|
||||
Assert( iCurrentImpPage <= IMP_NUM_PAGES );
|
||||
Assert( iCurrentImpPage < IMP_NUM_PAGES );
|
||||
|
||||
return ( fVisitedIMPSubPages[ iCurrentImpPage ]);
|
||||
}
|
||||
|
||||
@@ -1232,7 +1232,7 @@ INT32 iBonusPointsNeededForLevelUp()
|
||||
|
||||
INT32 iBonusPointsRecievedForLevelDown()
|
||||
{
|
||||
INT32 iBonusPointsRecieved;
|
||||
INT32 iBonusPointsRecieved=0;
|
||||
|
||||
if (iStartingLevel > 1 && iStartingLevel <= 10)
|
||||
{
|
||||
|
||||
@@ -1691,6 +1691,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex )
|
||||
MakeProfileInvItemAnySlot(pProfile,usItem,100,1);
|
||||
|
||||
// give ammo for guns
|
||||
Assert(usItem<MAXITEMS);
|
||||
if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher )
|
||||
{
|
||||
usItem = DefaultMagazine(usItem);
|
||||
|
||||
@@ -304,7 +304,7 @@ void HandleIMPDisabilityTraitAnswers( UINT32 uiSkillPressed )
|
||||
}
|
||||
|
||||
//make sure its a valid disability trait
|
||||
if( uiSkillPressed > IMP_DISABILITIES_NUMBER )
|
||||
if( uiSkillPressed >= IMP_DISABILITIES_NUMBER )
|
||||
{
|
||||
Assert( 0 );
|
||||
return;
|
||||
|
||||
@@ -321,7 +321,7 @@ void HandleIMPMinorTraitAnswers( UINT32 uiSkillPressed )
|
||||
}
|
||||
|
||||
//make sure its a valid skill
|
||||
if( uiSkillPressed > IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS )
|
||||
if( uiSkillPressed >= IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS )
|
||||
{
|
||||
Assert( 0 );
|
||||
return;
|
||||
|
||||
+16
-15
@@ -125,22 +125,23 @@ EmailOtherEndElementHandle(void *userData, const XML_Char *name)
|
||||
if (!EmailOther_TextOnly)
|
||||
{
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szSubject, pData->curEmailOther.szSubject);
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[0], L"1. sdssdsfs dfg fdgd fgffdsf test" ); //pData->curEmailOther.szMessage[0]);
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[1], L"2. sdssdsfs dfg fgfgffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[2], L"3. sdssdsfsd gdfg fdfgfdg ffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[3], L"4. sdssdsf dgdfg dgsffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[4], L"5. sdssdsfdgdfg dgfd gsffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[5], L"6. sdssdsfsffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[6], L"7. sdssdsfsffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[7], L"8. sdssdsfsfdgdgfgfdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[8], L"9. sdssdsfsff dg dfgdg fg dfg dsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[9], L"10. sdssdsfsfgdsgdfgfdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[10], L"11. sdssdsfsff dgdf fgfdg dfgd dsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[11], L"12. sdssdsfsf dfg dfgf gdfg dsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[12], L"13. sdssdsfsf dfgdfgdf gdfg gfdsf test" );
|
||||
// L"12345678901234567890123456789" <- max lenght (szMessage[30])
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[0], L"1. sdssdsfs dfg fdgd fg test" ); //pData-curEmailOther.szMessage[0]);
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[1], L"2. sdssdsfs dfg fgfgffds test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[2], L"3. sdssdsfsd gdfg fdfgsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[3], L"4. sdssdsf dgdfg dgsfdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[4], L"5. sdssdsfdgdfg dgfddsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[5], L"6. sdssdsfsffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[6], L"7. sdssdsfsffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[7], L"8. sdssdsfsfdgdgfgfdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[8], L"9. sdssdsfsff dg gdg dsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[9], L"10. sdssdsfsfgdsgdfgfdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[10], L"11. sdssdsfsff dgfgd dsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[11], L"12. sdssdsfsf dfgdfg dsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[12], L"13. sdssdsfsf dfgg gfdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[13], L"14. sdssdsf dgdf gsffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[14], L"15. sdssdsf dgdf dfg d gdf ffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[15], L"16. sdssdsfs dgdfg fdg dgdfg gffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[14], L"15. sdssdsf dgdf f ffdsf test" );
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[15], L"16. sdssdsfs dgdf gffdsf test" );
|
||||
|
||||
/*
|
||||
wcscpy(EmailOtherText[pData->curEmailOther.uiIndex].szMessage[1], pData->curEmailOther.szMessage[1]);
|
||||
|
||||
@@ -71,7 +71,7 @@ BOOLEAN bMERC;
|
||||
|
||||
BOOLEAN LoadEncyclopediaMercBio( UINT8 ubIndex, STR16 pInfoString, STR16 pAddInfo,UINT32 Type )
|
||||
{
|
||||
HWFILE hFile;
|
||||
HWFILE hFile=NULL;
|
||||
UINT32 uiBytesRead;
|
||||
//UINT16 i;
|
||||
UINT32 uiStartSeekAmount;
|
||||
@@ -822,7 +822,7 @@ encyclopediaLocationEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curEncyclopediaData.szFile,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS);
|
||||
pData->curEncyclopediaData.szFile[MAX_ENCYCLOPEDIA_CHARS] = '\0';
|
||||
pData->curEncyclopediaData.szFile[MAX_ENCYCLOPEDIA_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ENCYCLOPEDIA_CHARS);i++)
|
||||
@@ -841,7 +841,7 @@ encyclopediaLocationEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curEncyclopediaData.szFile2,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS);
|
||||
pData->curEncyclopediaData.szFile2[MAX_ENCYCLOPEDIA_CHARS] = '\0';
|
||||
pData->curEncyclopediaData.szFile2[MAX_ENCYCLOPEDIA_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ENCYCLOPEDIA_CHARS);i++)
|
||||
@@ -860,7 +860,7 @@ encyclopediaLocationEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curEncyclopediaData.szFile3,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS);
|
||||
pData->curEncyclopediaData.szFile3[MAX_ENCYCLOPEDIA_CHARS] = '\0';
|
||||
pData->curEncyclopediaData.szFile3[MAX_ENCYCLOPEDIA_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ENCYCLOPEDIA_CHARS);i++)
|
||||
@@ -879,7 +879,7 @@ encyclopediaLocationEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curEncyclopediaData.szFile4,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS);
|
||||
pData->curEncyclopediaData.szFile4[MAX_ENCYCLOPEDIA_CHARS] = '\0';
|
||||
pData->curEncyclopediaData.szFile4[MAX_ENCYCLOPEDIA_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ENCYCLOPEDIA_CHARS);i++)
|
||||
@@ -972,7 +972,7 @@ encyclopediaLocationEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curEncyclopediaData.BeforeImage,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS);
|
||||
pData->curEncyclopediaData.BeforeImage[MAX_ENCYCLOPEDIA_CHARS] = '\0';
|
||||
pData->curEncyclopediaData.BeforeImage[MAX_ENCYCLOPEDIA_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ENCYCLOPEDIA_CHARS);i++)
|
||||
@@ -990,7 +990,7 @@ encyclopediaLocationEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curEncyclopediaData.AfterImage,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS);
|
||||
pData->curEncyclopediaData.AfterImage[MAX_ENCYCLOPEDIA_CHARS] = '\0';
|
||||
pData->curEncyclopediaData.AfterImage[MAX_ENCYCLOPEDIA_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ENCYCLOPEDIA_CHARS);i++)
|
||||
@@ -1049,7 +1049,7 @@ encyclopediaLocationEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curEncyclopediaData.sSounds,pData->szCharData,MAX_ENCYCLOPEDIA_CHARS);
|
||||
pData->curEncyclopediaData.sSounds[MAX_ENCYCLOPEDIA_CHARS] = '\0';
|
||||
pData->curEncyclopediaData.sSounds[MAX_ENCYCLOPEDIA_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ENCYCLOPEDIA_CHARS);i++)
|
||||
|
||||
+1
-1
@@ -1560,7 +1560,7 @@ void SwapMessages(INT32 iIdA, INT32 iIdB)
|
||||
// wcscpy(pTemp->pSubject,EmailOtherText[pA->usLength].szSubject);
|
||||
else if ( pA->EmailVersion == TYPE_EMAIL_BOBBY_R || pA->EmailVersion == TYPE_EMAIL_BOBBY_R_EMAIL_JA2_EDT )
|
||||
wcscpy(pTemp->pSubject,pA->pSubject);
|
||||
else if ( pA->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pA->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT )
|
||||
else if ( pA->EmailVersion == TYPE_EMAIL_EMAIL_EDT || pA->EmailVersion == TYPE_EMAIL_INSURANCE_COMPANY_EMAIL_JA2_EDT || pA->EmailVersion == TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT )
|
||||
wcscpy(pTemp->pSubject,pA->pSubject);
|
||||
|
||||
// pA becomes pB
|
||||
|
||||
@@ -746,6 +746,8 @@ void DrawRecordsColumnHeadersText( void )
|
||||
|
||||
void DrawRecordsText( void )
|
||||
{
|
||||
Assert(pFinanceListHead);
|
||||
|
||||
// draws the text of the records
|
||||
FinanceUnitPtr pCurFinance=pCurrentFinance;
|
||||
FinanceUnitPtr pTempFinance=pFinanceListHead;
|
||||
|
||||
+3
-4
@@ -1543,7 +1543,7 @@ void HandleTalkingSpeck()
|
||||
gsSpeckDialogueTextPopUp[0] = '\0';
|
||||
|
||||
//Start speck talking
|
||||
if( gusMercVideoSpeckSpeech != MERC_VIDEO_SPECK_SPEECH_NOT_TALKING || gusMercVideoSpeckSpeech != MERC_VIDEO_SPECK_HAS_TO_TALK_BUT_QUOTE_NOT_CHOSEN_YET )
|
||||
if( gusMercVideoSpeckSpeech != MERC_VIDEO_SPECK_SPEECH_NOT_TALKING && gusMercVideoSpeckSpeech != MERC_VIDEO_SPECK_HAS_TO_TALK_BUT_QUOTE_NOT_CHOSEN_YET )
|
||||
StartSpeckTalking( gusMercVideoSpeckSpeech );
|
||||
|
||||
gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_SPEECH_NOT_TALKING;
|
||||
@@ -2462,7 +2462,7 @@ INT16 GetRandomQuoteThatHasBeenSaidTheLeast( )
|
||||
if( CanMercQuoteBeSaid( gNumberOfTimesQuoteSaid[cnt].ubQuoteID ) )
|
||||
{
|
||||
//if this quote has been said less times then the last one
|
||||
if( gNumberOfTimesQuoteSaid[cnt].uiNumberOfTimesQuoteSaid < gNumberOfTimesQuoteSaid[ sSmallestNumber ].uiNumberOfTimesQuoteSaid )
|
||||
if( sSmallestNumber==255 || gNumberOfTimesQuoteSaid[cnt].uiNumberOfTimesQuoteSaid < gNumberOfTimesQuoteSaid[ sSmallestNumber ].uiNumberOfTimesQuoteSaid )
|
||||
{
|
||||
sSmallestNumber = cnt;
|
||||
}
|
||||
@@ -2688,7 +2688,6 @@ void MakeBiffAwayForCoupleOfDays()
|
||||
|
||||
BOOLEAN AreAnyOfTheNewMercsAvailable()
|
||||
{
|
||||
UINT8 i;
|
||||
UINT8 ubMercID;
|
||||
|
||||
|
||||
@@ -2696,7 +2695,7 @@ BOOLEAN AreAnyOfTheNewMercsAvailable()
|
||||
return( FALSE );
|
||||
|
||||
//for(i=(LARRY_NORMAL-BIFF); i<=LaptopSaveInfo.gubLastMercIndex; i++)
|
||||
for(i=0; i<=NUM_PROFILES; i++)
|
||||
for(UINT16 i=0; i<=NUM_PROFILES; i++)
|
||||
{
|
||||
if ( gConditionsForMercAvailability[i].NewMercsAvailable == FALSE && gProfilesMERC[i].ProfilId != 0 )
|
||||
{
|
||||
|
||||
+17
-14
@@ -1736,6 +1736,7 @@ void start_battle ( void )
|
||||
}
|
||||
|
||||
//SOLDIERTYPE *pSoldier = MercPtrs[ 0 ];
|
||||
Assert(pSoldier);
|
||||
UINT8 ubGroupID = pSoldier->ubGroupID;
|
||||
|
||||
GROUP *pGroup;
|
||||
@@ -3376,7 +3377,7 @@ void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldItem, UINT8 ubID)
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
CHAR tmpMPDbgString[512];
|
||||
sprintf(tmpMPDbgString,"MP - send_disarm_explosive ( MPTeam : %i , uiWorldIndex : %i , uiPreRandomIndex : %i , sGridNo : %i )\n",disarm.ubMPTeamIndex, disarm.uiWorldItemIndex , disarm.uiPreRandomIndex );
|
||||
sprintf(tmpMPDbgString,"MP - send_disarm_explosive ( MPTeam : %i , uiWorldIndex : %i , uiPreRandomIndex : %i , sGridNo : %i )\n", disarm.ubMPTeamIndex, disarm.uiWorldItemIndex , disarm.uiPreRandomIndex, disarm.sGridNo);
|
||||
MPDebugMsg(tmpMPDbgString);
|
||||
gfMPDebugOutputRandoms = true;
|
||||
#endif
|
||||
@@ -3842,9 +3843,9 @@ void send_death( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
SOLDIERTYPE * pAttacker=MercPtrs[ nDeath.attacker_id ];
|
||||
INT8 pA_bTeam;
|
||||
INT8 pA_bTeam=CLIENT_NUM;
|
||||
CHAR16 pA_name[ 10 ];
|
||||
INT8 pS_bTeam;
|
||||
INT8 pS_bTeam=CLIENT_NUM;
|
||||
CHAR16 pS_name[ 10 ];
|
||||
|
||||
// OJW - 20081222
|
||||
@@ -3915,23 +3916,25 @@ void send_death( SOLDIERTYPE *pSoldier )
|
||||
client->RPC("sendDEATH",(const char*)&nDeath, (int)sizeof(death_struct)*8, HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0);
|
||||
|
||||
// print kill notice to screen
|
||||
if (pSoldier->bTeam==1)
|
||||
if (pSoldier && pSoldier->bTeam==1)
|
||||
ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, MPClientMessage[67]);
|
||||
else
|
||||
ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, MPClientMessage[28],pS_name,(pS_bTeam),client_names[(pS_bTeam-1)],pA_name,(pA_bTeam),client_names[(pA_bTeam-1)] );
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
char s_name[10];
|
||||
char a_name[10];
|
||||
WideCharToMultiByte(CP_UTF8,0,pS_name,-1, s_name,10,NULL,NULL);
|
||||
WideCharToMultiByte(CP_UTF8,0,pA_name,-1, a_name,10,NULL,NULL);
|
||||
if (pSoldier) {
|
||||
char s_name[10];
|
||||
char a_name[10];
|
||||
WideCharToMultiByte(CP_UTF8,0,pS_name,-1, s_name,10,NULL,NULL);
|
||||
WideCharToMultiByte(CP_UTF8,0,pA_name,-1, a_name,10,NULL,NULL);
|
||||
|
||||
if (pSoldier->bTeam==1)
|
||||
MPDebugMsg( String ( "MPDEBUG SEND - Enemy AI #%d was killed by ('%s' - %d) (client %d - '%s')\n",nDeath.soldier_id,a_name,nDeath.attacker_id,pA_bTeam,client_names[pA_bTeam-1]) );
|
||||
else if (pAttacker->bTeam==1)
|
||||
MPDebugMsg( String ( "MPDEBUG SEND - '%s' (client %d - '%S') was killed by '%s' (client %d - '%s')\n",s_name,pS_bTeam,client_names[(pS_bTeam-1)],a_name,pA_bTeam,"Queens Army") );
|
||||
else
|
||||
MPDebugMsg( String ( "MPDEBUG SEND - '%s' (client %d - '%S') was killed by '%s' (client %d - '%s')\n",s_name,pS_bTeam,client_names[(pS_bTeam-1)],a_name,pA_bTeam,client_names[(pA_bTeam-1)]) );
|
||||
if (pSoldier->bTeam==1)
|
||||
MPDebugMsg( String ( "MPDEBUG SEND - Enemy AI #%d was killed by ('%s' - %d) (client %d - '%s')\n",nDeath.soldier_id,a_name,nDeath.attacker_id,pA_bTeam,client_names[pA_bTeam-1]) );
|
||||
else if (pAttacker->bTeam==1)
|
||||
MPDebugMsg( String ( "MPDEBUG SEND - '%s' (client %d - '%S') was killed by '%s' (client %d - '%s')\n",s_name,pS_bTeam,client_names[(pS_bTeam-1)],a_name,pA_bTeam,"Queens Army") );
|
||||
else
|
||||
MPDebugMsg( String ( "MPDEBUG SEND - '%s' (client %d - '%S') was killed by '%s' (client %d - '%s')\n",s_name,pS_bTeam,client_names[(pS_bTeam-1)],a_name,pA_bTeam,client_names[(pA_bTeam-1)]) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -238,6 +238,7 @@ void sendHIT(RPCParameters *rpcParameters)
|
||||
else if (team == 0)
|
||||
team = CLIENT_NUM-1; // this case should not be possible, including as a precaution
|
||||
|
||||
Assert(team<5); // FIXME
|
||||
gMPPlayerStats[team].hits++;
|
||||
|
||||
server->RPC("recieveHIT",(const char*)rpcParameters->input, (*rpcParameters).numberOfBitsOfData, HIGH_PRIORITY, RELIABLE, 0, rpcParameters->sender, true, 0, UNASSIGNED_NETWORK_ID,0);
|
||||
@@ -386,6 +387,7 @@ void sendhitSTRUCT(RPCParameters *rpcParameters)
|
||||
else if (team == 0)
|
||||
team = CLIENT_NUM-1; // this case should not be possible, including as a precaution
|
||||
|
||||
Assert(team<5); // FIXME
|
||||
gMPPlayerStats[team].misses++;
|
||||
}
|
||||
|
||||
@@ -410,6 +412,7 @@ void sendhitWINDOW(RPCParameters *rpcParameters)
|
||||
else if (team == 0)
|
||||
team = CLIENT_NUM-1; // this case should not be possible, including as a precaution
|
||||
|
||||
Assert(team<5); // FIXME
|
||||
gMPPlayerStats[team].misses++;
|
||||
}
|
||||
|
||||
@@ -433,6 +436,7 @@ void sendMISS(RPCParameters *rpcParameters)
|
||||
else if (team == 0)
|
||||
team = CLIENT_NUM-1; // this case should not be possible, including as a precaution
|
||||
|
||||
Assert(team<5); // FIXME
|
||||
gMPPlayerStats[team].misses++;
|
||||
}
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ UINT32 LoadIndex;
|
||||
void UnloadFont(UINT32 FontIndex)
|
||||
{
|
||||
Assert(FontIndex >= 0);
|
||||
Assert(FontIndex <= MAX_FONTS);
|
||||
Assert(FontIndex < MAX_FONTS);
|
||||
Assert(FontObjs[FontIndex]!=NULL);
|
||||
|
||||
DeleteVideoObject(FontObjs[FontIndex]);
|
||||
|
||||
@@ -405,7 +405,7 @@ void MemFreeLocked( PTR ptr, UINT32 uiSize )
|
||||
if (ptr != NULL)
|
||||
{
|
||||
VirtualUnlock( ptr, uiSize );
|
||||
VirtualFree( ptr, uiSize, MEM_RELEASE );
|
||||
VirtualFree( ptr, 0, MEM_RELEASE );
|
||||
|
||||
guiMemTotal -= uiSize;
|
||||
guiMemFreed += uiSize;
|
||||
|
||||
@@ -473,6 +473,9 @@ void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
|
||||
BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
|
||||
{
|
||||
EnterCriticalSection(&gcsInputQueueLock);
|
||||
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
__try
|
||||
{
|
||||
// Is there an event to dequeue
|
||||
@@ -483,16 +486,16 @@ BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
|
||||
// Check if it has the masks!
|
||||
if ( ( Event->usEvent & uiMaskFlags ) )
|
||||
{
|
||||
return( DequeueEvent( Event) );
|
||||
result = DequeueEvent( Event);
|
||||
}
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
__finally
|
||||
{
|
||||
LeaveCriticalSection(&gcsInputQueueLock);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOLEAN InternalDequeueEvent(InputAtom *Event)
|
||||
@@ -529,15 +532,18 @@ BOOLEAN InternalDequeueEvent(InputAtom *Event)
|
||||
|
||||
BOOLEAN DequeueEvent(InputAtom *Event)
|
||||
{
|
||||
BOOLEAN result = FALSE;
|
||||
__try
|
||||
{
|
||||
EnterCriticalSection(&gcsInputQueueLock);
|
||||
return InternalDequeueEvent(Event);
|
||||
result = InternalDequeueEvent(Event);
|
||||
}
|
||||
__finally
|
||||
{
|
||||
LeaveCriticalSection(&gcsInputQueueLock);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1871,7 +1871,7 @@ static void PopulateSectionFromCommandLine(vfs::PropertyContainer &oProps, vfs::
|
||||
wchar_t *psep = wcspbrk(arg, L":=");
|
||||
wchar_t *param = (psep ? psep+1 : NULL);
|
||||
if (psep) *psep = 0;
|
||||
if ( (param == NULL || param[0] == 0) && ( i+1<argc && ( argv[i+1][0] != L'-' || argv[i+1][0] != L'/' ) ) ) {
|
||||
if ( (param == NULL || param[0] == 0) && ( i+1<argc && ( argv[i+1][0] != L'-' && argv[i+1][0] != L'/' ) ) ) {
|
||||
param = argv[++i];
|
||||
argv[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -1345,7 +1345,7 @@ void CreatureAttackCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
{
|
||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
if( ( gsSelSectorX != 0 ) && ( gsSelSectorX != 0 ) )
|
||||
if( ( gsSelSectorX != 0 ) && ( gsSelSectorY != 0 ) )
|
||||
{
|
||||
if( _KeyDown( ALT ) )
|
||||
{
|
||||
|
||||
@@ -15279,7 +15279,7 @@ BOOLEAN DisplayFacilityAssignmentMenu( SOLDIERTYPE *pSoldier, UINT8 ubFacilityTy
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fFoundVehicle = FALSE)
|
||||
if (fFoundVehicle == FALSE)
|
||||
{
|
||||
// Create line that says "Repair Vehicle", and will be shaded.
|
||||
swprintf( sTempString, gzFacilityAssignmentStrings[ FAC_REPAIR_VEHICLE ], L"Vehicle" );
|
||||
@@ -16922,7 +16922,7 @@ void HandleShadingOfLinesForFacilityAssignmentMenu( void )
|
||||
fFoundVehicle = TRUE;
|
||||
}
|
||||
}
|
||||
if (fFoundVehicle = FALSE)
|
||||
if (fFoundVehicle == FALSE)
|
||||
{
|
||||
// The line here says "Repair Vehicle", and is shaded because there's no vehicle present.
|
||||
UnSecondaryShadeStringInBox( ghFacilityAssignmentBox, iNumLine );
|
||||
|
||||
@@ -3061,6 +3061,7 @@ void MercCellMouseClickCallback( MOUSE_REGION *reg, INT32 reason )
|
||||
}
|
||||
}
|
||||
|
||||
Assert(pCell);
|
||||
if( pCell->uiFlags & ( CELL_RETREATING | CELL_RETREATED ) )
|
||||
{ //already retreated/retreating.
|
||||
return;
|
||||
|
||||
@@ -784,9 +784,9 @@ ACTION_ITEM_VALUES ActionItemsValues[500];
|
||||
|
||||
void IniLuaGlobal()
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 i;
|
||||
|
||||
for (i= 0; i<=1000; i++ )
|
||||
for (i= 0; i<1000; i++ )
|
||||
{
|
||||
gLuaGlobal[i].fGlobalLuaBool = FALSE;
|
||||
gLuaGlobal[i].iGlobalLuaVal = 0;
|
||||
|
||||
@@ -4257,8 +4257,8 @@ void SortSectorInventoryAmmo(bool useBoxes)
|
||||
{
|
||||
|
||||
// Declarations
|
||||
INT32 crateItem;
|
||||
bool mergeSuccessful, ammoPresent;
|
||||
INT32 crateItem;
|
||||
bool mergeSuccessful = false;
|
||||
OBJECTTYPE newCrate;
|
||||
int loopCount = 0;
|
||||
|
||||
@@ -4267,7 +4267,7 @@ void SortSectorInventoryAmmo(bool useBoxes)
|
||||
AssertMsg( pSoldier != NULL, "Sector Inventory: Attempting ammo sort without valid selected soldier?" );
|
||||
|
||||
//MM: added for ammo boxes
|
||||
ammoPresent = true;
|
||||
bool ammoPresent = true;
|
||||
UINT8 magType = AMMO_CRATE;
|
||||
if (useBoxes)
|
||||
magType = AMMO_BOX;
|
||||
|
||||
@@ -1236,7 +1236,7 @@ char temp;
|
||||
else
|
||||
{
|
||||
strncpy(pData->curCityInfo.IconSTI,pData->szCharData,MAX_ICON_CHARS);
|
||||
pData->curCityInfo.IconSTI[MAX_ICON_CHARS] = '\0';
|
||||
pData->curCityInfo.IconSTI[MAX_ICON_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_ICON_CHARS);i++)
|
||||
@@ -4209,7 +4209,7 @@ void AllMercsWalkedToExitGrid()
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SANDRO - reset num enemies here if the sector was unloaded
|
||||
if( gWorldSectorX == 0 && gWorldSectorX == 0 && gbWorldSectorZ == -1 )
|
||||
if( gWorldSectorX == 0 && gWorldSectorY == 0 && gbWorldSectorZ == -1 )
|
||||
{
|
||||
memset( &(gTacticalStatus.bNumFoughtInBattle), 0, MAXTEAMS );
|
||||
}
|
||||
@@ -4396,7 +4396,7 @@ void AllMercsHaveWalkedOffSector( )
|
||||
SetDefaultSquadOnSectorEntry( TRUE );
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SANDRO - reset num enemies here if the sector was unloaded
|
||||
if( !fEnemiesInLoadedSector || (gWorldSectorX == 0 && gWorldSectorX == 0 && gbWorldSectorZ == -1 ) )
|
||||
if( !fEnemiesInLoadedSector || (gWorldSectorX == 0 && gWorldSectorY == 0 && gbWorldSectorZ == -1 ) )
|
||||
{
|
||||
memset( &(gTacticalStatus.bNumFoughtInBattle), 0, MAXTEAMS );
|
||||
}
|
||||
|
||||
+1
-17
@@ -1604,23 +1604,7 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent )
|
||||
{
|
||||
if ( !UIHandleInteractiveTilesAndItemsOnTerrain( pSoldier, usMapPos, FALSE, TRUE ) )
|
||||
{
|
||||
// Are we in combat?
|
||||
if ( (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) )
|
||||
{
|
||||
// If so, draw path, etc
|
||||
fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, usMapPos, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Donot draw path until confirm
|
||||
fSetCursor = TRUE;
|
||||
|
||||
// If so, draw path, etc
|
||||
fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, usMapPos, 0 );
|
||||
|
||||
//ErasePath( TRUE );
|
||||
}
|
||||
|
||||
fSetCursor = HandleUIMovementCursor( pSoldier, uiCursorFlags, usMapPos, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -6235,7 +6235,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject )
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( pStr, L"--", iToHitValue );
|
||||
swprintf( pStr, L"--" );
|
||||
}
|
||||
FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY);
|
||||
mprintf( usX, usY, pStr );
|
||||
@@ -6298,7 +6298,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject )
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( pStr, L"--", iBestLaserRangeValue );
|
||||
swprintf( pStr, L"--" );
|
||||
}
|
||||
FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY);
|
||||
mprintf( usX, usY, pStr );
|
||||
@@ -10122,7 +10122,7 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject )
|
||||
if (iModifier[cnt2])
|
||||
{
|
||||
SetFontForeground( ITEMDESC_FONTPOSITIVE );
|
||||
swprintf( pStr, L"Y", iModifier[cnt2] );
|
||||
swprintf( pStr, L"Y", iModifier[cnt2] ); // FIXME: unused param
|
||||
FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -4408,7 +4408,7 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb
|
||||
if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
|
||||
{
|
||||
// Soldier doesn't know.
|
||||
swprintf( pStr, L"%s", "??" );
|
||||
swprintf( pStr, L"%s", L"??" );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4490,7 +4490,7 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb
|
||||
if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
|
||||
{
|
||||
// Soldier doesn't know.
|
||||
swprintf( pStr, L"%s", "??" );
|
||||
swprintf( pStr, L"%s", L"??" );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6501,7 +6501,7 @@ void RenderItemDescriptionBox( )
|
||||
sOffsetX = hVObject->p16BPPObject->sOffsetX;
|
||||
sOffsetY = hVObject->p16BPPObject->sOffsetY;
|
||||
}
|
||||
else if(hVObject->ubBitDepth == 32)
|
||||
else //if(hVObject->ubBitDepth == 32)
|
||||
{
|
||||
usHeight = hVObject->p16BPPObject->usHeight;
|
||||
usWidth = hVObject->p16BPPObject->usWidth;
|
||||
|
||||
@@ -7930,7 +7930,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
UINT32 uiLoop;
|
||||
UINT8 ubLoop2;
|
||||
// Flag to determine if the target is cowering (if allowed)
|
||||
BOOLEAN fCower;
|
||||
BOOLEAN fCower=FALSE;
|
||||
SOLDIERTYPE * pSoldier;
|
||||
// External options
|
||||
|
||||
|
||||
@@ -1019,7 +1019,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
||||
case ELDORADO:
|
||||
case ICECREAMTRUCK:
|
||||
case JEEP:
|
||||
if ( Soldier.ubProfile != HELICOPTER || Soldier.ubProfile != 0 || Soldier.ubProfile != NO_PROFILE || Soldier.ubProfile != TANK_CAR )
|
||||
if ( Soldier.ubProfile != HELICOPTER && Soldier.ubProfile != 0 && Soldier.ubProfile != NO_PROFILE && Soldier.ubProfile != TANK_CAR )
|
||||
{
|
||||
ubVehicleID = Soldier.ubProfile;
|
||||
Soldier.aiData.bNeutral = gNewVehicle[Soldier.ubProfile].bNewNeutral;
|
||||
@@ -3251,7 +3251,7 @@ INT32 GetSittableGridNoInRoom(UINT16 usRoom, BOOLEAN fEnoughSpace)
|
||||
UINT8 ubSectorId = SECTOR(gWorldSectorX, gWorldSectorY);
|
||||
if ( ubSectorId >= 0 && ubSectorId < 256 )
|
||||
{
|
||||
for ( UINT32 uiLoop = 0; uiLoop < WORLD_MAX; ++uiLoop )
|
||||
for ( INT32 uiLoop = 0; uiLoop < WORLD_MAX; ++uiLoop )
|
||||
{
|
||||
if ( (gusWorldRoomInfo[ uiLoop ] == usRoom) )
|
||||
{
|
||||
@@ -3494,9 +3494,11 @@ extern void DistributeInitialGear(MERCPROFILESTRUCT *pProfile);
|
||||
|
||||
void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruct )
|
||||
{
|
||||
UINT32 cnt, cnt2;
|
||||
MERCPROFILESTRUCT * pProfile;
|
||||
BOOLEAN success, fRet;
|
||||
UINT32 cnt, cnt2;
|
||||
MERCPROFILESTRUCT* pProfile;
|
||||
BOOLEAN success;
|
||||
BOOLEAN fRet;
|
||||
|
||||
|
||||
pProfile = &(gMercProfiles[pCreateStruct->ubProfile]);
|
||||
|
||||
@@ -3582,10 +3584,14 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
|
||||
}
|
||||
else
|
||||
{
|
||||
fRet=FALSE;
|
||||
|
||||
for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ )
|
||||
{
|
||||
|
||||
if ( pProfile->inv[ cnt ] != NOTHING )
|
||||
{
|
||||
|
||||
if ( Item[ pProfile->inv[ cnt ] ].usItemClass == IC_KEY )
|
||||
{
|
||||
// since keys depend on 2 values, they pretty much have to be hardcoded.
|
||||
|
||||
@@ -230,7 +230,7 @@ BOOLEAN WriteDrugsStats()
|
||||
UINT32 cnt;
|
||||
|
||||
FilePrintf(hFile,"<DRUGSLIST>\r\n");
|
||||
for(cnt = 0;cnt < MAXITEMS;cnt++)
|
||||
for(cnt = 0;cnt < DRUG_TYPE_MAX;cnt++)
|
||||
{
|
||||
FilePrintf(hFile,"\t<DRUG>\r\n");
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ BOOLEAN WriteFoodStats()
|
||||
UINT32 cnt;
|
||||
|
||||
FilePrintf(hFile,"<FOODSLIST>\r\n");
|
||||
for(cnt = 0; cnt < MAXITEMS; ++cnt)
|
||||
for(cnt = 0; cnt < FOOD_TYPE_MAX; ++cnt)
|
||||
{
|
||||
FilePrintf(hFile,"\t<FOOD>\r\n");
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ faceGearEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curFaceGear.szFile,pData->szCharData,MAX_FACE_GERA_CHARS);
|
||||
pData->curFaceGear.szFile[MAX_FACE_GERA_CHARS] = '\0';
|
||||
pData->curFaceGear.szFile[MAX_FACE_GERA_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_FACE_GERA_CHARS);i++)
|
||||
|
||||
@@ -118,7 +118,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szLocation,pData->szCharData,MAX_LOCATION_CHARS);
|
||||
pData->curSectorLoadscreens.szLocation[MAX_LOCATION_CHARS] = '\0';
|
||||
pData->curSectorLoadscreens.szLocation[MAX_LOCATION_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_LOCATION_CHARS);i++)
|
||||
@@ -142,7 +142,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szImageFormat,pData->szCharData,MAX_IMAGE_FORMAT_CHARS);
|
||||
pData->curSectorLoadscreens.szImageFormat[MAX_IMAGE_FORMAT_CHARS] = '\0';
|
||||
pData->curSectorLoadscreens.szImageFormat[MAX_IMAGE_FORMAT_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_FORMAT_CHARS);i++)
|
||||
@@ -161,7 +161,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szDay,pData->szCharData,MAX_IMAGE_PATH_CHARS);
|
||||
pData->curSectorLoadscreens.szDay[MAX_IMAGE_PATH_CHARS] = '\0';
|
||||
pData->curSectorLoadscreens.szDay[MAX_IMAGE_PATH_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_PATH_CHARS);i++)
|
||||
@@ -180,7 +180,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szNight,pData->szCharData,MAX_IMAGE_PATH_CHARS);
|
||||
pData->curSectorLoadscreens.szNight[MAX_IMAGE_PATH_CHARS] = '\0';
|
||||
pData->curSectorLoadscreens.szNight[MAX_IMAGE_PATH_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_PATH_CHARS);i++)
|
||||
@@ -199,7 +199,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szDayAlt,pData->szCharData,MAX_IMAGE_PATH_CHARS);
|
||||
pData->curSectorLoadscreens.szDayAlt[MAX_IMAGE_PATH_CHARS] = '\0';
|
||||
pData->curSectorLoadscreens.szDayAlt[MAX_IMAGE_PATH_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_PATH_CHARS);i++)
|
||||
@@ -218,7 +218,7 @@ sectorLoadscreensEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curSectorLoadscreens.szNightAlt,pData->szCharData,MAX_IMAGE_PATH_CHARS);
|
||||
pData->curSectorLoadscreens.szNightAlt[MAX_IMAGE_PATH_CHARS] = '\0';
|
||||
pData->curSectorLoadscreens.szNightAlt[MAX_IMAGE_PATH_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_IMAGE_PATH_CHARS);i++)
|
||||
|
||||
@@ -296,10 +296,10 @@ void InitNewVehicles ()
|
||||
gNewVehicle[ iCount ].bNewVehicle = FALSE;
|
||||
gNewVehicle[ iCount ].NewPilot = -1;
|
||||
gNewVehicle[ iCount ].NewCarPortraits = -1;
|
||||
gNewVehicle[ iCount ].szIconFace[MAX_MAIN_VEHICLE_CHARS] = '\0';
|
||||
gNewVehicle[ iCount ].NewVehicleStrings[128] = '\0';
|
||||
gNewVehicle[ iCount ].NewVehicleName[128] = '\0';
|
||||
gNewVehicle[ iCount ].NewShortVehicleStrings[128] = '\0';
|
||||
gNewVehicle[ iCount ].szIconFace[MAX_MAIN_VEHICLE_CHARS-1] = '\0';
|
||||
gNewVehicle[ iCount ].NewVehicleStrings[127] = '\0';
|
||||
gNewVehicle[ iCount ].NewVehicleName[127] = '\0';
|
||||
gNewVehicle[ iCount ].NewShortVehicleStrings[127] = '\0';
|
||||
gNewVehicle[ iCount ].NewUsed = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
+38
-33
@@ -2328,41 +2328,46 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData
|
||||
{
|
||||
pSoldier = FindSoldierByProfileID( ubNPC, FALSE );
|
||||
|
||||
// stupid hack CC
|
||||
if (pSoldier && ubNPC == KYLE)
|
||||
{
|
||||
// make sure he has keys
|
||||
pSoldier->flags.bHasKeys = TRUE;
|
||||
}
|
||||
if (pSoldier && pSoldier->sGridNo == pQuotePtr->usGoToGridNo )
|
||||
{
|
||||
// search for quotes to trigger immediately!
|
||||
pSoldier->ubQuoteRecord = ubRecordNum + 1; // add 1 so that the value is guaranteed nonzero
|
||||
NPCReachedDestination( pSoldier, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
// turn off cowering
|
||||
if ( pNPC->flags.uiStatusFlags & SOLDIER_COWERING)
|
||||
{
|
||||
//pNPC->flags.uiStatusFlags &= ~SOLDIER_COWERING;
|
||||
pNPC->EVENT_InitNewSoldierAnim( STANDING, 0 , FALSE );
|
||||
}
|
||||
|
||||
if (pSoldier)
|
||||
{
|
||||
// stupid hack CC
|
||||
if (ubNPC == KYLE)
|
||||
{
|
||||
// make sure he has keys
|
||||
pSoldier->flags.bHasKeys = TRUE;
|
||||
}
|
||||
|
||||
pSoldier->ubQuoteRecord = ubRecordNum + 1; // add 1 so that the value is guaranteed nonzero
|
||||
if (pSoldier->sGridNo == pQuotePtr->usGoToGridNo )
|
||||
{
|
||||
// search for quotes to trigger immediately!
|
||||
pSoldier->ubQuoteRecord = ubRecordNum + 1; // add 1 so that the value is guaranteed nonzero
|
||||
NPCReachedDestination( pSoldier, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
// turn off cowering
|
||||
if ( pNPC->flags.uiStatusFlags & SOLDIER_COWERING) // FIXME: Dereferencing null pointer
|
||||
{
|
||||
//pNPC->flags.uiStatusFlags &= ~SOLDIER_COWERING;
|
||||
pNPC->EVENT_InitNewSoldierAnim( STANDING, 0 , FALSE );
|
||||
}
|
||||
|
||||
if (pQuotePtr->sActionData == NPC_ACTION_TELEPORT_NPC)
|
||||
{
|
||||
BumpAnyExistingMerc( pQuotePtr->usGoToGridNo );
|
||||
TeleportSoldier( pSoldier, pQuotePtr->usGoToGridNo, FALSE );
|
||||
// search for quotes to trigger immediately!
|
||||
NPCReachedDestination( pSoldier, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
NPCGotoGridNo( ubNPC, pQuotePtr->usGoToGridNo, ubRecordNum );
|
||||
}
|
||||
}
|
||||
pSoldier->ubQuoteRecord = ubRecordNum + 1; // add 1 so that the value is guaranteed nonzero
|
||||
|
||||
if (pQuotePtr->sActionData == NPC_ACTION_TELEPORT_NPC)
|
||||
{
|
||||
BumpAnyExistingMerc( pQuotePtr->usGoToGridNo );
|
||||
TeleportSoldier( pSoldier, pQuotePtr->usGoToGridNo, FALSE );
|
||||
// search for quotes to trigger immediately!
|
||||
NPCReachedDestination( pSoldier, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
NPCGotoGridNo( ubNPC, pQuotePtr->usGoToGridNo, ubRecordNum );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger other NPC?
|
||||
|
||||
@@ -650,7 +650,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
|
||||
#ifdef JA2BETAVERSION
|
||||
if (is_networked) {
|
||||
CHAR tmpMPDbgString[512];
|
||||
sprintf(tmpMPDbgString,"ExplosiveDamageStructureAtGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompMoveCosts : %i , fOnlyWalls : %i , SubsMulTilTransDmg : %i , ubOwner : %i , bLevel : %i )\n",sGridNo, sWoundAmt , (int)*pfRecompileMovementCosts , (int)fOnlyWalls , (int)fSubSequentMultiTilesTransitionDamage , ubOwner , bLevel );
|
||||
sprintf(tmpMPDbgString,"ExplosiveDamageStructureAtGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompMoveCosts : %i , fOnlyWalls : %i , SubsMulTilTransDmg : %i , ubOwner : %i , bLevel : %i )\n", sGridNo, sWoundAmt , uiDist, (int)*pfRecompileMovementCosts , (int)fOnlyWalls , (int)fSubSequentMultiTilesTransitionDamage , ubOwner , bLevel );
|
||||
MPDebugMsg(tmpMPDbgString);
|
||||
}
|
||||
#endif
|
||||
@@ -1324,7 +1324,7 @@ void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
||||
#ifdef JA2BETAVERSION
|
||||
if (is_networked) {
|
||||
CHAR tmpMPDbgString[512];
|
||||
sprintf(tmpMPDbgString,"ExplosiveDamageGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompileMoveCosts : %i , fOnlyWalls : %i , MultiStructSpecialFlag : %i ,fSubsequentMultiTilesTransDmg : %i , ubOwner : %i , bLevel : %i )\n",sGridNo, sWoundAmt , (int)*pfRecompileMovementCosts , (int)fOnlyWalls , bMultiStructSpecialFlag , (int)fSubSequentMultiTilesTransitionDamage , ubOwner , bLevel );
|
||||
sprintf(tmpMPDbgString,"ExplosiveDamageGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompileMoveCosts : %i , fOnlyWalls : %i , MultiStructSpecialFlag : %i ,fSubsequentMultiTilesTransDmg : %i , ubOwner : %i , bLevel : %i )\n", sGridNo, sWoundAmt ,uiDist, (int)*pfRecompileMovementCosts , (int)fOnlyWalls , bMultiStructSpecialFlag , (int)fSubSequentMultiTilesTransitionDamage , ubOwner , bLevel );
|
||||
MPDebugMsg(tmpMPDbgString);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2399,6 +2399,8 @@ BOOLEAN CheckForCatcher( REAL_OBJECT *pObject, UINT16 usStructureID )
|
||||
|
||||
void CheckForObjectHittingMerc( REAL_OBJECT *pObject, UINT16 usStructureID )
|
||||
{
|
||||
Assert(usStructureID<TOTAL_SOLDIERS);
|
||||
|
||||
SOLDIERTYPE *pSoldier;
|
||||
INT16 sDamage, sBreath;
|
||||
|
||||
|
||||
@@ -128,11 +128,10 @@ mainMenuEndElementHandle(void *userData, const XML_Char *name)
|
||||
else
|
||||
{
|
||||
strncpy(pData->curMainMenu.FileName,pData->szCharData,MAX_MAIN_MENU_CHARS);
|
||||
pData->curMainMenu.FileName[MAX_MAIN_MENU_CHARS] = '\0';
|
||||
pData->curMainMenu.FileName[MAX_MAIN_MENU_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_MAIN_MENU_CHARS);i++)
|
||||
{
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_MAIN_MENU_CHARS);i++) {
|
||||
temp = pData->szCharData[i];
|
||||
pData->curMainMenu.FileName[i] = temp;
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szLocation[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szLocation[i],&temp));
|
||||
|
||||
Reference in New Issue
Block a user