mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
- Bugfix: New Airport code was not working correctly for multiplayer version (merged changes from MP branch)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2883 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -342,7 +342,9 @@ void BobbyRDeliveryCallback(RefToCShipmentManipulator ShipmentManipulator)
|
|||||||
{
|
{
|
||||||
// ScreenMsg(FONT_MCOLOR_RED, MSG_DEBUG, L"Shipment from Bobby Ray has arrived at %s!", ShipmentManipulator.GetDestination().wstrName.c_str());
|
// ScreenMsg(FONT_MCOLOR_RED, MSG_DEBUG, L"Shipment from Bobby Ray has arrived at %s!", ShipmentManipulator.GetDestination().wstrName.c_str());
|
||||||
gusCurShipmentDestinationID = ShipmentManipulator.GetDestination().usID;
|
gusCurShipmentDestinationID = ShipmentManipulator.GetDestination().usID;
|
||||||
AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1 );
|
// WANNE - MP: Do not send email notification from Bobby Ray in a multiplayer game
|
||||||
|
if (!is_networked)
|
||||||
|
AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -821,7 +823,7 @@ void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
if( (gDestinationTable[gbSelectedCity]->ubMapX >= 0 ||
|
if( (gDestinationTable[gbSelectedCity]->ubMapX >= 0 ||
|
||||||
gDestinationTable[gbSelectedCity]->ubMapY >= 0 ||
|
gDestinationTable[gbSelectedCity]->ubMapY >= 0 ||
|
||||||
gDestinationTable[gbSelectedCity]->sGridNo >= 0) &&
|
gDestinationTable[gbSelectedCity]->sGridNo >= 0) &&
|
||||||
!StrategicMap[ CALCULATE_STRATEGIC_INDEX(gDestinationTable[gbSelectedCity]->ubMapX, gDestinationTable[gbSelectedCity]->ubMapY) ].fEnemyControlled )
|
!StrategicMap[ CALCULATE_STRATEGIC_INDEX(gDestinationTable[gbSelectedCity]->ubMapX, gDestinationTable[gbSelectedCity]->ubMapY) ].fEnemyControlled || is_client)
|
||||||
//End Dealtar's Code.
|
//End Dealtar's Code.
|
||||||
{
|
{
|
||||||
//Quick hack to bypass the confirmation box
|
//Quick hack to bypass the confirmation box
|
||||||
|
|||||||
+180
-1
@@ -11,6 +11,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
// WANNE - MP: Used for multiplayer
|
||||||
|
#include "connect.h"
|
||||||
|
#include "Strategic Event Handler.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
@@ -82,6 +85,15 @@ OBJECTTYPE CPostalService::tempObject;
|
|||||||
CPostalService::CPostalService()
|
CPostalService::CPostalService()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void CPostalService::Clear()
|
||||||
|
{
|
||||||
|
_Shipments.clear();
|
||||||
|
_UsedShipmentIDList.clear();;
|
||||||
|
_DeliveryCallbacks.clear();
|
||||||
|
_Destinations.clear();
|
||||||
|
_UsedDestinationIDList.clear();
|
||||||
|
_DeliveryMethods.clear();
|
||||||
|
}
|
||||||
|
|
||||||
UINT16 CPostalService::CreateNewShipment(UINT16 usDestinationID, UINT8 ubDeliveryMethodIndex, INT16 sSenderID)
|
UINT16 CPostalService::CreateNewShipment(UINT16 usDestinationID, UINT8 ubDeliveryMethodIndex, INT16 sSenderID)
|
||||||
{
|
{
|
||||||
@@ -201,8 +213,18 @@ BOOLEAN CPostalService::SendShipment(UINT16 usShipmentID)
|
|||||||
|
|
||||||
SHIPMENT(sli).ShipmentStatus = SHIPMENT_INTRANSIT;
|
SHIPMENT(sli).ShipmentStatus = SHIPMENT_INTRANSIT;
|
||||||
|
|
||||||
AddFutureDayStrategicEvent( EVENT_POSTAL_SERVICE_SHIPMENT, (8 + Random(4) ) * 60, usShipmentID,
|
if (is_networked)
|
||||||
|
{
|
||||||
|
if (is_client)
|
||||||
|
{
|
||||||
|
this->DeliverShipmentForMultiplayer(usShipmentID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddFutureDayStrategicEvent( EVENT_POSTAL_SERVICE_SHIPMENT, (8 + Random(4) ) * 60, usShipmentID,
|
||||||
SHIPMENT(sli).pDestinationDeliveryInfo->bDaysAhead);
|
SHIPMENT(sli).pDestinationDeliveryInfo->bDaysAhead);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,6 +391,163 @@ BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN CPostalService::DeliverShipmentForMultiplayer(UINT16 usShipmentID)
|
||||||
|
{
|
||||||
|
if( usShipmentID > _UsedShipmentIDList.size() ||
|
||||||
|
!_UsedShipmentIDList[usShipmentID])
|
||||||
|
{
|
||||||
|
Assert(0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefToShipmentListIterator sli = _Shipments.begin();
|
||||||
|
|
||||||
|
while(SHIPMENT(sli).usID != usShipmentID)
|
||||||
|
{
|
||||||
|
if(sli == _Shipments.end())
|
||||||
|
{
|
||||||
|
Assert(0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
sli++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(SHIPMENT(sli).ShipmentStatus == SHIPMENT_STATIONARY)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PCShipmentManipulator ShipmentManipulator = new CShipmentManipulator(this, &SHIPMENT(sli));
|
||||||
|
|
||||||
|
// Delivery callback code goes here
|
||||||
|
if(_DeliveryCallbacks[0].DeliveryCallbackFunc)
|
||||||
|
{
|
||||||
|
_DeliveryCallbacks[0].DeliveryCallbackFunc(*ShipmentManipulator);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ShipmentManipulator->_fContinueCallbackChain)
|
||||||
|
{
|
||||||
|
if( SHIPMENT(sli).sSenderID + 2 <= (INT16)_DeliveryCallbacks.size() &&
|
||||||
|
_DeliveryCallbacks[SHIPMENT(sli).sSenderID + 1].DeliveryCallbackFunc)
|
||||||
|
{
|
||||||
|
_DeliveryCallbacks[SHIPMENT(sli).sSenderID + 1].DeliveryCallbackFunc(*ShipmentManipulator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(SHIPMENT(sli).ShipmentStatus == SHIPMENT_CANCEL_DELIVERY)
|
||||||
|
{
|
||||||
|
SHIPMENT(sli).ShipmentStatus = SHIPMENT_STATIONARY;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RefToShipmentStruct shs = SHIPMENT(sli);
|
||||||
|
|
||||||
|
if( (shs.pDestination->ubMapX > 0) &&
|
||||||
|
(shs.pDestination->ubMapX < MAP_WORLD_X - 1) &&
|
||||||
|
(shs.pDestination->ubMapY > 0) &&
|
||||||
|
(shs.pDestination->ubMapY < MAP_WORLD_Y - 1) &&
|
||||||
|
GridNoOnVisibleWorldTile(shs.pDestination->sGridNo) )
|
||||||
|
{
|
||||||
|
BOOLEAN fSectorLoaded = ( gWorldSectorX == shs.pDestination->ubMapX ) &&
|
||||||
|
( gWorldSectorY == shs.pDestination->ubMapY ) &&
|
||||||
|
( gbWorldSectorZ == shs.pDestination->ubMapZ);
|
||||||
|
|
||||||
|
if(fSectorLoaded)
|
||||||
|
{
|
||||||
|
SetOpenableStructureToClosed( shs.pDestination->sGridNo, 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeStatusOfOpenableStructInUnloadedSector( shs.pDestination->ubMapX, shs.pDestination->ubMapY,
|
||||||
|
shs.pDestination->ubMapZ, shs.pDestination->sGridNo, FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT16 usNumberOfItems=0;
|
||||||
|
for(int i = 0; i < (int)shs.ShipmentPackages.size(); i++)
|
||||||
|
{
|
||||||
|
usNumberOfItems += shs.ShipmentPackages[i].ubNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
OBJECTTYPE *pObject;
|
||||||
|
if(!fSectorLoaded)
|
||||||
|
{
|
||||||
|
pObject = new OBJECTTYPE[usNumberOfItems];
|
||||||
|
|
||||||
|
if(!pObject)
|
||||||
|
{
|
||||||
|
Assert(0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT uiCount=0;
|
||||||
|
UINT8 ubItemsDelivered, ubTempNumItems;
|
||||||
|
UINT16 usItem;
|
||||||
|
|
||||||
|
for(int i=0; i < (int)shs.ShipmentPackages.size(); i++)
|
||||||
|
{
|
||||||
|
ubItemsDelivered = shs.ShipmentPackages[i].ubNumber;
|
||||||
|
usItem = shs.ShipmentPackages[i].usItemIndex;
|
||||||
|
|
||||||
|
CreateItem(usItem, 100, &tempObject);
|
||||||
|
|
||||||
|
while ( ubItemsDelivered )
|
||||||
|
{
|
||||||
|
//ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(usItem, BIGPOCK1POS) );
|
||||||
|
|
||||||
|
if (UsingNewInventorySystem() == false)
|
||||||
|
{
|
||||||
|
ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(&tempObject, BIGPOCK1POS) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(&tempObject, STACK_SIZE_LIMIT) );
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateItems( usItem, shs.ShipmentPackages[i].bItemQuality, ubTempNumItems, &tempObject );
|
||||||
|
|
||||||
|
if( fSectorLoaded )
|
||||||
|
{
|
||||||
|
AddItemToPool( 12880, &tempObject, 1, 0, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pObject[ uiCount ] = tempObject;
|
||||||
|
uiCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ubItemsDelivered -= ubTempNumItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !fSectorLoaded )
|
||||||
|
{
|
||||||
|
if( !AddItemsToUnLoadedSector( gsMercArriveSectorX, gsMercArriveSectorY,
|
||||||
|
0, 12880, uiCount, pObject, 0, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE ) )
|
||||||
|
{
|
||||||
|
Assert( 0 );
|
||||||
|
}
|
||||||
|
delete[]( pObject );
|
||||||
|
pObject = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
shs.ShipmentPackages.clear();
|
||||||
|
shs.pDestination = NULL;
|
||||||
|
shs.pDestinationDeliveryInfo = NULL;
|
||||||
|
shs.ShipmentStatus = SHIPMENT_STATIONARY;
|
||||||
|
_UsedShipmentIDList[usShipmentID] = FALSE;
|
||||||
|
|
||||||
|
_Shipments.erase(sli);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Assert(0);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
BOOLEAN CPostalService::RegisterDeliveryCallback(INT16 sSenderID, PtrToDeliveryCallbackFunc DeliveryCallbackFunc)
|
BOOLEAN CPostalService::RegisterDeliveryCallback(INT16 sSenderID, PtrToDeliveryCallbackFunc DeliveryCallbackFunc)
|
||||||
{
|
{
|
||||||
if(sSenderID < - 1 || !DeliveryCallbackFunc)
|
if(sSenderID < - 1 || !DeliveryCallbackFunc)
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ public:
|
|||||||
BOOLEAN AddPackageToShipment(UINT16 usShipmentID, UINT16 usItemIndex, UINT8 ubNumber, INT8 bItemQuality);
|
BOOLEAN AddPackageToShipment(UINT16 usShipmentID, UINT16 usItemIndex, UINT8 ubNumber, INT8 bItemQuality);
|
||||||
BOOLEAN SendShipment(UINT16 usShipmentID);
|
BOOLEAN SendShipment(UINT16 usShipmentID);
|
||||||
BOOLEAN DeliverShipment(UINT16 usShipmentID);
|
BOOLEAN DeliverShipment(UINT16 usShipmentID);
|
||||||
|
BOOLEAN DeliverShipmentForMultiplayer(UINT16 usShipmentID);
|
||||||
BOOLEAN RegisterDeliveryCallback(INT16 sSenderID, PtrToDeliveryCallbackFunc DeliveryCallbackFunc);
|
BOOLEAN RegisterDeliveryCallback(INT16 sSenderID, PtrToDeliveryCallbackFunc DeliveryCallbackFunc);
|
||||||
|
|
||||||
// Interfaces
|
// Interfaces
|
||||||
@@ -228,6 +229,7 @@ public:
|
|||||||
UINT16 GetDestinationFee(UINT8 ubDeliveryMethodIndex, UINT16 usDestinationID);
|
UINT16 GetDestinationFee(UINT8 ubDeliveryMethodIndex, UINT16 usDestinationID);
|
||||||
RefToDeliveryMethodStruct GetDeliveryMethod(UINT8 ubDeliveryMethodIndex) const;
|
RefToDeliveryMethodStruct GetDeliveryMethod(UINT8 ubDeliveryMethodIndex) const;
|
||||||
|
|
||||||
|
void Clear();
|
||||||
CPostalService();
|
CPostalService();
|
||||||
private:
|
private:
|
||||||
ShipmentList _Shipments;
|
ShipmentList _Shipments;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="D:\misc\1.13\JA2 - English"
|
OutputDirectory="\games\jagged alliance 2"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
InheritedPropertySheets=".\ja2_2005Express.vsprops;.\ja2_2005ExpressDebug.vsprops"
|
InheritedPropertySheets=".\ja2_2005Express.vsprops;.\ja2_2005ExpressDebug.vsprops"
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
|
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
|
||||||
OutputFile="$(OutDir)\JA2_EN_VS2005_Debug.exe"
|
OutputFile="$(OutDir)\JA2_EN_Debug.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="D:\misc\1.13\JA2 - English"
|
OutputDirectory="\games\jagged alliance 2"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
InheritedPropertySheets=".\ja2_2005Express.vsprops"
|
InheritedPropertySheets=".\ja2_2005Express.vsprops"
|
||||||
|
|||||||
+2
-2
@@ -18,7 +18,7 @@
|
|||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="\games\jagged alliance 2"
|
OutputDirectory="C:\games\jagged alliance 2 EN"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
InheritedPropertySheets=".\ja2_VS2008.vsprops;.\ja2_VS2008Debug.vsprops;.\ja2_VS2008Linker.vsprops;.\ja2_VS2008Libs.vsprops"
|
InheritedPropertySheets=".\ja2_VS2008.vsprops;.\ja2_VS2008Debug.vsprops;.\ja2_VS2008Linker.vsprops;.\ja2_VS2008Libs.vsprops"
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="\games\jagged alliance 2"
|
OutputDirectory="C:\games\jagged alliance 2 EN"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
InheritedPropertySheets=".\ja2_VS2008.vsprops;.\ja2_VS2008Linker.vsprops;.\ja2_VS2008Libs.vsprops"
|
InheritedPropertySheets=".\ja2_VS2008.vsprops;.\ja2_VS2008Linker.vsprops;.\ja2_VS2008Libs.vsprops"
|
||||||
|
|||||||
Reference in New Issue
Block a user