unsigned int get_random_number(int nr, unsigned int max)
{
- return (random_linux_libc(nr) % max);
+ return (max > 0 ? random_linux_libc(nr) % max : 0);
}
int getFileVersion(FILE *file)
{
- int version_major, version_minor, version_patch;
+ int version_major, version_minor, version_patch, version_release;
- version_major = fgetc(file);
- version_minor = fgetc(file);
- version_patch = fgetc(file);
- fgetc(file); /* not used */
+ version_major = fgetc(file);
+ version_minor = fgetc(file);
+ version_patch = fgetc(file);
+ version_release = fgetc(file);
- return VERSION_IDENT(version_major, version_minor, version_patch);
+ return RELEASE_IDENT(version_major, version_minor, version_patch,
+ version_release);
}
void putFileVersion(FILE *file, int version)
{
- int version_major = VERSION_MAJOR(version);
- int version_minor = VERSION_MINOR(version);
- int version_patch = VERSION_PATCH(version);
+ int version_major = VERSION_MAJOR(version);
+ int version_minor = VERSION_MINOR(version);
+ int version_patch = VERSION_PATCH(version);
+ int version_release = VERSION_RELEASE(version);
- fputc(version_major, file);
- fputc(version_minor, file);
- fputc(version_patch, file);
- fputc(0, file); /* not used */
+ fputc(version_major, file);
+ fputc(version_minor, file);
+ fputc(version_patch, file);
+ fputc(version_release, file);
}
void ReadUnusedBytesFromFile(FILE *file, unsigned long bytes)
ListNode *node;
char *filename = getCustomArtworkFilename(basename, artwork_info->type);
+#if 1
+ if (strcmp(basename, "RocksScreen.pcx") == 0)
+ printf("::: got filename '%s'\n", filename);
+#endif
+
if (filename == NULL)
{
int error_mode = ERR_WARN;
This usually means that this artwork does not exist in this artwork set
and a fallback to the existing artwork is done. */
-#if 0
- printf("[artwork '%s' already exists (same list entry)]\n", filename);
+#if 1
+#if 1
+ if (strcmp(basename, "RocksScreen.pcx") == 0)
+#endif
+ printf("[artwork '%s' already exists (same list entry)]\n", filename);
#endif
return;