Apply patch #1971 - Remove "Sk-" and "-T1" from map names in map chooser.

Committed, as requested by Zarel

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11113 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2010-07-10 01:25:10 +00:00 committed by Git SVN Gateway
parent 8e02c3d3ea
commit 6137e01960
3 changed files with 21 additions and 4 deletions

View File

@ -37,7 +37,7 @@ void closeConfig( void );
void setDefaultFrameRateLimit(void); void setDefaultFrameRateLimit(void);
/// Default map for Skirmish /// Default map for Skirmish
static const char DEFAULTSKIRMISHMAP[] = "Sk-Rush"; static const char DEFAULTSKIRMISHMAP[] = "Rush";
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -145,12 +145,19 @@ LEVEL_DATASET* levFindDataSet(const char* name)
for (psNewLevel = psLevels; psNewLevel; psNewLevel = psNewLevel->psNext) for (psNewLevel = psLevels; psNewLevel; psNewLevel = psNewLevel->psNext)
{ {
if (psNewLevel->pName != NULL if (psNewLevel->pName != NULL)
&& strcmp(psNewLevel->pName, name) == 0) {
if (strcmp(psNewLevel->pName, name) == 0 ||
(strncmp(psNewLevel->pName, "Sk-", 3) == 0 &&
strcmp(psNewLevel->pName+3, name) == 0) ||
(strncmp(psNewLevel->pName, "Sk-", 3) == 0 &&
strcmp(psNewLevel->pName+strlen(name)-3-3, "-T1") &&
strncmp(psNewLevel->pName+3, name, strlen(name)-3) == 0))
{ {
return psNewLevel; return psNewLevel;
} }
} }
}
return NULL; return NULL;
} }

View File

@ -569,6 +569,16 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
sstrcpy(tips[tip_index], mapName); sstrcpy(tips[tip_index], mapName);
free(mapName); free(mapName);
// Chop off the "Sk-" if necessary
if (strncmp(tips[tip_index], "Sk-", 3) == 0)
{
memmove(tips[tip_index], tips[tip_index]+3, strlen(tips[tip_index]+3)+1);
}
if (strncmp(tips[tip_index]+strlen(tips[tip_index])-3, "-T1", 3)==0)
{
tips[tip_index][strlen(tips[tip_index])-3] = 0;
}
sButInit.pTip = tips[tip_index]; sButInit.pTip = tips[tip_index];
sButInit.pText = tips[tip_index]; sButInit.pText = tips[tip_index];
sButInit.UserData = players; sButInit.UserData = players;