Hashcode should use unsigned long.

This commit is contained in:
Steve 2016-05-09 09:34:04 +01:00
parent 6287e10746
commit 410400633b
3 changed files with 10 additions and 10 deletions

View File

@ -201,7 +201,7 @@ void loadMission(char *filename)
static char *getAutoBackground(char *filename) static char *getAutoBackground(char *filename)
{ {
int hash; unsigned long hash;
if (!game.currentMission->challengeData.isChallenge) if (!game.currentMission->challengeData.isChallenge)
{ {
@ -217,7 +217,7 @@ static char *getAutoBackground(char *filename)
static char *getAutoPlanet(char *filename) static char *getAutoPlanet(char *filename)
{ {
int hash; unsigned long hash;
if (!game.currentMission->challengeData.isChallenge) if (!game.currentMission->challengeData.isChallenge)
{ {
@ -233,7 +233,7 @@ static char *getAutoPlanet(char *filename)
static char *getAutoMusic(char *filename) static char *getAutoMusic(char *filename)
{ {
int hash; unsigned long hash;
if (!game.currentMission->challengeData.isChallenge) if (!game.currentMission->challengeData.isChallenge)
{ {
@ -241,7 +241,7 @@ static char *getAutoMusic(char *filename)
} }
else else
{ {
hash = hashcode(filename); hash = hashcode(game.currentMission->description);
} }
return getMusicFilename(hash); return getMusicFilename(hash);

View File

@ -44,9 +44,9 @@ extern void initMissionInfo(void);
extern char *getTranslatedString(char *string); extern char *getTranslatedString(char *string);
extern void updateStarSystemMissions(void); extern void updateStarSystemMissions(void);
extern void updateChallengeMissions(void); extern void updateChallengeMissions(void);
extern char *getBackgroundTextureName(int n); extern char *getBackgroundTextureName(unsigned long n);
extern char *getPlanetTextureName(int n); extern char *getPlanetTextureName(unsigned long n);
extern char *getMusicFilename(int n); extern char *getMusicFilename(unsigned long n);
extern int getJSONValue(cJSON *node, char *name, int defValue); extern int getJSONValue(cJSON *node, char *name, int defValue);
extern char *getJSONValueStr(cJSON *node, char *name, char *defValue); extern char *getJSONValueStr(cJSON *node, char *name, char *defValue);
extern void addAllToQuadtree(void); extern void addAllToQuadtree(void);

View File

@ -81,17 +81,17 @@ void initResources(void)
free(filenames); free(filenames);
} }
char *getBackgroundTextureName(int i) char *getBackgroundTextureName(unsigned long i)
{ {
return backgrounds[i % numBackgrounds]; return backgrounds[i % numBackgrounds];
} }
char *getPlanetTextureName(int i) char *getPlanetTextureName(unsigned long i)
{ {
return planets[i % numPlanets]; return planets[i % numPlanets];
} }
char *getMusicFilename(int i) char *getMusicFilename(unsigned long i)
{ {
return musicFiles[i % numMusicFiles]; return musicFiles[i % numMusicFiles];
} }