Jesus4Lyf
Good Idea™
- Reaction score
- 397
Debug Block
A very simple snippet for having blocks of code in debug mode only, or not in debug mode only.
JASS:
//! textmacro StartDebug
static if false then
debug endif
//! endtextmacro
//! textmacro EndDebug
debug static if false then
endif
//! endtextmacro
//! textmacro StartNoDebug
debug static if false then
//! endtextmacro
//! textmacro EndNoDebug
debug endif
//! endtextmacro
Test script (and example use):
JASS:
scope TestDebugMode initializer OnInit
private function OnInit takes nothing returns nothing
//! runtextmacro StartDebug()
call BJDebugMsg("Debug Mode")
//! runtextmacro EndDebug()
//! runtextmacro StartNoDebug()
call BJDebugMsg("No Debug Mode")
//! runtextmacro EndNoDebug()
endfunction
endscope
This abuses static ifs. You can remove functions from your map using this (but defining a function for debug mode and for non-debug mode will count as a multiple declaration still). Does not work for global variable declarations.