mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Merged from revision: 7757
Multiplayer Bugfix: Reverted the "endless interrupt bugfix" for the pure client, because it was not working correctly, and the server could not press ALT + E to give the turn back to the client, if stuck. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7758 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+115
-51
@@ -1946,68 +1946,127 @@ void send_interrupt (SOLDIERTYPE *pSoldier)
|
||||
client->RPC("sendINTERRUPT",(const char*)&INT, (int)sizeof(INT_STRUCT)*8, HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0);
|
||||
}
|
||||
|
||||
void recieveINTERRUPT (RPCParameters *rpcParameters)
|
||||
{
|
||||
if (cGameType == MP_TYPE_COOP)
|
||||
#ifdef INTERRUPT_MP_DEADLOCK_FIX
|
||||
void recieveINTERRUPT (RPCParameters *rpcParameters)
|
||||
{
|
||||
INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input;
|
||||
SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted];
|
||||
|
||||
if( INT->bTeam == netbTeam || is_server)//its for us or we are server and its for AI which we control
|
||||
if (cGameType == MP_TYPE_COOP)
|
||||
{
|
||||
if(INT->bTeam == netbTeam)
|
||||
{
|
||||
//for me
|
||||
INT->bTeam=0;
|
||||
INT->ubID=INT->ubID - ubID_prefix;
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//for ai
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"starting ai" );
|
||||
AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
}
|
||||
INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input;
|
||||
SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted];
|
||||
|
||||
for(int i=0; i <= INT->gubOutOfTurnPersons; i++)//this loop translates soldier id's from what they are in someone else's game to what they are locally
|
||||
if( INT->bTeam == netbTeam || is_server)//its for us or we are server and its for AI which we control
|
||||
{
|
||||
if((INT->gubOutOfTurnOrder[i] >= ubID_prefix) && (INT->gubOutOfTurnOrder[i] < (ubID_prefix+6)))
|
||||
if(INT->bTeam == netbTeam)
|
||||
{
|
||||
INT->gubOutOfTurnOrder[i]=INT->gubOutOfTurnOrder[i]-ubID_prefix;
|
||||
//for me
|
||||
INT->bTeam=0;
|
||||
INT->ubID=INT->ubID - ubID_prefix;
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//for ai
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"starting ai" );
|
||||
AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
}
|
||||
}
|
||||
memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS);
|
||||
gubOutOfTurnPersons = INT->gubOutOfTurnPersons;
|
||||
|
||||
if(INT->bTeam==netbTeam)//for us
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
for(int i=0; i <= INT->gubOutOfTurnPersons; i++)//this loop translates soldier id's from what they are in someone else's game to what they are locally
|
||||
{
|
||||
if((INT->gubOutOfTurnOrder[i] >= ubID_prefix) && (INT->gubOutOfTurnOrder[i] < (ubID_prefix+6)))
|
||||
{
|
||||
INT->gubOutOfTurnOrder[i]=INT->gubOutOfTurnOrder[i]-ubID_prefix;
|
||||
}
|
||||
}
|
||||
memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS);
|
||||
gubOutOfTurnPersons = INT->gubOutOfTurnPersons;
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Recieved interrupt between %s and %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );
|
||||
if(INT->bTeam==netbTeam)//for us
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
|
||||
//start interrupt turn //real interrupt code
|
||||
SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ];
|
||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1);
|
||||
StartInterrupt();
|
||||
}
|
||||
// It is our team
|
||||
else if(INT->bTeam == 0)
|
||||
{
|
||||
//it for us ! :)
|
||||
if(INT->gubOutOfTurnPersons==0)//indicates finished interrupt maybe can just call end interrupt
|
||||
{
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"old int finish" );
|
||||
}
|
||||
else //start our interrupt turn
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to you.", TeamNameStrings[pOpponent->bTeam] );//was MPClientMessage[37], can be reconnected if text updated and translated
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Recieved interrupt between %s and %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );
|
||||
|
||||
//start interrupt turn //real interrupt code
|
||||
SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ];
|
||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1);
|
||||
StartInterrupt();
|
||||
}
|
||||
// It is our team
|
||||
else if(INT->bTeam == 0)
|
||||
{
|
||||
//it for us ! :)
|
||||
if(INT->gubOutOfTurnPersons==0)//indicates finished interrupt maybe can just call end interrupt
|
||||
{
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"old int finish" );
|
||||
}
|
||||
else //start our interrupt turn
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to you.", TeamNameStrings[pOpponent->bTeam] );//was MPClientMessage[37], can be reconnected if text updated and translated
|
||||
|
||||
SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ];
|
||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1);
|
||||
StartInterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input;
|
||||
SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted];
|
||||
|
||||
if(INT->bTeam==netbTeam)//for us
|
||||
{
|
||||
INT->bTeam=0;
|
||||
INT->ubID=INT->ubID - ubID_prefix;
|
||||
|
||||
for(int i=0; i <= INT->gubOutOfTurnPersons; i++)//this loop translates soldier id's from what they are in someone else's game to what they are locally
|
||||
{
|
||||
if((INT->gubOutOfTurnOrder[i] >= ubID_prefix) && (INT->gubOutOfTurnOrder[i] < (ubID_prefix+6)))
|
||||
{
|
||||
INT->gubOutOfTurnOrder[i]=INT->gubOutOfTurnOrder[i]-ubID_prefix;
|
||||
}
|
||||
}
|
||||
memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS);
|
||||
gubOutOfTurnPersons = INT->gubOutOfTurnPersons;
|
||||
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );
|
||||
}
|
||||
|
||||
// WANNE - MP: This seems to cause the HANG on AI interrupt where we have to press ALT + E on the server!
|
||||
if( INT->bTeam != 0)//not for our team - hayden
|
||||
{
|
||||
//stop moving merc who was interrupted and init UI bar
|
||||
SOLDIERTYPE* pMerc = MercPtrs[ INT->ubID ];
|
||||
pMerc->HaultSoldierFromSighting(TRUE);
|
||||
FreezeInterfaceForEnemyTurn();
|
||||
InitEnemyUIBar( 0, 0 );
|
||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||
gTacticalStatus.fInterruptOccurred = TRUE;
|
||||
|
||||
//this needed to add details of who's interrupt it is - hayden
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt with %s awarded to %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );//was MPClientMessage[17], can be reconnected if text updated and translated
|
||||
}
|
||||
else
|
||||
{
|
||||
//it for us ! :)
|
||||
if(INT->gubOutOfTurnPersons==0)//indicates finished interrupt maybe can just call end interrupt
|
||||
{
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"old int finish" );
|
||||
}
|
||||
else //start our interrupt turn
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to you.", TeamNameStrings[pOpponent->bTeam] );//was MPClientMessage[37], can be reconnected if text updated and translated
|
||||
|
||||
SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ];
|
||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1);
|
||||
StartInterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#else
|
||||
|
||||
void recieveINTERRUPT (RPCParameters *rpcParameters)
|
||||
{
|
||||
INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input;
|
||||
SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted];
|
||||
@@ -2027,13 +2086,16 @@ void recieveINTERRUPT (RPCParameters *rpcParameters)
|
||||
memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS);
|
||||
gubOutOfTurnPersons = INT->gubOutOfTurnPersons;
|
||||
|
||||
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );
|
||||
|
||||
}
|
||||
|
||||
// WANNE - MP: This seems to cause the HANG on AI interrupt where we have to press ALT + E on the server!
|
||||
if( INT->bTeam != 0)//not for our team - hayden
|
||||
{
|
||||
|
||||
//stop moving merc who was interrupted and init UI bar
|
||||
SOLDIERTYPE* pMerc = MercPtrs[ INT->ubID ];
|
||||
pMerc->HaultSoldierFromSighting(TRUE);
|
||||
@@ -2062,7 +2124,8 @@ void recieveINTERRUPT (RPCParameters *rpcParameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void intAI (SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
@@ -4339,11 +4402,11 @@ void overide_turn (void)
|
||||
CHAR16 Cmsg[255];
|
||||
|
||||
if (cMaxClients == 2)
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],"<?>","<?>");
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[1],"<?>","<?>");
|
||||
else if (cMaxClients == 3)
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],client_names[2],"<?>");
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[1],client_names[2],"<?>");
|
||||
else
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],client_names[2],client_names[3]);
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[1],client_names[2],client_names[3]);
|
||||
|
||||
SGPRect CenterRect = { 100 + xResOffset, 100 + yResOffset, SCREEN_WIDTH - 100 - xResOffset, 300 + yResOffset };
|
||||
|
||||
@@ -4360,7 +4423,8 @@ void turn_callback (UINT8 ubResult)
|
||||
// Pressed '1'
|
||||
if(ubResult ==1)
|
||||
{
|
||||
EndTurn( 0 );
|
||||
// WANNE: Nothing should happen. Do not give the turn to the server!
|
||||
//EndTurn( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -148,6 +148,10 @@ extern char cServerName[30];
|
||||
//OJW - 20081224
|
||||
#define MAX_CONNECT_RETRIES 5
|
||||
|
||||
// WANNE: After some MP-Tests: It seems there are still problems with enemy interupt and if this define is enabled the ALT + E (give turn to client) does not work either. So I disabled this define for now ...
|
||||
// WANNE: If this define is enabled, it hopefully fixes the "enemy AI got stuck on pure client interrupt". (this "fix" was added in revision 5623)
|
||||
//#define INTERRUPT_MP_DEADLOCK_FIX
|
||||
|
||||
// WANNE: This features seems to work without any errors, so it is enabled :)
|
||||
#define ENABLE_MP_FRIENDLY_PLAYERS_SHARE_SAME_FOV
|
||||
|
||||
|
||||
+14
-3
@@ -1199,7 +1199,14 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt of AI by %s", TeamNameStrings[npSoldier->bTeam]);
|
||||
|
||||
}
|
||||
else if(gTacticalStatus.ubCurrentTeam == 0)//its our turn//else// pure client awarding interrupt resume //its our turn
|
||||
|
||||
#ifdef INTERRUPT_MP_DEADLOCK_FIX
|
||||
//its our turn//else// pure client awarding interrupt resume //its our turn
|
||||
else if(gTacticalStatus.ubCurrentTeam == 0)
|
||||
#else
|
||||
// pure client awarding interrupt resume
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt with %s", TeamNameStrings[npSoldier->bTeam]);//this can be simplified if above comment is implemented
|
||||
//ClearIntList();
|
||||
@@ -2298,8 +2305,12 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter
|
||||
// INTERRUPT is calculated on the pure client
|
||||
else if(gTacticalStatus.ubCurrentTeam == 0)//its our turn (we are moving)
|
||||
{
|
||||
/*if (cGameType == MP_TYPE_COOP)
|
||||
ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, MPClientMessage[79]);*/
|
||||
#ifdef INTERRUPT_MP_DEADLOCK_FIX
|
||||
// Do nothing
|
||||
#else
|
||||
if (cGameType == MP_TYPE_COOP)
|
||||
ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, MPClientMessage[79]);
|
||||
#endif
|
||||
|
||||
send_interrupt( npSoldier );
|
||||
|
||||
|
||||
@@ -6949,7 +6949,7 @@ STR16 MPClientMessage[] =
|
||||
L"'%s' (客户端 %d - '%S') 已被 '%s' (客户端 %d - '%S' 杀死)",
|
||||
L"踢出客户端 #%d - '%S'",
|
||||
// 30
|
||||
L"开始排序客户端号. #1: %S, #2: %S, #3: %S, #4: %S",
|
||||
L"开始排序客户端号. #1: <取消>, #2: %S, #3: %S, #4: %S",
|
||||
L"开始客户端 #%d",
|
||||
L"请求即时模式...",
|
||||
L"转回即时模式。",
|
||||
|
||||
@@ -6953,7 +6953,7 @@ STR16 MPClientMessage[] =
|
||||
L"'%s' (client %d - '%S') was killed by '%s' (client %d - '%S')",
|
||||
L"Kicked client #%d - '%S'",
|
||||
// 30
|
||||
L"Start a new turn for the selected client. #1: %S, #2: %S, #3: %S, #4: %S",
|
||||
L"Start a new turn for the selected client. #1: <Cancel>, #2: %S, #3: %S, #4: %S",
|
||||
L"Starting turn for client #%d",
|
||||
L"Requesting for realtime...",
|
||||
L"Switched back to realtime.",
|
||||
|
||||
@@ -6947,7 +6947,7 @@ STR16 MPClientMessage[] =
|
||||
L"'%s' (client %d - '%S') was killed by '%s' (client %d - '%S').",
|
||||
L"Kicked client #%d - '%S'.",
|
||||
// 30
|
||||
L"Start a new turn for the selected client. #1: %S, #2: %S, #3: %S, #4: %S",
|
||||
L"Start a new turn for the selected client. #1: <Cancel>, #2: %S, #3: %S, #4: %S",
|
||||
L"Starting turn for client #%d.",
|
||||
L"Requesting for realtime...",
|
||||
L"Switched back to realtime.",
|
||||
|
||||
@@ -6951,7 +6951,7 @@ STR16 MPClientMessage[] =
|
||||
L"'%s' (client %d - '%S') a été tué par '%s' (client %d - '%S')",
|
||||
L"Client kické #%d - '%S'",
|
||||
// 30
|
||||
L"Début de manche pour les numéros de clients : #1 - '%S' | #2 - '%S' | #3 - '%S' | #4 - '%S'",
|
||||
L"Début de manche pour les numéros de clients : #1: <Annuler>, #2: %S, #3: %S, #4: %S",
|
||||
L"Début de manche pour le client #%d",
|
||||
L"Requête pour le realtime...",
|
||||
L"Commutation en mode realtime.",
|
||||
|
||||
@@ -6778,7 +6778,7 @@ STR16 MPClientMessage[] =
|
||||
L"'%s' (Client #%d - '%S') wurde getötet von '%s' (Client #%d - '%S')",
|
||||
L"Werfe Client #%d - '%S' aus dem Spiel.",
|
||||
// 30
|
||||
L"Starte neuen Spielzug für gewählten Client. #1: %S, #2: %S, #3: %S, #4: %S",
|
||||
L"Starte neuen Spielzug für gewählten Client. #1: <Abbrechen>, #2: %S, #3: %S, #4: %S",
|
||||
L"Starte Spielzug für Client #%d",
|
||||
L"Anfrage auf Echtzeit-Modus...",
|
||||
L"In Echtzeit-Modus gewechselt.",
|
||||
|
||||
@@ -6949,7 +6949,7 @@ STR16 MPClientMessage[] =
|
||||
L"'%s' (client %d - '%S') was killed by '%s' (client %d - '%S')",
|
||||
L"Kicked client #%d - '%S'",
|
||||
// 30
|
||||
L"Start a new turn for the selected client. #1: %S, #2: %S, #3: %S, #4: %S",
|
||||
L"Start a new turn for the selected client. #1: <Cancel>, #2: %S, #3: %S, #4: %S",
|
||||
L"Starting turn for client #%d",
|
||||
L"Requesting for realtime...",
|
||||
L"Switched back to realtime.",
|
||||
|
||||
@@ -6961,7 +6961,7 @@ STR16 MPClientMessage[] =
|
||||
L"'%s' (klient %d - '%S') zabity przez '%s' (client %d - '%S')",
|
||||
L"Wyrzucono #%d - '%S'",
|
||||
// 30
|
||||
L"Zacząć turę dla klientów. #1: %S, #2: %S, #3: %S, #4: %S",
|
||||
L"Zacząć turę dla klientów. #1: <Anulować>, #2: %S, #3: %S, #4: %S",
|
||||
L"Początek tury dla #%d",
|
||||
L"Żądanie trybu realtime…",
|
||||
L"Zmieniono w tryb realtime.",
|
||||
|
||||
@@ -6945,7 +6945,7 @@ STR16 MPClientMessage[] =
|
||||
L"%s (клиент %d - '%S') был убит %s (клиент %d - '%S')",
|
||||
L"Клиент №%d - '%S' выкинут из игры.",
|
||||
// 30
|
||||
L"Принудительно дать ход клиенту. №1: %S, №2: %S, №3: %S, №4: %S",
|
||||
L"Принудительно дать ход клиенту. №1: <Отменить>, №2: %S, №3: %S, №4: %S",
|
||||
L"Начался ход клиента №%d",
|
||||
L"Запрос перехода в режим реального время...",
|
||||
L"Переход в режим реального времени.",
|
||||
|
||||
Reference in New Issue
Block a user