Skip to content

Commit 703665b

Browse files
committed
Increase recycled experience storage in memory.
1 parent 87499cf commit 703665b

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/droid.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ back when building is destroyed*/
4646

4747
#define DROID_RESISTANCE_FACTOR 30
4848

49-
#define MAX_RECYCLED_DROIDS 32
49+
#define MAX_RECYCLED_DROIDS 100
50+
// Changing this breaks savegames!
51+
#define SAVE_RECYCLED_DROIDS 32
5052

5153
//storage
5254
extern DROID_TEMPLATE *apsDroidTemplates[MAX_PLAYERS];

src/game.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ static bool deserializeSaveGameV14Data(PHYSFS_file* fileHandle, SAVE_GAME_V14* s
878878
#define GAME_SAVE_V15 \
879879
GAME_SAVE_V14; \
880880
BOOL offWorldKeepLists;\
881-
uint8_t aDroidExperience[MAX_PLAYERS][MAX_RECYCLED_DROIDS];\
881+
uint8_t aDroidExperience[MAX_PLAYERS][SAVE_RECYCLED_DROIDS];\
882882
uint32_t RubbleTile;\
883883
uint32_t WaterTile;\
884884
uint32_t fogColour;\
@@ -899,7 +899,7 @@ static bool serializeSaveGameV15Data(PHYSFS_file* fileHandle, const SAVE_GAME_V1
899899

900900
for (i = 0; i < MAX_PLAYERS; ++i)
901901
{
902-
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
902+
for (j = 0; j < SAVE_RECYCLED_DROIDS; ++j)
903903
{
904904
if (!PHYSFS_writeUBE8(fileHandle, serializeGame->aDroidExperience[i][j]))
905905
return false;
@@ -925,7 +925,7 @@ static bool deserializeSaveGameV15Data(PHYSFS_file* fileHandle, SAVE_GAME_V15* s
925925

926926
for (i = 0; i < MAX_PLAYERS; ++i)
927927
{
928-
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
928+
for (j = 0; j < SAVE_RECYCLED_DROIDS; ++j)
929929
{
930930
if (!PHYSFS_readUBE8(fileHandle, &serializeGame->aDroidExperience[i][j]))
931931
return false;
@@ -1217,7 +1217,7 @@ typedef struct save_game_v27
12171217
*/
12181218
#define GAME_SAVE_V27 \
12191219
GAME_SAVE_V24; \
1220-
uint16_t awDroidExperience[MAX_PLAYERS][MAX_RECYCLED_DROIDS]
1220+
uint16_t awDroidExperience[MAX_PLAYERS][SAVE_RECYCLED_DROIDS]
12211221

12221222
typedef struct save_game_v27
12231223
{
@@ -1233,7 +1233,7 @@ static bool serializeSaveGameV27Data(PHYSFS_file* fileHandle, const SAVE_GAME_V2
12331233

12341234
for (i = 0; i < MAX_PLAYERS; ++i)
12351235
{
1236-
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
1236+
for (j = 0; j < SAVE_RECYCLED_DROIDS; ++j)
12371237
{
12381238
if (!PHYSFS_writeUBE16(fileHandle, serializeGame->awDroidExperience[i][j]))
12391239
return false;
@@ -1252,7 +1252,7 @@ static bool deserializeSaveGameV27Data(PHYSFS_file* fileHandle, SAVE_GAME_V27* s
12521252

12531253
for (i = 0; i < MAX_PLAYERS; ++i)
12541254
{
1255-
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
1255+
for (j = 0; j < SAVE_RECYCLED_DROIDS; ++j)
12561256
{
12571257
if (!PHYSFS_readUBE16(fileHandle, &serializeGame->awDroidExperience[i][j]))
12581258
return false;
@@ -2586,7 +2586,7 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
25862586
{
25872587
for (player = 0; player < MAX_PLAYERS; player++)
25882588
{
2589-
for (inc = 0; inc < MAX_RECYCLED_DROIDS; inc++)
2589+
for (inc = 0; inc < SAVE_RECYCLED_DROIDS; inc++)
25902590
{
25912591
aDroidExperience[player][inc] = saveGameData.awDroidExperience[player][inc];
25922592
}
@@ -2596,7 +2596,7 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
25962596
{
25972597
for (player = 0; player < MAX_PLAYERS; player++)
25982598
{
2599-
for (inc = 0; inc < MAX_RECYCLED_DROIDS; inc++)
2599+
for (inc = 0; inc < SAVE_RECYCLED_DROIDS; inc++)
26002600
{
26012601
aDroidExperience[player][inc] = saveGameData.aDroidExperience[player][inc];
26022602
}
@@ -3984,7 +3984,7 @@ static void endian_SaveGameV(SAVE_GAME* psSaveGame, UDWORD version)
39843984
/* GAME_SAVE_V27 includes GAME_SAVE_V24 */
39853985
if(version >= VERSION_27) {
39863986
for(i = 0; i < MAX_PLAYERS; i++)
3987-
for(j = 0; j < MAX_RECYCLED_DROIDS; j++)
3987+
for(j = 0; j < SAVE_RECYCLED_DROIDS; j++)
39883988
endian_uword(&psSaveGame->awDroidExperience[i][j]);
39893989
}
39903990
/* GAME_SAVE_V24 includes GAME_SAVE_V22 */
@@ -4717,7 +4717,7 @@ bool gameLoadV(PHYSFS_file* fileHandle, unsigned int version)
47174717

47184718
for (player = 0; player < MAX_PLAYERS; player++)
47194719
{
4720-
for (i = 0; i < MAX_RECYCLED_DROIDS; ++i)
4720+
for (i = 0; i < SAVE_RECYCLED_DROIDS; ++i)
47214721
{
47224722
aDroidExperience[player][i] = 0;//clear experience before
47234723
}
@@ -4735,7 +4735,7 @@ bool gameLoadV(PHYSFS_file* fileHandle, unsigned int version)
47354735

47364736
for (player = 0; player < MAX_PLAYERS; player++)
47374737
{
4738-
for (i = 0; i < MAX_RECYCLED_DROIDS; ++i)
4738+
for (i = 0; i < SAVE_RECYCLED_DROIDS; ++i)
47394739
{
47404740
aDroidExperience[player][i] = 0;//clear experience before building saved units
47414741
}
@@ -4943,7 +4943,7 @@ static bool writeGameFile(const char* fileName, SDWORD saveType)
49434943
saveGame.aDefaultECM[i] = aDefaultECM[i];
49444944
saveGame.aDefaultRepair[i] = aDefaultRepair[i];
49454945

4946-
for (j = 0; j < MAX_RECYCLED_DROIDS; ++j)
4946+
for (j = 0; j < SAVE_RECYCLED_DROIDS; ++j)
49474947
{
49484948
saveGame.awDroidExperience[i][j] = aDroidExperience[i][j];
49494949
}

0 commit comments

Comments
 (0)