#pragma once #include "SLog.h" // Fraun 7/11/2025 advanced error handle #include #include int fastf2i_round( float f ); int fastf2i( float fValue ); int Float2Int( float a ); bool isZero( float value ); template DEST dynamicCast( SRC src ) { if (!src) { #ifdef _DEV assert( 0 && "Type change failed (dynamicCast): the target is not valid." ); SDEBUGLOG( "Type change failed (dynamicCast): the target is not valid" ); #endif return NULL; } // In the distribution version, all type conversion errors should be fixed, // but it seems difficult to be sure that they are all corrected. // If dest is not modified, a null reference error may occur because dest becomes null. // Therefore, it seems that static_cast should be used in the distribution version, as before. #ifdef _DEV DEST dest = dynamic_cast(src); if (!dest) { // Fraun 7/11/2025 advanced error handle std::string strOutput = "Type cast failed (dynamicCast) for "; strOutput += typeid(src).name(); strOutput += " casting to "; strOutput += typeid(DEST).name(); //assert(NULL && "Type cast failed (dynamicCast) for: %s", ); assert(NULL && strOutput.c_str()); //MessageBox(HWND_DESKTOP, "Type cast failed (dynamicCast)", "Error", MB_OK | MB_ICONERROR ); MessageBox(HWND_DESKTOP, strOutput.c_str(), "Error", MB_OK | MB_ICONERROR ); } #else DEST dest = static_cast(src); #endif return dest; }