3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
8 * See LICENSING which should be included
9 * along with this file for more details
13 /* Compiled through coreset.cpp */
16 //#define xlogf(...) do { fprintf(stderr, __VA_ARGS__); fflush(stderr); } while (0)
20 ////////////////////////////////////////////////////////////////////////////////
21 void entity::DumpDeadSet () {
23 fprintf(stderr, "=== dead set ===\n");
24 for (VoidSet::const_iterator i = mDeadSet.begin(); i != mDeadSet.end(); ++i) fprintf(stderr, "%p\n", *i);
29 ////////////////////////////////////////////////////////////////////////////////
30 entity::entity (const entity
&Entity
) : Emitation(Entity
.Emitation
), Flags(Entity
.Flags
) {
31 xlogf("entity::entity0: %p\n", this);
32 pool::RemoveFromHell(this);
39 mOnEvents
= Entity
.mOnEvents
;
43 entity::entity (int Flags
) : Emitation(0), Flags(Flags
|EXISTS
) {
44 xlogf("entity::entity1: %p\n", this);
45 pool::RemoveFromHell(this);
56 xlogf("entity::~entity: %p\n", this);
58 pool::RemoveFromHell(this);
62 /* Calling SendToHell() marks the entity dead,
63 * so that it will be removed by hell::Burn() at the end of the tick.
64 * In general, you should never delete an entity instead of calling this,
65 * because pool::Be() will crash if the entity currently Be()ing is deleted. */
66 void entity::SendToHell () {
72 pool::AddToHell(this);
78 /* These functions tell the poolsystem whether the Be() function of the entity
79 * ought to be called during each tick, thus allowing it to alter itself independently.
80 * If the entity is stabile, use Disable(), since it speeds up the game. */
81 void entity::Enable () {
82 if (!(Flags
&HAS_BE
)) {
89 void entity::Disable () {
97 int entity::GetUniqueMemoryMark (entity
*e
) {
107 void *entity::operator new (size_t size
) {
112 fprintf(stderr
, "FATAL: ALLOCATING ENTITY OF ZERO SIZE!\n");
115 p
= calloc(1, size
+sizeof(int));
126 void entity::operator delete (void *p
) {
130 xlogf("delete(%d): %p\n", mp
[-1], p
);