-
Notifications
You must be signed in to change notification settings - Fork 3
dynamic_cast patch
Gratt-5r2 edited this page Apr 11, 2022
·
4 revisions
dynamic_cast
patch is a special patch which allow to use default dynamic_cast
with engine and plugin classes. This patch ignores a namespace
part of the class name. That mean oCNpc
is equal to Gothic_I_Classic::oCNpc
. Patch is activated differently for MD
and MT
runtime libraries.
-
MT
uses a static runtime library anddynamic_cast
integrated in project. You should export the address of this operator:
extern void* __cdecl __RTDynamicCast( void*, long, void*, void*, int );
cexport void* RTDynamicCast_MT = (void*)__RTDynamicCast;
-
MD
uses a dynamic runtime library anddynamic_cast
imported from msvcr dll. You should call theUnion::DefineCRTVersion
function fromDllMain
:
#include <crtversion.h>
Union.DefineCRTVersion(
_VC_CRT_MAJOR_VERSION,
_VC_CRT_MINOR_VERSION,
_VC_CRT_BUILD_VERSION,
_VC_CRT_RBUILD_VERSION );
⠀
cexport void Game_Loop() {
oCNpc* focusNpc = dynamic_cast<oCNpc*>( player->GetFocusVob() );
if( focusNpc )
screen->PrintCXY( focusNpc->name[0] );
}
- Introduction
- Project hierarchy
- Default functions
- Build options
-
Gothic API
- Base objects
- Models and visuals
- Static and interactive objects
- Animations
- Interface
- Scripts
- Worlds
- Renderer
- Other
- User API
-
Union API
- Hook
- Hook Functions
- Array
- ArraySorted
- Map
- MapArray
- String
- Unicode string
- UTF-8 converter
- RowString
- Console
- Logger
- Message
- Thread
- Event
- Semaphore
- ThreadLocker
- Crc checker
- Options
- Timer
- Union
- VDFS functions
- VirtualFile
- Hooks
- dynamic_cast patch