User:Psycommando/Macros reference
Jump to navigation
Jump to search
Intro
Prototype for a complete list of macros links(in the wiki) and infos. All Macros are listed in different categories, and divided in two basic groups, depending if they contain declaration code or contain definition code.
Warning on macros
For those unfamiliar with macros, I must warn you that macros are EVIL. They are basically the equivalent of doing a search and replace at compile time, therefore never ever put an operation as a macro parameter!!! This page C++ Faq Lite describe most of the problem. Be sure to check evil# 1-2-3-4.
Data map
Declaration :
Definition :
Network
IMPLEMENT_NETWORKCLASS_ALIASED
- Declaration : IMPLEMENT_NETWORKCLASS_ALIASED(className, dataTable)
- Code : From ..\game\shared\predictable_entity.h
#define IMPLEMENT_NETWORKCLASS_ALIASED(className, dataTable) \ IMPLEMENT_CLIENTCLASS( C_##className, dataTable, C##className )
- Description :
Misc
MDLCACHE_CRITICAL_SECTION
- Call : MDLCACHE_CRITICAL_SECTION()
- Description : This one is still an enigma. It create a critical section to avoid concurrent accesses to what seems to be a bunch of loaded source .mdl files, but why is it used when simply modifying or calling an entity's methods?(Answers on talk page are welcome)
- Example : (From ..\src\game\server\gameinterface.cpp)
// Call all entities' OnRestore handlers for ( int i = g_RestoredEntities.Count()-1; i >=0; --i ) { CBaseEntity *pEntity = g_RestoredEntities[i].Get(); if ( pEntity && !pEntity->IsDormant() ) { MDLCACHE_CRITICAL_SECTION(); pEntity->OnRestore(); } }