Skip to content

Commit b4e33f2

Browse files
committedJan 2, 2011
Change power accruing rate, with N droids or structures wanting to use power, from 5*FPS/(N+1) to 25/second.
Previous code was insane, despite some previous attempts at improving the indentation of the code, and meant that players with better graphics cards could build, produce and research 5x-10x faster. Changelog: Construction, production and research speeds are no longer linearly dependent on framerate on high oil maps.
1 parent 1fbf577 commit b4e33f2

File tree

7 files changed

+50
-247
lines changed

7 files changed

+50
-247
lines changed
 

‎lib/gamelib/gtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/** The maximum time for one frame (stops the clock running away when debugging)
3131
* changed to /6 by ajl. if this needs to go back to ticks/10 then tell me. */
32-
#define GTIME_MAXFRAME (GAME_TICKS_PER_SEC/6)
32+
#define GTIME_MAXFRAME (GAME_TICKS_PER_SEC/4)
3333

3434
/** The current time in the game world. */
3535
extern UDWORD gameTime;

‎src/droid.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,6 @@ void removeDroidBase(DROID *psDel)
384384

385385
CHECK_DROID(psDel);
386386

387-
//tell the power system its gone
388-
powerDestroyObject((BASE_OBJECT *)psDel);
389-
390387
if (isDead((BASE_OBJECT *)psDel))
391388
{
392389
// droid has already been killed, quit
@@ -571,9 +568,6 @@ BOOL droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS])
571568

572569
driveDroidKilled(psDroid); // Tell the driver system it's gone.
573570

574-
//tell the power system its gone
575-
powerDestroyObject((BASE_OBJECT *)psDroid);
576-
577571
if (isDead((BASE_OBJECT *) psDroid))
578572
{
579573
// droid has already been killed, quit
@@ -605,9 +599,6 @@ BOOL droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS])
605599

606600
removeDroid(psDroid, pList);
607601

608-
// tell the power system it is gone
609-
powerDestroyObject((BASE_OBJECT *)psDroid);
610-
611602
if (psDroid->player == selectedPlayer)
612603
{
613604
intRefreshScreen();
@@ -818,18 +809,7 @@ void droidUpdate(DROID *psDroid)
818809
// May need power
819810
if (droidUsesPower(psDroid))
820811
{
821-
if (checkPower(psDroid->player, POWER_PER_CYCLE))
822-
{
823-
// Check if this droid is due some power
824-
if (getLastPowered((BASE_OBJECT *)psDroid))
825-
{
826-
// Get some power if necessary
827-
if (accruePower((BASE_OBJECT *)psDroid))
828-
{
829-
updateLastPowered((BASE_OBJECT *)psDroid, psDroid->player);
830-
}
831-
}
832-
}
812+
accruePower((BASE_OBJECT *)psDroid);
833813
}
834814

835815
// ai update droid

‎src/loop.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,6 @@ GAMECODE gameLoop(void)
282282
//update the current power available for a player
283283
updatePlayerPower(i);
284284

285-
//this is a check cos there is a problem with the power but not sure where!!
286-
powerCheck(true, (UBYTE)i);
287-
288285
//set the flag for each player
289286
setHQExists(false, i);
290287
setSatUplinkExists(false, i);
@@ -435,8 +432,6 @@ GAMECODE gameLoop(void)
435432
setLasSatExists(true, i);
436433
}
437434
}
438-
//this is a check cos there is a problem with the power but not sure where!!
439-
powerCheck(false, (UBYTE)i);
440435
}
441436

442437
missionTimerUpdate();

‎src/mission.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,6 @@ void restoreMissionData(void)
900900
apsFlagPosLists[inc] = mission.apsFlagPosLists[inc];
901901
mission.apsFlagPosLists[inc] = NULL;
902902
//asPower[inc].usedPower = mission.usedPower[inc];
903-
//init the next structure to be powered
904-
asPower[inc].psLastPowered = NULL;
905903
}
906904
apsSensorList[0] = mission.apsSensorList[0];
907905
mission.apsSensorList[0] = NULL;
@@ -1685,19 +1683,8 @@ void aiUpdateMissionStructure(STRUCTURE *psStructure)
16851683
}
16861684

16871685
//check if any power available
1688-
if ((asPower[psStructure->player].currentPower > POWER_PER_CYCLE) ||
1689-
(!powerCalculated))
1690-
{
1691-
//check if this structure is due some power
1692-
if (getLastPowered((BASE_OBJECT *)psStructure))
1693-
{
1694-
//get some power if necessary
1695-
if (accruePower((BASE_OBJECT *)psStructure))
1696-
{
1697-
updateLastPowered((BASE_OBJECT *)psStructure, psStructure->player);
1698-
}
1699-
}
1700-
}
1686+
//check if this structure is due some power
1687+
accruePower((BASE_OBJECT *)psStructure);
17011688
//determine the Subject
17021689
switch (psStructure->pStructureType->type)
17031690
{

0 commit comments

Comments
 (0)