Skip to content

Commit b1132d2

Browse files
committed
Merge pull request spoutn1k#27 from andrewminer/master
Add the ability to render MystCraft ages
2 parents 30ab495 + 1204c67 commit b1132d2

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

globals.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ Marker g_Markers[MAX_MARKERS];
3131
char *g_TilePath = NULL;
3232

3333
int8_t g_SectionMin, g_SectionMax;
34+
35+
uint8_t g_MystCraftAge;

globals.h

+2
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,6 @@ extern char *g_TilePath;
6161

6262
extern int8_t g_SectionMin, g_SectionMax;
6363

64+
extern uint8_t g_MystCraftAge;
65+
6466
#endif

main.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ int main(int argc, char **argv)
253253
marker.offsetX = x - (marker.chunkX * CHUNKSIZE_X);
254254
marker.offsetZ = z - (marker.chunkZ * CHUNKSIZE_Z);
255255
g_MarkerCount++;
256+
} else if (strcmp(option, "-mystcraftage") == 0) {
257+
if (!MOREARGS(1)) {
258+
printf("Error: %s needs an integer age number argument", option);
259+
return 1;
260+
}
261+
g_MystCraftAge = atoi(NEXTARG);
256262
} else {
257263
filename = (char *) option;
258264
}
@@ -326,7 +332,15 @@ int main(int argc, char **argv)
326332
return 1;
327333
}
328334
filename = tmp;
329-
}
335+
} else if (g_MystCraftAge) {
336+
char *tmp = new char[strlen(filename) + 20];
337+
sprintf(tmp, "%s/DIM_MYST%d", filename, g_MystCraftAge);
338+
if (!dirExists(tmp)) {
339+
printf("Error: This world does not have Age %d!\n", g_MystCraftAge);
340+
return 1;
341+
}
342+
filename = tmp;
343+
}
330344
// Figure out whether this is the old save format or McRegion or Anvil
331345
g_WorldFormat = getWorldFormat(filename);
332346

0 commit comments

Comments
 (0)