Skip to content

Commit

Permalink
Don't create .broguesave files when using --print-seed-catalog (tmewe…
Browse files Browse the repository at this point in the history
  • Loading branch information
nstoddard authored Jan 9, 2023
1 parent 050a8a9 commit 9ad7cea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions changes/print-seed-catalog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The --print-seed-catalog option no longer creates unnecessary .broguesave files
8 changes: 8 additions & 0 deletions src/brogue/Recordings.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ void writeHeaderInfo(char *path) {
}

void flushBufferToFile() {
if (currentFilePath[0] == '\0') {
return;
}

short i;
FILE *recordFile;

Expand Down Expand Up @@ -453,6 +457,10 @@ static boolean getPatchVersion(char *versionString, unsigned short *patchVersion
// creates a game recording file, or if in playback mode,
// initializes based on and starts reading from the recording file
void initRecording() {
if (currentFilePath[0] == '\0') {
return;
}

short i;
boolean wizardMode;
unsigned short recPatch;
Expand Down
1 change: 0 additions & 1 deletion src/brogue/Rogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ typedef long long fixpt;
#define FP_DIV(x, y) ((x) * FP_FACTOR / (y))

// recording and save filenames
#define LAST_GAME_PATH "LastGame.broguesave"
#define LAST_GAME_NAME "LastGame"
#define LAST_RECORDING_NAME "LastRecording"
#define RECORDING_SUFFIX ".broguerec"
Expand Down
7 changes: 1 addition & 6 deletions src/brogue/SeedCatalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,9 @@ static void printSeedCatalogAltars(boolean isCsvFormat) {
void printSeedCatalog(uint64_t startingSeed, uint64_t numberOfSeedsToScan, unsigned int scanThroughDepth,
boolean isCsvFormat) {
uint64_t theSeed;
char path[BROGUE_FILENAME_MAX];
char message[1000] = "";
rogue.nextGame = NG_NOTHING;

getAvailableFilePath(path, LAST_GAME_NAME, GAME_SUFFIX);
strcat(path, GAME_SUFFIX);

sprintf(message, "Brogue seed catalog, seeds %llu to %llu, through depth %u.\n"
"Generated with %s. Dungeons unchanged since %s.\n\n"
"To play one of these seeds, press control-N from the title screen"
Expand All @@ -286,7 +282,7 @@ void printSeedCatalog(uint64_t startingSeed, uint64_t numberOfSeedsToScan, unsig
rogue.playbackFastForward = false;
rogue.playbackBetweenTurns = false;

strcpy(currentFilePath, path);
currentFilePath[0] = '\0';
initializeRogue(theSeed);
rogue.playbackOmniscience = true;
for (rogue.depthLevel = 1; rogue.depthLevel <= scanThroughDepth; rogue.depthLevel++) {
Expand All @@ -304,7 +300,6 @@ void printSeedCatalog(uint64_t startingSeed, uint64_t numberOfSeedsToScan, unsig
}

freeEverything();
remove(currentFilePath); // Don't add a spurious LastGame file to the brogue folder.
}

}

0 comments on commit 9ad7cea

Please sign in to comment.