73 |
{ |
{ |
74 |
new len = get_cvar_string("amx_nextmap", szArg, iMax) |
new len = get_cvar_string("amx_nextmap", szArg, iMax) |
75 |
|
|
76 |
if (is_map_valid(szArg)) return len |
if (ValidMap(szArg)) return len |
77 |
len = copy(szArg, iMax, g_nextMap) |
len = copy(szArg, iMax, g_nextMap) |
78 |
set_cvar_string("amx_nextmap", g_nextMap) |
set_cvar_string("amx_nextmap", g_nextMap) |
79 |
|
|
119 |
|
|
120 |
new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist (file ^"%s^")" |
new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist (file ^"%s^")" |
121 |
|
|
122 |
|
stock bool:ValidMap(mapname[]) |
123 |
|
{ |
124 |
|
if ( is_map_valid(mapname) ) |
125 |
|
{ |
126 |
|
return true; |
127 |
|
} |
128 |
|
// If the is_map_valid check failed, check the end of the string |
129 |
|
new len = strlen(mapname) - 4; |
130 |
|
|
131 |
|
// The mapname was too short to possibly house the .bsp extension |
132 |
|
if (len < 0) |
133 |
|
{ |
134 |
|
return false; |
135 |
|
} |
136 |
|
if ( equali(mapname[len], ".bsp") ) |
137 |
|
{ |
138 |
|
// If the ending was .bsp, then cut it off. |
139 |
|
// the string is byref'ed, so this copies back to the loaded text. |
140 |
|
mapname[len] = '^0'; |
141 |
|
|
142 |
|
// recheck |
143 |
|
if ( is_map_valid(mapname) ) |
144 |
|
{ |
145 |
|
return true; |
146 |
|
} |
147 |
|
} |
148 |
|
|
149 |
|
return false; |
150 |
|
} |
151 |
|
|
152 |
#if defined OBEY_MAPCYCLE |
#if defined OBEY_MAPCYCLE |
153 |
readMapCycle(szFileName[], szNext[], iNext) |
readMapCycle(szFileName[], szNext[], iNext) |
154 |
{ |
{ |
159 |
{ |
{ |
160 |
while (read_file(szFileName, i++, szBuffer, 31, b)) |
while (read_file(szFileName, i++, szBuffer, 31, b)) |
161 |
{ |
{ |
162 |
if (!isalnum(szBuffer[0]) || !is_map_valid(szBuffer)) continue |
if (!isalnum(szBuffer[0]) || !ValidMap(szBuffer)) continue |
163 |
|
|
164 |
if (!iMaps) |
if (!iMaps) |
165 |
copy(szFirst, 31, szBuffer) |
copy(szFirst, 31, szBuffer) |
166 |
|
|
198 |
{ |
{ |
199 |
while (read_file(szFileName, i++, szBuffer, 31, b)) |
while (read_file(szFileName, i++, szBuffer, 31, b)) |
200 |
{ |
{ |
201 |
if (!isalnum(szBuffer[0]) || !is_map_valid(szBuffer)) continue |
if (!isalnum(szBuffer[0]) || !ValidMap(szBuffer)) continue |
202 |
|
|
203 |
if (!iMaps) |
if (!iMaps) |
204 |
{ |
{ |