Remove RESEARCH_FACILITY::timeStarted, don't finish research when cancelling it.
Fixes ticket:2977.master
parent
295be0e273
commit
4b355aa060
|
@ -4789,7 +4789,6 @@ static bool loadSaveStructure2(const char *pFileName, STRUCTURE **ppList)
|
|||
}
|
||||
//clear subject
|
||||
psResearch->psSubject = NULL;
|
||||
psResearch->timeStarted = 0;
|
||||
psResearch->timeStartHold = 0;
|
||||
//set the subject
|
||||
if (ini.contains("Research/target"))
|
||||
|
@ -4798,7 +4797,6 @@ static bool loadSaveStructure2(const char *pFileName, STRUCTURE **ppList)
|
|||
if (researchId != NULL_ID)
|
||||
{
|
||||
psResearch->psSubject = &asResearch[researchId];
|
||||
psResearch->timeStarted = ini.value("Research/timeStarted").toInt();
|
||||
psResearch->timeStartHold = ini.value("Research/timeStartHold").toInt();
|
||||
}
|
||||
else
|
||||
|
@ -4999,7 +4997,6 @@ bool writeStructFile(const char *pFileName)
|
|||
if (((RESEARCH_FACILITY *)psCurr->pFunctionality)->psSubject)
|
||||
{
|
||||
ini.setValue("Research/target", ((RESEARCH_FACILITY *)psCurr->pFunctionality)->psSubject->pName);
|
||||
ini.setValue("Research/timeStarted", ((RESEARCH_FACILITY *)psCurr->pFunctionality)->timeStarted);
|
||||
}
|
||||
}
|
||||
else if (psCurr->pStructureType->type == REF_POWER_GEN)
|
||||
|
|
|
@ -5449,7 +5449,6 @@ static bool setResearchStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
|
|||
sendResearchStatus(psBuilding,count,selectedPlayer,true); // inform others, I'm researching this.
|
||||
|
||||
MakeResearchStarted(pPlayerRes);
|
||||
psResFacilty->timeStarted = ACTION_START_TIME;
|
||||
psResFacilty->timeStartHold = 0;
|
||||
//stop the button from flashing once a topic has been chosen
|
||||
stopReticuleButtonFlash(IDRET_RESEARCH);
|
||||
|
|
|
@ -930,7 +930,6 @@ bool recvResearchStatus(NETQUEUE queue)
|
|||
|
||||
// Start the research
|
||||
MakeResearchStarted(pPlayerRes);
|
||||
psResFacilty->timeStarted = ACTION_START_TIME;
|
||||
psResFacilty->timeStartHold = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1257,10 +1257,6 @@ void releaseResearch(STRUCTURE *psBuilding, QUEUE_MODE mode)
|
|||
if (psResFac->psSubject && psResFac->timeStartHold)
|
||||
{
|
||||
//adjust the start time for the current subject
|
||||
if (psResFac->timeStarted != ACTION_START_TIME)
|
||||
{
|
||||
psResFac->timeStarted += (gameTime - psResFac->timeStartHold);
|
||||
}
|
||||
psResFac->timeStartHold = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1322,16 +1318,13 @@ void cancelResearch(STRUCTURE *psBuilding, QUEUE_MODE mode)
|
|||
}
|
||||
|
||||
//check if waiting to accrue power
|
||||
if (psResFac->timeStarted == ACTION_START_TIME)
|
||||
if (pPlayerRes->currentPoints == 0)
|
||||
{
|
||||
// Reset this topic as not having been researched
|
||||
ResetResearchStatus(pPlayerRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* store the points - need to keep this so can add points after the topic has been cancelled and restarted */
|
||||
pPlayerRes->currentPoints += (psResFac->researchPoints * (gameTime - psResFac->timeStarted)) / GAME_TICKS_PER_SEC;
|
||||
|
||||
// Set the researched flag
|
||||
MakeResearchCancelled(pPlayerRes);
|
||||
}
|
||||
|
|
|
@ -3093,18 +3093,9 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
|
|||
{
|
||||
pResearch = (RESEARCH *)pSubject;
|
||||
|
||||
if (psResFacility->timeStarted == ACTION_START_TIME)
|
||||
{
|
||||
//set the time started
|
||||
psResFacility->timeStarted = gameTime;
|
||||
}
|
||||
|
||||
ASSERT_OR_RETURN(, gameTime >= psResFacility->timeStarted, "research seems to have started in the future");
|
||||
pointsToAdd = gameTimeAdjustedAverage(psResFacility->researchPoints);
|
||||
pointsToAdd = MIN(pointsToAdd, pResearch->researchPoints - pPlayerRes->currentPoints);
|
||||
|
||||
psResFacility->timeStarted = gameTime;
|
||||
|
||||
if (pointsToAdd > 0 && pPlayerRes->currentPoints == 0)
|
||||
{
|
||||
bool haveEnoughPower = requestPowerFor(psStructure, pResearch->researchPower);
|
||||
|
@ -7595,11 +7586,12 @@ void resetResistanceLag(STRUCTURE *psBuilding)
|
|||
//if working on a topic
|
||||
if (psResFacility->psSubject)
|
||||
{
|
||||
// What was this code intended to do?
|
||||
//adjust the start time for the current subject
|
||||
if (psResFacility->timeStarted != ACTION_START_TIME)
|
||||
{
|
||||
psResFacility->timeStarted += (gameTime - psBuilding->lastResistance);
|
||||
}
|
||||
//if (psResFacility->timeStarted != ACTION_START_TIME)
|
||||
//{
|
||||
// psResFacility->timeStarted += (gameTime - psBuilding->lastResistance);
|
||||
//}
|
||||
}
|
||||
}
|
||||
case REF_FACTORY:
|
||||
|
|
|
@ -167,7 +167,6 @@ struct RESEARCH_FACILITY
|
|||
StatusPending statusPending; ///< Pending = not yet synchronised.
|
||||
unsigned pendingCount; ///< Number of messages sent but not yet processed.
|
||||
UDWORD capacity; /* Number of upgrade modules added*/
|
||||
UDWORD timeStarted; /* The time the building started on the subject*/
|
||||
UDWORD researchPoints; /* Research Points produced per research cycle*/
|
||||
RESEARCH * psBestTopic; // The topic with the most research points that was last performed
|
||||
UDWORD timeStartHold; /* The time the research facility was put on hold*/
|
||||
|
@ -189,7 +188,6 @@ struct FACTORY
|
|||
unsigned pendingCount; ///< Number of messages sent but not yet processed.
|
||||
|
||||
UDWORD timeStarted; /* The time the building started on the subject*/
|
||||
//UDWORD timeToBuild; /* Time taken to build one droid */
|
||||
int buildPointsRemaining; ///< Build points required to finish building the droid.
|
||||
UDWORD timeStartHold; /* The time the factory was put on hold*/
|
||||
FLAG_POSITION *psAssemblyPoint; /* Place for the new droids to assemble at */
|
||||
|
|
Loading…
Reference in New Issue