diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 9fc8fa3b..f56c68bf 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -1946,68 +1946,124 @@ 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); } -// WANNE - MP: Here we have to add AddTopMessage() on the clients void recieveINTERRUPT (RPCParameters *rpcParameters) { - INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input; - SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted]; - - if(INT->bTeam==netbTeam)//for us + if (cGameType == MP_TYPE_COOP) { - INT->bTeam=0; - INT->ubID=INT->ubID - ubID_prefix; + 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; + 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] ); + if(INT->bTeam==netbTeam)//for us + AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ 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 + 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(); + } + } } } - void intAI (SOLDIERTYPE *pSoldier ) { //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"intAI with %s", TeamNameStrings[pSoldier->bTeam] );//was MPClientMessage[17], can be reconnected if text updated and translated @@ -4283,11 +4339,11 @@ void overide_turn (void) CHAR16 Cmsg[255]; if (cMaxClients == 2) - swprintf(Cmsg, MPClientMessage[30], client_names[1],"",""); + swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],"",""); else if (cMaxClients == 3) - swprintf(Cmsg, MPClientMessage[30], client_names[1],client_names[2],""); + swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],client_names[2],""); else - swprintf(Cmsg, MPClientMessage[30], client_names[1],client_names[2],client_names[3]); + swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],client_names[2],client_names[3]); SGPRect CenterRect = { 100 + xResOffset, 100 + yResOffset, SCREEN_WIDTH - 100 - xResOffset, 300 + yResOffset }; @@ -4304,8 +4360,7 @@ void turn_callback (UINT8 ubResult) // Pressed '1' if(ubResult ==1) { - // WANNE: Nothing should happen. Do not give the turn to the server! - //EndTurn( 0 ); + EndTurn( 0 ); } else { diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index 7c487ac5..f9f9640f 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -194,9 +194,9 @@ extern BOOLEAN fClientReceivedAllFiles; // Add basic version checking, will only work from now on // note: this cannot be longer than char[30] #ifdef JA2UB -#define MPVERSION "MP v3.0(UB)" +#define MPVERSION "MP v3.1(UB)" #else -#define MPVERSION "MP v3.0" +#define MPVERSION "MP v3.1" #endif // OJW - 2009128 - inline funcs for working with soldiers and teams diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 79589cf4..3ab1be87 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -1199,9 +1199,8 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt of AI by %s", TeamNameStrings[npSoldier->bTeam]); } - else// pure client awarding interrupt resume //suspect it needs to be: else if(gTacticalStatus.ubCurrentTeam == 0)//its our turn (we are moving) + else if(gTacticalStatus.ubCurrentTeam == 0)//its our turn//else// pure client awarding interrupt resume //its our turn { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt with %s", TeamNameStrings[npSoldier->bTeam]);//this can be simplified if above comment is implemented //ClearIntList(); //hayden//may need more work. @@ -2299,8 +2298,8 @@ 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]); + /*if (cGameType == MP_TYPE_COOP) + ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, MPClientMessage[79]);*/ send_interrupt( npSoldier ); diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 3340608c..b23a50f4 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -6939,7 +6939,7 @@ STR16 MPClientMessage[] = L"'%s' (客户端 %d - '%S') 已被 '%s' (客户端 %d - '%S' 杀死)", L"踢出客户端 #%d - '%S'", // 30 - L"开始排序客户端号. #1: <取消>, #2: %S, #3: %S, #4: %S", + L"开始排序客户端号. #1: %S, #2: %S, #3: %S, #4: %S", L"开始客户端 #%d", L"请求即时模式...", L"转回即时模式。", diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 761e014c..60093332 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -6944,7 +6944,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: , #2: %S, #3: %S, #4: %S", + L"Start a new turn for the selected client. #1: %S, #2: %S, #3: %S, #4: %S", L"Starting turn for client #%d", L"Requesting for realtime...", L"Switched back to realtime.", diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 6e98ab7c..5da0df6a 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -6939,7 +6939,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: , #2: %S, #3: %S, #4: %S", + L"Start a new turn for the selected client. #1: %S, #2: %S, #3: %S, #4: %S", L"Starting turn for client #%d.", L"Requesting for realtime...", L"Switched back to realtime.", diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 5db26985..268a6dd1 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -6769,7 +6769,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: , #2: %S, #3: %S, #4: %S", + L"Starte neuen Spielzug für gewählten Client. #1: %S, #2: %S, #3: %S, #4: %S", L"Starte Spielzug für Client #%d", L"Anfrage auf Echtzeit-Modus...", L"In Echtzeit-Modus gewechselt.", diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index b54e505b..f4623ac3 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -6940,7 +6940,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: , #2: %S, #3: %S, #4: %S", + L"Start a new turn for the selected client. #1: %S, #2: %S, #3: %S, #4: %S", L"Starting turn for client #%d", L"Requesting for realtime...", L"Switched back to realtime.", diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index dc1f7859..c5e2e7a4 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -6952,7 +6952,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: , #2: %S, #3: %S, #4: %S", + L"Zacząć turę dla klientów. #1: %S, #2: %S, #3: %S, #4: %S", L"Początek tury dla #%d", L"Żądanie trybu realtime…", L"Zmieniono w tryb realtime.", diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 80b89604..1cdef0b7 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -6936,7 +6936,7 @@ STR16 MPClientMessage[] = L"%s (клиент %d - '%S') был убит %s (клиент %d - '%S')", L"Клиент №%d - '%S' выкинут из игры.", // 30 - L"Принудительно дать ход клиенту. №1: <Отменить>, №2: %S, №3: %S, №4: %S", + L"Принудительно дать ход клиенту. №1: %S, №2: %S, №3: %S, №4: %S", L"Начался ход клиента №%d", L"Запрос перехода в режим реального время...", L"Переход в режим реального времени.",