[Fixed] [SW] Assertion failure on The Great Escape ($rock.map)

Moderator: Raze Developers

[SW] Assertion failure on The Great Escape ($rock.map)

Postby Talon1024 » Tue May 11, 2021 1:57 am

When one tries to start $rock.map, Raze quits with an assertion failure:
Code: Select allExpand view
raze: ../source/games/sw/src/rooms.cpp:842: bool ShadowWarrior::FindCeilingView(short int, int32_t*, int32_t*, int32_t, int16_t*): Assertion `sp->hitag == VIEW_THRU_FLOOR' failed.
Talon1024
 
 
 
Joined: 27 Jun 2016
Github ID: Talon1024
Operating System: Debian-like Linux (Debian, Ubuntu, Mint, etc) 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [SW] Assertion failure on The Great Escape ($rock.map)

Postby Graf Zahl » Tue May 11, 2021 2:42 am

Fixed.

I really don't get it why some programmers love to put in asserts instead of doing proper failure checks.
SW and even more Blood are full of this shit.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [SW] Assertion failure on The Great Escape ($rock.map)

Postby Rachael » Tue May 11, 2021 3:23 am

I use asserts when it should be physically *impossible* to reach a certain code condition, I use them to alert anyone who changes the code that they fucked things up. If I put in an assert it's usually because I am confident that the condition should never happen, but that if it does, it is a serious problem that must be managed programatically. Putting an if there is a good fail-over mechanism if the problem reaches the end-user, but asserts are a lot more valuable for relaying critical issues to the next coder in line who changes my code for any reason.

Of course, attaching a comment to the assert might help too, in order to let them know of their mistake...
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [SW] Assertion failure on The Great Escape ($rock.map)

Postby Graf Zahl » Tue May 11, 2021 3:40 am

That's how I use asserts as well - but this particular case relied on the level data being correct, i.e. precisely where it is not guaranteed to be impossible to ever trigger it.
These old code bases are full of these kinds of asserts because the proper range check was deemed too expensive, I presume...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [SW] Assertion failure on The Great Escape ($rock.map)

Postby Rachael » Tue May 11, 2021 3:50 am

Yeah using asserts to verify data that the end-user can change is a really bad idea...

If you're dealing with the end-user, you should be using the tools that the end-user gets to see (i.e. warning errors and/or fatal errors), not asserts.
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests