Browse Source

core: prefix Entity members with m_ to avoid accidental shadowing.

legacy
Sam Hocevar sam 13 years ago
parent
commit
b2d73f6310
12 changed files with 78 additions and 78 deletions
  1. +1
    -1
      src/debug/quad.cpp
  2. +1
    -1
      src/debug/record.cpp
  3. +1
    -1
      src/debug/stats.cpp
  4. +12
    -12
      src/entity.cpp
  5. +8
    -8
      src/entity.h
  6. +1
    -1
      src/font.cpp
  7. +1
    -1
      src/platform/ps3/ps3input.cpp
  8. +1
    -1
      src/platform/sdl/sdlinput.cpp
  9. +1
    -1
      src/text.cpp
  10. +49
    -49
      src/ticker.cpp
  11. +1
    -1
      src/tileset.cpp
  12. +1
    -1
      src/world.cpp

+ 1
- 1
src/debug/quad.cpp View File

@@ -119,7 +119,7 @@ DebugQuad::DebugQuad()
data->initialised = 0;
data->time = RandF(10000.0f);

drawgroup = DRAWGROUP_HUD;
m_drawgroup = DRAWGROUP_HUD;
}

DebugQuad::~DebugQuad()


+ 1
- 1
src/debug/record.cpp View File

@@ -59,7 +59,7 @@ DebugRecord::DebugRecord(char const *path, float fps)
data->sequence = NULL;
#endif

drawgroup = DRAWGROUP_CAPTURE;
m_drawgroup = DRAWGROUP_CAPTURE;
}

void DebugRecord::TickGame(float deltams)


+ 1
- 1
src/debug/stats.cpp View File

@@ -43,7 +43,7 @@ DebugStats::DebugStats(char const *path)
{
data->fp = fopen(path, "w+");

gamegroup = GAMEGROUP_AFTER;
m_gamegroup = GAMEGROUP_AFTER;
}

void DebugStats::TickGame(float deltams)


+ 12
- 12
src/entity.cpp View File

@@ -24,23 +24,23 @@ namespace lol
*/

Entity::Entity() :
gamenext(0),
drawnext(0),
ref(0),
destroy(0)
m_gamenext(0),
m_drawnext(0),
m_ref(0),
m_destroy(0)
{
#if !LOL_RELEASE
state = STATE_IDLE;
m_tickstate = STATE_IDLE;
#endif
gamegroup = GAMEGROUP_DEFAULT;
drawgroup = DRAWGROUP_DEFAULT;
m_gamegroup = GAMEGROUP_DEFAULT;
m_drawgroup = DRAWGROUP_DEFAULT;
Ticker::Register(this);
}

Entity::~Entity()
{
#if !LOL_RELEASE
if (!destroy)
if (!m_destroy)
Log::Error("entity destructor called directly\n");
#endif
}
@@ -53,18 +53,18 @@ char const *Entity::GetName()
void Entity::TickGame(float deltams)
{
#if !LOL_RELEASE
if (state != STATE_PRETICK_GAME)
if (m_tickstate != STATE_PRETICK_GAME)
Log::Error("invalid entity game tick\n");
state = STATE_POSTTICK_GAME;
m_tickstate = STATE_POSTTICK_GAME;
#endif
}

void Entity::TickDraw(float deltams)
{
#if !LOL_RELEASE
if (state != STATE_PRETICK_DRAW)
if (m_tickstate != STATE_PRETICK_DRAW)
Log::Error("invalid entity draw tick\n");
state = STATE_POSTTICK_DRAW;
m_tickstate = STATE_POSTTICK_DRAW;
#endif
}



+ 8
- 8
src/entity.h View File

@@ -36,7 +36,7 @@ protected:
virtual ~Entity();

virtual char const *GetName();
inline int IsDestroying() { return destroy; }
inline int IsDestroying() { return m_destroy; }

virtual void TickGame(float deltams);
virtual void TickDraw(float deltams);
@@ -49,7 +49,7 @@ protected:
// Must be the last element
GAMEGROUP_END
}
gamegroup;
m_gamegroup;

enum
{
@@ -60,7 +60,7 @@ protected:
// Must be the last element
DRAWGROUP_END
}
drawgroup;
m_drawgroup;

static int const GAMEGROUP_BEGIN = 0;
static int const DRAWGROUP_BEGIN = GAMEGROUP_END;
@@ -75,7 +75,7 @@ protected:
STATE_PRETICK_DRAW,
STATE_POSTTICK_DRAW,
}
state;
m_tickstate;
#endif

// Emcee begin
@@ -85,15 +85,15 @@ private:
Entity *other_entity, uint32_t other_state);
virtual uint32_t OnStateChanged(uint32_t newstate)
{
return m_state = newstate;
return LOLm_state = newstate;
}

uint32_t m_state;
uint32_t LOLm_state;
// Emcee end

private:
Entity *gamenext, *drawnext, *autonext;
int ref, autorelease, destroy;
Entity *m_gamenext, *m_drawnext, *m_autonext;
int m_ref, m_autorelease, m_destroy;
};

} /* namespace lol */


+ 1
- 1
src/font.cpp View File

@@ -49,7 +49,7 @@ Font::Font(char const *path)
data->tileset = Tiler::Register(path, ivec2(0), ivec2(16), 1.0f);
data->size = data->tileset->GetSize(0);

drawgroup = DRAWGROUP_BEFORE;
m_drawgroup = DRAWGROUP_BEFORE;
}

Font::~Font()


+ 1
- 1
src/platform/ps3/ps3input.cpp View File

@@ -77,7 +77,7 @@ Ps3Input::Ps3Input()
data->mousepos = vec2(320.0f, 240.0f);
data->mousebuttons = ivec3(0, 0, 0);

gamegroup = GAMEGROUP_BEFORE;
m_gamegroup = GAMEGROUP_BEFORE;
#endif
}



+ 1
- 1
src/platform/sdl/sdlinput.cpp View File

@@ -44,7 +44,7 @@ SdlInput::SdlInput()
#if defined USE_SDL
SDL_Init(SDL_INIT_TIMER);

gamegroup = GAMEGROUP_BEFORE;
m_gamegroup = GAMEGROUP_BEFORE;
#endif
}



+ 1
- 1
src/text.cpp View File

@@ -49,7 +49,7 @@ Text::Text(char const *text, char const *font)
data->length = text ? strlen(text) : 0;
data->pos = vec3(0, 0, 0);

drawgroup = DRAWGROUP_HUD;
m_drawgroup = DRAWGROUP_HUD;
}

void Text::SetText(char const *text)


+ 49
- 49
src/ticker.cpp View File

@@ -47,7 +47,7 @@ public:
if (autolist)
{
int count = 0;
for (Entity *e = autolist; e; e = e->autonext, count++)
for (Entity *e = autolist; e; e = e->m_autonext, count++)
;
Log::Error("still %i autoreleased entities\n", count);
}
@@ -91,13 +91,13 @@ void Ticker::Register(Entity *entity)
/* If we are called from its constructor, the object's vtable is not
* ready yet, so we do not know which group this entity belongs to. Wait
* until the first tick. */
entity->gamenext = data->todolist;
entity->m_gamenext = data->todolist;
data->todolist = entity;
/* Objects are autoreleased by default. Put them in a circular list. */
entity->autorelease = 1;
entity->autonext = data->autolist;
entity->m_autorelease = 1;
entity->m_autonext = data->autolist;
data->autolist = entity;
entity->ref = 1;
entity->m_ref = 1;

data->nentities++;
}
@@ -110,27 +110,27 @@ void Ticker::Ref(Entity *entity)
Log::Error("referencing NULL entity\n");
return;
}
if (entity->destroy)
if (entity->m_destroy)
Log::Error("referencing entity scheduled for destruction\n");
#endif
if (entity->autorelease)
if (entity->m_autorelease)
{
/* Get the entity out of the autorelease list. This is usually
/* Get the entity out of the m_autorelease list. This is usually
* very fast since the first entry in autolist is the last
* registered entity. */
for (Entity *e = data->autolist, *prev = NULL; e;
prev = e, e = e->autonext)
prev = e, e = e->m_autonext)
{
if (e == entity)
{
(prev ? prev->autonext : data->autolist) = e->autonext;
(prev ? prev->m_autonext : data->autolist) = e->m_autonext;
break;
}
}
entity->autorelease = 0;
entity->m_autorelease = 0;
}
else
entity->ref++;
entity->m_ref++;
}

int Ticker::Unref(Entity *entity)
@@ -141,12 +141,12 @@ int Ticker::Unref(Entity *entity)
Log::Error("dereferencing NULL entity\n");
return 0;
}
if (entity->ref <= 0)
if (entity->m_ref <= 0)
Log::Error("dereferencing unreferenced entity\n");
if (entity->autorelease)
if (entity->m_autorelease)
Log::Error("dereferencing autoreleased entity\n");
#endif
return --entity->ref;
return --entity->m_ref;
}

void *TickerData::GameThreadMain(void *p)
@@ -171,8 +171,8 @@ void *TickerData::GameThreadMain(void *p)

for (Entity *e = data->list[i]; e; )
{
Log::Debug(" \\-- %s (ref %i, destroy %i)\n", e->GetName(), e->ref, e->destroy);
e = (i < Entity::GAMEGROUP_END) ? e->gamenext : e->drawnext;
Log::Debug(" \\-- %s (m_ref %i, destroy %i)\n", e->GetName(), e->m_ref, e->m_destroy);
e = (i < Entity::GAMEGROUP_END) ? e->m_gamenext : e->m_drawnext;
}
}
#endif
@@ -200,13 +200,13 @@ void *TickerData::GameThreadMain(void *p)
data->panic = 2 * (data->panic + 1);

for (int i = 0; i < Entity::ALLGROUP_END && n < data->panic; i++)
for (Entity *e = data->list[i]; e && n < data->panic; e = e->gamenext)
if (e->ref)
for (Entity *e = data->list[i]; e && n < data->panic; e = e->m_gamenext)
if (e->m_ref)
{
#if !LOL_RELEASE
Log::Error("poking %s\n", e->GetName());
#endif
e->ref--;
e->m_ref--;
n++;
}

@@ -225,32 +225,32 @@ void *TickerData::GameThreadMain(void *p)
for (int i = 0; i < Entity::ALLGROUP_END; i++)
for (Entity *e = data->list[i], *prev = NULL; e; )
{
if (e->destroy && i < Entity::GAMEGROUP_END)
if (e->m_destroy && i < Entity::GAMEGROUP_END)
{
/* If entity is to be destroyed, remove it from the
* game tick list. */
(prev ? prev->gamenext : data->list[i]) = e->gamenext;
(prev ? prev->m_gamenext : data->list[i]) = e->m_gamenext;

e = e->gamenext;
e = e->m_gamenext;
}
else if (e->destroy)
else if (e->m_destroy)
{
/* If entity is to be destroyed, remove it from the
* draw tick list and destroy it. */
(prev ? prev->drawnext : data->list[i]) = e->drawnext;
(prev ? prev->m_drawnext : data->list[i]) = e->m_drawnext;

Entity *tmp = e;
e = e->drawnext; /* Can only be in a draw group list */
e = e->m_drawnext; /* Can only be in a draw group list */
delete tmp;

data->nentities--;
}
else
{
if (e->ref <= 0 && i >= Entity::DRAWGROUP_BEGIN)
e->destroy = 1;
if (e->m_ref <= 0 && i >= Entity::DRAWGROUP_BEGIN)
e->m_destroy = 1;
prev = e;
e = (i < Entity::GAMEGROUP_END) ? e->gamenext : e->drawnext;
e = (i < Entity::GAMEGROUP_END) ? e->m_gamenext : e->m_drawnext;
}
}

@@ -258,29 +258,29 @@ void *TickerData::GameThreadMain(void *p)
while (data->todolist)
{
Entity *e = data->todolist;
data->todolist = e->gamenext;
data->todolist = e->m_gamenext;

e->gamenext = data->list[e->gamegroup];
data->list[e->gamegroup] = e;
e->drawnext = data->list[e->drawgroup];
data->list[e->drawgroup] = e;
e->m_gamenext = data->list[e->m_gamegroup];
data->list[e->m_gamegroup] = e;
e->m_drawnext = data->list[e->m_drawgroup];
data->list[e->m_drawgroup] = e;
}

/* Tick objects for the game loop */
for (int i = Entity::GAMEGROUP_BEGIN; i < Entity::GAMEGROUP_END; i++)
for (Entity *e = data->list[i]; e; e = e->gamenext)
if (!e->destroy)
for (Entity *e = data->list[i]; e; e = e->m_gamenext)
if (!e->m_destroy)
{
#if !LOL_RELEASE
if (e->state != Entity::STATE_IDLE)
if (e->m_tickstate != Entity::STATE_IDLE)
Log::Error("entity not idle for game tick\n");
e->state = Entity::STATE_PRETICK_GAME;
e->m_tickstate = Entity::STATE_PRETICK_GAME;
#endif
e->TickGame(data->deltams);
#if !LOL_RELEASE
if (e->state != Entity::STATE_POSTTICK_GAME)
if (e->m_tickstate != Entity::STATE_POSTTICK_GAME)
Log::Error("entity missed super game tick\n");
e->state = Entity::STATE_IDLE;
e->m_tickstate = Entity::STATE_IDLE;
#endif
}

@@ -351,19 +351,19 @@ void Ticker::TickDraw()
break;
}

for (Entity *e = data->list[i]; e; e = e->drawnext)
if (!e->destroy)
for (Entity *e = data->list[i]; e; e = e->m_drawnext)
if (!e->m_destroy)
{
#if !LOL_RELEASE
if (e->state != Entity::STATE_IDLE)
if (e->m_tickstate != Entity::STATE_IDLE)
Log::Error("entity not idle for draw tick\n");
e->state = Entity::STATE_PRETICK_DRAW;
e->m_tickstate = Entity::STATE_PRETICK_DRAW;
#endif
e->TickDraw(data->deltams);
#if !LOL_RELEASE
if (e->state != Entity::STATE_POSTTICK_DRAW)
if (e->m_tickstate != Entity::STATE_POSTTICK_DRAW)
Log::Error("entity missed super draw tick\n");
e->state = Entity::STATE_IDLE;
e->m_tickstate = Entity::STATE_IDLE;
#endif
}
}
@@ -411,11 +411,11 @@ int Ticker::GetFrameNum()

void Ticker::Shutdown()
{
/* We're bailing out. Release all autorelease objects. */
/* We're bailing out. Release all m_autorelease objects. */
while (data->autolist)
{
data->autolist->ref--;
data->autolist = data->autolist->autonext;
data->autolist->m_ref--;
data->autolist = data->autolist->m_autonext;
}

data->quit = 1;


+ 1
- 1
src/tileset.cpp View File

@@ -84,7 +84,7 @@ TileSet::TileSet(char const *path, ivec2 size, ivec2 count, float dilate)
data->dilate = dilate;
data->ntiles = data->count.i * data->count.j;

drawgroup = DRAWGROUP_BEFORE;
m_drawgroup = DRAWGROUP_BEFORE;
}

TileSet::~TileSet()


+ 1
- 1
src/world.cpp View File

@@ -43,7 +43,7 @@ World::World()
data->width = 0;
data->height = 0;

drawgroup = DRAWGROUP_BEFORE;
m_drawgroup = DRAWGROUP_BEFORE;
}

World::~World()


Loading…
Cancel
Save