Remove REPAIR_FACILITY::{timeStarted, currentPtsAdded}.

master
Cyp 2011-12-12 14:42:58 +01:00
parent 4b355aa060
commit 322bbc6163
3 changed files with 2 additions and 32 deletions

View File

@ -4818,8 +4818,6 @@ static bool loadSaveStructure2(const char *pFileName, STRUCTURE **ppList)
case REF_REPAIR_FACILITY:
psRepair = ((REPAIR_FACILITY *)psStructure->pFunctionality);
psRepair->power = ((REPAIR_DROID_FUNCTION *) psStructure->pStructureType->asFuncList[0])->repairPoints;
psRepair->timeStarted = ini.value("Repair/timeStarted").toInt();
psRepair->currentPtsAdded = ini.value("Repair/currentPtsAdded").toInt();
if (ini.contains("Repair/deliveryPoint/pos"))
{
Position point = ini.vector3i("Repair/deliveryPoint/pos");
@ -5006,8 +5004,6 @@ bool writeStructFile(const char *pFileName)
else if (psCurr->pStructureType->type == REF_REPAIR_FACILITY)
{
REPAIR_FACILITY *psRepair = ((REPAIR_FACILITY *)psCurr->pFunctionality);
ini.setValue("Repair/timeStarted", psRepair->timeStarted);
ini.setValue("Repair/currentPtsAdded", psRepair->currentPtsAdded);
if (psRepair->psObj)
{
ini.setValue("Repair/target/id", psRepair->psObj->id);

View File

@ -2565,7 +2565,6 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
DROID *psDroid;
BASE_OBJECT *psChosenObjs[STRUCT_MAXWEAPS] = {NULL};
BASE_OBJECT *psChosenObj = NULL;
SDWORD iDt;
FACTORY *psFactory;
REPAIR_FACILITY *psRepairFac = NULL;
RESEARCH_FACILITY *psResFacility;
@ -2960,9 +2959,6 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
/* reset repair started if we were previously repairing something else */
if (psRepairFac->psObj != psDroid)
{
psRepairFac->timeStarted = ACTION_START_TIME;
psRepairFac->currentPtsAdded = 0;
psRepairFac->psObj = psDroid;
}
}
@ -3298,29 +3294,9 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
}
}
if (psRepairFac->timeStarted == ACTION_START_TIME)
{
//set the time started
psRepairFac->timeStarted = gameTime;
//reset the points added
psRepairFac->currentPtsAdded = 0;
}
// FIXME: duplicate code, make repairing cost power again
/* do repairing */
iDt = gameTime - psRepairFac->timeStarted;
//- this was a bit exponential ...
pointsToAdd = (iDt * psRepairFac->power / GAME_TICKS_PER_SEC) -
psRepairFac->currentPtsAdded;
// do some repair
if (!pointsToAdd)
{
// We need to at least repair SOMETHING
pointsToAdd = 1;
}
// just add the points; these are integers, not floats
psDroid->body += pointsToAdd;
psRepairFac->currentPtsAdded += pointsToAdd;
psDroid->body += gameTimeAdjustedAverage(psRepairFac->power);
}
if (psDroid->body >= psDroid->originalBody)

View File

@ -212,11 +212,9 @@ class DROID_GROUP;
struct REPAIR_FACILITY
{
UDWORD power; /* Power used in repairing */
UDWORD timeStarted; /* Time repair started on current object */
UDWORD power; // Repair rate. Nothing to do with power.
BASE_OBJECT *psObj; /* Object being repaired */
FLAG_POSITION *psDeliveryPoint; /* Place for the repaired droids to assemble at */
UDWORD currentPtsAdded; /* stores the amount of body points added to the unit that is being worked on */
// The group the droids to be repaired by this facility belong to
DROID_GROUP * psGroup;