Fix ticket:1478 "Non-host players do not get info about the research in progress by allied AIs in MP"

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/branches/2.3@11556 4a71c877-e1ca-e34f-864e-861f7616d084
(cherry picked from commit edadbb83fd34e65d125d396110db13f8e5cc8097)

Conflicts:

	src/scriptai.c
	src/scriptfuncs.c
master
buginator 2010-10-18 23:02:34 -04:00
parent 5f83b41456
commit ccb286ceaa
2 changed files with 47 additions and 46 deletions

View File

@ -1664,10 +1664,13 @@ BOOL scrSkDoResearch(void)
if(i != numResearch)
{
pResearch = asResearch + i;
if (bMultiMessages)
pResearch = (asResearch + i);
pPlayerRes = asPlayerResList[player] + i;
psResFacilty->psSubject = (BASE_STATS*)pResearch; //set the subject up
if (IsResearchCancelled(pPlayerRes))
{
sendResearchStatus(psBuilding, pResearch->ref - REF_RESEARCH_START, player, true);
psResFacilty->powerAccrued = pResearch->researchPower; //set up as if all power available for cancelled topics
}
else
{
@ -1693,6 +1696,16 @@ BOOL scrSkDoResearch(void)
}
}
sendResearchStatus(psBuilding, i, player, true); // inform others, I'm researching this.
MakeResearchStarted(pPlayerRes);
psResFacilty->timeStarted = ACTION_START_TIME;
psResFacilty->timeStartHold = 0;
psResFacilty->timeToResearch = pResearch->researchPoints / psResFacilty->researchPoints;
if (psResFacilty->timeToResearch == 0)
{
psResFacilty->timeToResearch = 1;
}
#if defined (DEBUG)
{
char sTemp[128];

View File

@ -10444,13 +10444,10 @@ BOOL scrPursueResearch(void)
SDWORD foundIndex = 0, player, cur, tempIndex, Stack[400];
UDWORD index;
SWORD top;
BOOL found;
PLAYER_RESEARCH *pPlayerRes;
STRUCTURE *psBuilding;
RESEARCH_FACILITY *psResFacilty;
RESEARCH *pResearch;
if (!stackPopParams(3,ST_STRUCTURE, &psBuilding, VAL_INT, &player, ST_RESEARCH, &psResearch ))
@ -10502,8 +10499,7 @@ BOOL scrPursueResearch(void)
found = false;
//DbgMsg("Research already in progress, %d", index);
}
else if(IsResearchPossible(&pPlayerRes[index])
|| IsResearchCancelled(&pPlayerRes[index]))
else if (IsResearchPossible(&pPlayerRes[index]) || IsResearchCancelled(&pPlayerRes[index]))
{
foundIndex = index;
found = true;
@ -10582,23 +10578,15 @@ BOOL scrPursueResearch(void)
cur++; //try next node of the main node
if((cur >= asResearch[index].numPRRequired) && (top <= (-1))) //nothing left
{
//DbgMsg("END");
break;
}
} // while(true)
}
if(found
&& foundIndex < numResearch)
if (found && foundIndex < numResearch)
{
pResearch = (asResearch + foundIndex);
if (bMultiMessages)
{
sendResearchStatus(psBuilding, pResearch->ref - REF_RESEARCH_START, player, true);
}
else
{
pPlayerRes = asPlayerResList[player] + foundIndex;
psResFacilty->psSubject = (BASE_STATS*)pResearch; //set the subject up
@ -10611,15 +10599,16 @@ BOOL scrPursueResearch(void)
psResFacilty->powerAccrued = 0;
}
sendResearchStatus(psBuilding, foundIndex, player, true); // inform others, I'm researching this.
MakeResearchStarted(pPlayerRes);
psResFacilty->timeStarted = ACTION_START_TIME;
psResFacilty->timeStartHold = 0;
psResFacilty->timeToResearch = pResearch->researchPoints / psResFacilty->researchPoints;
if (psResFacilty->timeToResearch == 0)
{
psResFacilty->timeToResearch = 1;
}
}
#if defined (DEBUG)
{
char sTemp[128];
@ -10628,7 +10617,6 @@ BOOL scrPursueResearch(void)
}
#endif
}
scrFunctionResult.v.bval = found;
if (!stackPushResult(VAL_BOOL, &scrFunctionResult))
{