Skip to content

Commit

Permalink
Don't remove file extensions from mod names.
Browse files Browse the repository at this point in the history
Fixes loading of savegames with a mod, whether the mod is loaded from
the command line or not.

Old savegames won't work unfortunately, and savegames started with a .wz
mod won't continue if that mod gets expanded later.

Fixes #2735, closes #2825, #2610.

Conflicts:

	src/main.c
  • Loading branch information
cybersphinx committed Aug 8, 2011
1 parent b01a8ba commit 5886695
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions src/main.c
Expand Up @@ -294,37 +294,12 @@ void clearOverrideMods(void)
void addLoadedMod(const char * modname)
{
char * mod = strdup(modname);
int i, modlen;
int i;
if (num_loaded_mods >= MAX_MODS)
{
// mod list full
return;
}
modlen = strlen(mod);
if (modlen >= 3 && strcmp(&mod[modlen-3], ".wz")==0)
{
// remove ".wz" from end
mod[modlen-3] = 0;
modlen -= 3;
}
if (modlen >= 4 && strcmp(&mod[modlen-4], ".cam")==0)
{
// remove ".cam.wz" from end
mod[modlen-4] = 0;
modlen -= 4;
}
else if (modlen >= 4 && strcmp(&mod[modlen-4], ".mod")==0)
{
// remove ".mod.wz" from end
mod[modlen-4] = 0;
modlen -= 4;
}
else if (modlen >= 5 && strcmp(&mod[modlen-5], ".gmod")==0)
{
// remove ".gmod.wz" from end
mod[modlen-5] = 0;
modlen -= 5;
}
// Yes, this is an online insertion sort.
// I swear, for the numbers of mods this is going to be dealing with
// (i.e. 0 to 2), it really is faster than, say, Quicksort.
Expand Down

0 comments on commit 5886695

Please sign in to comment.