mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-29 14:17:57 +03:00
Reworked source tree so it compiles
This commit is contained in:
parent
19e33444e7
commit
8ef16a91f2
164 changed files with 3183 additions and 20134 deletions
87
code/game/consoleevent.cpp
Normal file
87
code/game/consoleevent.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
#include "consoleevent.h"
|
||||
#include "g_local.h"
|
||||
|
||||
//===============================
|
||||
// ConsoleEvent
|
||||
//===============================
|
||||
|
||||
MEM_BlockAlloc< ConsoleEvent, MEM_BLOCKSIZE > ConsoleEvent_allocator;
|
||||
|
||||
CLASS_DECLARATION(Event, ConsoleEvent, NULL)
|
||||
{
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
=======================
|
||||
new ConsoleEvent
|
||||
=======================
|
||||
*/
|
||||
void* ConsoleEvent::operator new(size_t size)
|
||||
{
|
||||
return ConsoleEvent_allocator.Alloc();
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
delete ptr
|
||||
=======================
|
||||
*/
|
||||
void ConsoleEvent::operator delete(void* ptr)
|
||||
{
|
||||
ConsoleEvent_allocator.Free(ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
ConsoleEvent
|
||||
=======================
|
||||
*/
|
||||
ConsoleEvent::ConsoleEvent(void)
|
||||
{
|
||||
m_consoleedict = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
SetConsoleEdict
|
||||
=======================
|
||||
*/
|
||||
void ConsoleEvent::SetConsoleEdict(gentity_t* edict)
|
||||
{
|
||||
m_consoleedict = edict;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
GetConsoleEdict
|
||||
=======================
|
||||
*/
|
||||
gentity_t* ConsoleEvent::GetConsoleEdict(void)
|
||||
{
|
||||
if (m_consoleedict)
|
||||
return m_consoleedict;
|
||||
|
||||
return g_entities;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
ErrorInternal
|
||||
=======================
|
||||
*/
|
||||
void ConsoleEvent::ErrorInternal(Listener* l, str text)
|
||||
{
|
||||
gentity_t* edict = GetConsoleEdict();
|
||||
str eventname = getName();
|
||||
|
||||
gi.DPrintf("^~^~^ Game ( Event '%s', Client '%s' ) : %s\n",
|
||||
eventname.c_str(),
|
||||
edict->client ? edict->client->pers.netname : "",
|
||||
text.c_str());
|
||||
|
||||
gi.SendServerCommand(GetConsoleEdict() - g_entities,
|
||||
"print \"Console: '%s' : %s\n\"",
|
||||
eventname.c_str(),
|
||||
text.c_str());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue