From 2c71e272b5c3e4c7895578cf1e881df72012ecd5 Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Thu, 7 Sep 2017 03:54:30 +0300 Subject: [PATCH] allow 'mywad.wad:/map01' in '-map' and other similar places (previously, only ':\' was allowed) --- src/game/g_game.pas | 9 +++++---- src/game/g_menu.pas | 7 ++++--- src/game/g_netmsg.pas | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 7f77a41..5f56a74 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -4106,7 +4106,7 @@ begin g_Player_ResetTeams(); - if Pos(':\', Map) > 0 then + if isWadPath(Map) then begin NewWAD := g_ExtractWadName(Map); ResName := g_ExtractFileName(Map); @@ -4481,7 +4481,8 @@ var time: Integer; } begin - a := Pos('.wad:\', gMapToDelete); + a := Pos('.wad:\', toLowerCase1251(gMapToDelete)); + if (a = 0) then a := Pos('.wad:/', toLowerCase1251(gMapToDelete)); if a = 0 then Exit; @@ -6108,7 +6109,7 @@ begin if gNextMap = '' then gNextMap := g_Game_GetNextMap(); // Ïðîâåðÿåì, íå çàäàí ëè WAD ôàéë ðåñóðñíîé ñòðîêîé - if Pos(':\', gNextMap) = 0 then + if not isWadPath(gNextMap) then s := gGameSettings.WAD + ':\' + gNextMap else s := gNextMap; @@ -7009,7 +7010,7 @@ begin s := Find_Param_Value(pars, '-exec'); if s <> '' then begin - if Pos(':\', s) = 0 then + if not isWadPath(s) then s := GameDir + '/' + s; {$I-} diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index a842519..aca1dbf 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -47,7 +47,8 @@ uses e_log, SysUtils, CONFIG, g_playermodel, DateUtils, MAPDEF, wadreader, Math, g_saveload, e_texture, GL, GLExt, g_language, - g_net, g_netmsg, g_netmaster, g_items, e_input; + g_net, g_netmsg, g_netmaster, g_items, e_input, + utils; type TYNCallback = procedure (yes:Boolean); @@ -551,7 +552,7 @@ begin Map := TGUILabel(GetControl('lbMap')).Text; if Map = '' then Exit; - if Pos(':\', Map) = 0 then + if not isWadPath(Map) then Exit; GameMode := TGUISwitch(GetControl('swGameMode')).ItemIndex+1; @@ -611,7 +612,7 @@ begin Map := TGUILabel(GetControl('lbMap')).Text; if Map = '' then Exit; - if Pos(':\', Map) = 0 then + if not isWadPath(Map) then Exit; GameMode := TGUISwitch(GetControl('swGameMode')).ItemIndex+1; diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index 88764ed..822ae9b 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -914,7 +914,7 @@ begin NetOut.Write(EvStr); NetOut.Write(Byte(gLastMap)); NetOut.Write(gTime); - if (EvType = NET_EV_MAPSTART) and (Pos(':\', EvStr) > 0) then + if (EvType = NET_EV_MAPSTART) and isWadPath(EvStr) then begin NetOut.Write(Byte(1)); NetOut.Write(gWADHash); @@ -1668,7 +1668,7 @@ begin gWADHash := EvHash; if not g_Game_StartMap(EvStr, True) then begin - if Pos(':\', EvStr) = 0 then + if not isWadPath(EvStr) then g_FatalError(Format(_lc[I_GAME_ERROR_MAP_LOAD], [gGameSettings.WAD + ':\' + EvStr])) else g_FatalError(Format(_lc[I_GAME_ERROR_MAP_LOAD], [EvStr])); -- 2.29.2