From 9a10a0f13640c2e87a5d018411ac2778095ece83 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 18 Mar 2017 18:22:46 +0200 Subject: [PATCH] Added handling of any space characters in BEX par times Back to Saturn X E1: Get Out Of My Stations (https://www.doomworld.com/idgames/levels/doom2/megawads/btsx_e1) uses tabs instead of spaces and bunch of 'Need data after par' warnings were printed during loading PrBoom supports arbitrary space characters too --- src/d_dehacked.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index d2c8f3b25f..d05406910d 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -2026,7 +2026,20 @@ static int PatchPars (int dummy) if (stricmp ("par", Line1)) return result; - space = strchr (Line2, ' '); + const auto FindSpace = [](char* str) -> char* + { + while ('\0' != *str) + { + if (isspace(*str)) + { + return str; + } + ++str; + } + return nullptr; + }; + + space = FindSpace (Line2); if (!space) { Printf ("Need data after par.\n"); @@ -2038,7 +2051,7 @@ static int PatchPars (int dummy) while (*space && isspace(*space)) space++; - moredata = strchr (space, ' '); + moredata = FindSpace (space); if (moredata) { // At least 3 items on this line, must be E?M? format