Changeset 1110


Ignore:
Timestamp:
Dec 11, 2011, 12:58:09 PM (8 years ago)
Author:
sam
Message:

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

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/debug/quad.cpp

    r1083 r1110  
    120120    data->time = RandF(10000.0f);
    121121
    122     drawgroup = DRAWGROUP_HUD;
     122    m_drawgroup = DRAWGROUP_HUD;
    123123}
    124124
  • trunk/src/debug/record.cpp

    r1046 r1110  
    6060#endif
    6161
    62     drawgroup = DRAWGROUP_CAPTURE;
     62    m_drawgroup = DRAWGROUP_CAPTURE;
    6363}
    6464
  • trunk/src/debug/stats.cpp

    r783 r1110  
    4444    data->fp = fopen(path, "w+");
    4545
    46     gamegroup = GAMEGROUP_AFTER;
     46    m_gamegroup = GAMEGROUP_AFTER;
    4747}
    4848
  • trunk/src/entity.cpp

    r1106 r1110  
    2525
    2626Entity::Entity() :
    27     gamenext(0),
    28     drawnext(0),
    29     ref(0),
    30     destroy(0)
     27    m_gamenext(0),
     28    m_drawnext(0),
     29    m_ref(0),
     30    m_destroy(0)
    3131{
    3232#if !LOL_RELEASE
    33     state = STATE_IDLE;
     33    m_tickstate = STATE_IDLE;
    3434#endif
    35     gamegroup = GAMEGROUP_DEFAULT;
    36     drawgroup = DRAWGROUP_DEFAULT;
     35    m_gamegroup = GAMEGROUP_DEFAULT;
     36    m_drawgroup = DRAWGROUP_DEFAULT;
    3737    Ticker::Register(this);
    3838}
     
    4141{
    4242#if !LOL_RELEASE
    43     if (!destroy)
     43    if (!m_destroy)
    4444        Log::Error("entity destructor called directly\n");
    4545#endif
     
    5454{
    5555#if !LOL_RELEASE
    56     if (state != STATE_PRETICK_GAME)
     56    if (m_tickstate != STATE_PRETICK_GAME)
    5757        Log::Error("invalid entity game tick\n");
    58     state = STATE_POSTTICK_GAME;
     58    m_tickstate = STATE_POSTTICK_GAME;
    5959#endif
    6060}
     
    6363{
    6464#if !LOL_RELEASE
    65     if (state != STATE_PRETICK_DRAW)
     65    if (m_tickstate != STATE_PRETICK_DRAW)
    6666        Log::Error("invalid entity draw tick\n");
    67     state = STATE_POSTTICK_DRAW;
     67    m_tickstate = STATE_POSTTICK_DRAW;
    6868#endif
    6969}
  • trunk/src/entity.h

    r1106 r1110  
    3737
    3838    virtual char const *GetName();
    39     inline int IsDestroying() { return destroy; }
     39    inline int IsDestroying() { return m_destroy; }
    4040
    4141    virtual void TickGame(float deltams);
     
    5050        GAMEGROUP_END
    5151    }
    52     gamegroup;
     52    m_gamegroup;
    5353
    5454    enum
     
    6161        DRAWGROUP_END
    6262    }
    63     drawgroup;
     63    m_drawgroup;
    6464
    6565    static int const GAMEGROUP_BEGIN = 0;
     
    7676        STATE_POSTTICK_DRAW,
    7777    }
    78     state;
     78    m_tickstate;
    7979#endif
    8080
     
    8686    virtual uint32_t OnStateChanged(uint32_t newstate)
    8787    {
    88         return m_state = newstate;
     88        return LOLm_state = newstate;
    8989    }
    9090
    91     uint32_t m_state;
     91    uint32_t LOLm_state;
    9292    // Emcee end
    9393
    9494private:
    95     Entity *gamenext, *drawnext, *autonext;
    96     int ref, autorelease, destroy;
     95    Entity *m_gamenext, *m_drawnext, *m_autonext;
     96    int m_ref, m_autorelease, m_destroy;
    9797};
    9898
  • trunk/src/font.cpp

    r1046 r1110  
    5050    data->size = data->tileset->GetSize(0);
    5151
    52     drawgroup = DRAWGROUP_BEFORE;
     52    m_drawgroup = DRAWGROUP_BEFORE;
    5353}
    5454
  • trunk/src/platform/ps3/ps3input.cpp

    r866 r1110  
    7878    data->mousebuttons = ivec3(0, 0, 0);
    7979
    80     gamegroup = GAMEGROUP_BEFORE;
     80    m_gamegroup = GAMEGROUP_BEFORE;
    8181#endif
    8282}
  • trunk/src/platform/sdl/sdlinput.cpp

    r865 r1110  
    4545    SDL_Init(SDL_INIT_TIMER);
    4646
    47     gamegroup = GAMEGROUP_BEFORE;
     47    m_gamegroup = GAMEGROUP_BEFORE;
    4848#endif
    4949}
  • trunk/src/text.cpp

    r1046 r1110  
    5050    data->pos = vec3(0, 0, 0);
    5151
    52     drawgroup = DRAWGROUP_HUD;
     52    m_drawgroup = DRAWGROUP_HUD;
    5353}
    5454
  • trunk/src/ticker.cpp

    r1108 r1110  
    4848        {
    4949            int count = 0;
    50             for (Entity *e = autolist; e; e = e->autonext, count++)
     50            for (Entity *e = autolist; e; e = e->m_autonext, count++)
    5151                ;
    5252            Log::Error("still %i autoreleased entities\n", count);
     
    9292     * ready yet, so we do not know which group this entity belongs to. Wait
    9393     * until the first tick. */
    94     entity->gamenext = data->todolist;
     94    entity->m_gamenext = data->todolist;
    9595    data->todolist = entity;
    9696    /* Objects are autoreleased by default. Put them in a circular list. */
    97     entity->autorelease = 1;
    98     entity->autonext = data->autolist;
     97    entity->m_autorelease = 1;
     98    entity->m_autonext = data->autolist;
    9999    data->autolist = entity;
    100     entity->ref = 1;
     100    entity->m_ref = 1;
    101101
    102102    data->nentities++;
     
    111111        return;
    112112    }
    113     if (entity->destroy)
     113    if (entity->m_destroy)
    114114        Log::Error("referencing entity scheduled for destruction\n");
    115115#endif
    116     if (entity->autorelease)
    117     {
    118         /* Get the entity out of the autorelease list. This is usually
     116    if (entity->m_autorelease)
     117    {
     118        /* Get the entity out of the m_autorelease list. This is usually
    119119         * very fast since the first entry in autolist is the last
    120120         * registered entity. */
    121121        for (Entity *e = data->autolist, *prev = NULL; e;
    122              prev = e, e = e->autonext)
     122             prev = e, e = e->m_autonext)
    123123        {
    124124            if (e == entity)
    125125            {
    126                 (prev ? prev->autonext : data->autolist) = e->autonext;
     126                (prev ? prev->m_autonext : data->autolist) = e->m_autonext;
    127127                break;
    128128            }
    129129        }
    130         entity->autorelease = 0;
     130        entity->m_autorelease = 0;
    131131    }
    132132    else
    133         entity->ref++;
     133        entity->m_ref++;
    134134}
    135135
     
    142142        return 0;
    143143    }
    144     if (entity->ref <= 0)
     144    if (entity->m_ref <= 0)
    145145        Log::Error("dereferencing unreferenced entity\n");
    146     if (entity->autorelease)
     146    if (entity->m_autorelease)
    147147        Log::Error("dereferencing autoreleased entity\n");
    148148#endif
    149     return --entity->ref;
     149    return --entity->m_ref;
    150150}
    151151
     
    172172            for (Entity *e = data->list[i]; e; )
    173173            {
    174                 Log::Debug("  \\-- %s (ref %i, destroy %i)\n", e->GetName(), e->ref, e->destroy);
    175                 e = (i < Entity::GAMEGROUP_END) ? e->gamenext : e->drawnext;
     174                Log::Debug("  \\-- %s (m_ref %i, destroy %i)\n", e->GetName(), e->m_ref, e->m_destroy);
     175                e = (i < Entity::GAMEGROUP_END) ? e->m_gamenext : e->m_drawnext;
    176176            }
    177177        }
     
    201201
    202202            for (int i = 0; i < Entity::ALLGROUP_END && n < data->panic; i++)
    203             for (Entity *e = data->list[i]; e && n < data->panic; e = e->gamenext)
    204                 if (e->ref)
     203            for (Entity *e = data->list[i]; e && n < data->panic; e = e->m_gamenext)
     204                if (e->m_ref)
    205205                {
    206206#if !LOL_RELEASE
    207207                    Log::Error("poking %s\n", e->GetName());
    208208#endif
    209                     e->ref--;
     209                    e->m_ref--;
    210210                    n++;
    211211                }
     
    226226            for (Entity *e = data->list[i], *prev = NULL; e; )
    227227            {
    228                 if (e->destroy && i < Entity::GAMEGROUP_END)
     228                if (e->m_destroy && i < Entity::GAMEGROUP_END)
    229229                {
    230230                    /* If entity is to be destroyed, remove it from the
    231231                     * game tick list. */
    232                     (prev ? prev->gamenext : data->list[i]) = e->gamenext;
    233 
    234                     e = e->gamenext;
     232                    (prev ? prev->m_gamenext : data->list[i]) = e->m_gamenext;
     233
     234                    e = e->m_gamenext;
    235235                }
    236                 else if (e->destroy)
     236                else if (e->m_destroy)
    237237                {
    238238                    /* If entity is to be destroyed, remove it from the
    239239                     * draw tick list and destroy it. */
    240                     (prev ? prev->drawnext : data->list[i]) = e->drawnext;
     240                    (prev ? prev->m_drawnext : data->list[i]) = e->m_drawnext;
    241241
    242242                    Entity *tmp = e;
    243                     e = e->drawnext; /* Can only be in a draw group list */
     243                    e = e->m_drawnext; /* Can only be in a draw group list */
    244244                    delete tmp;
    245245
     
    248248                else
    249249                {
    250                     if (e->ref <= 0 && i >= Entity::DRAWGROUP_BEGIN)
    251                         e->destroy = 1;
     250                    if (e->m_ref <= 0 && i >= Entity::DRAWGROUP_BEGIN)
     251                        e->m_destroy = 1;
    252252                    prev = e;
    253                     e = (i < Entity::GAMEGROUP_END) ? e->gamenext : e->drawnext;
     253                    e = (i < Entity::GAMEGROUP_END) ? e->m_gamenext : e->m_drawnext;
    254254                }
    255255            }
     
    259259        {
    260260            Entity *e = data->todolist;
    261             data->todolist = e->gamenext;
    262 
    263             e->gamenext = data->list[e->gamegroup];
    264             data->list[e->gamegroup] = e;
    265             e->drawnext = data->list[e->drawgroup];
    266             data->list[e->drawgroup] = e;
     261            data->todolist = e->m_gamenext;
     262
     263            e->m_gamenext = data->list[e->m_gamegroup];
     264            data->list[e->m_gamegroup] = e;
     265            e->m_drawnext = data->list[e->m_drawgroup];
     266            data->list[e->m_drawgroup] = e;
    267267        }
    268268
    269269        /* Tick objects for the game loop */
    270270        for (int i = Entity::GAMEGROUP_BEGIN; i < Entity::GAMEGROUP_END; i++)
    271             for (Entity *e = data->list[i]; e; e = e->gamenext)
    272                 if (!e->destroy)
     271            for (Entity *e = data->list[i]; e; e = e->m_gamenext)
     272                if (!e->m_destroy)
    273273                {
    274274#if !LOL_RELEASE
    275                     if (e->state != Entity::STATE_IDLE)
     275                    if (e->m_tickstate != Entity::STATE_IDLE)
    276276                        Log::Error("entity not idle for game tick\n");
    277                     e->state = Entity::STATE_PRETICK_GAME;
     277                    e->m_tickstate = Entity::STATE_PRETICK_GAME;
    278278#endif
    279279                    e->TickGame(data->deltams);
    280280#if !LOL_RELEASE
    281                     if (e->state != Entity::STATE_POSTTICK_GAME)
     281                    if (e->m_tickstate != Entity::STATE_POSTTICK_GAME)
    282282                        Log::Error("entity missed super game tick\n");
    283                     e->state = Entity::STATE_IDLE;
     283                    e->m_tickstate = Entity::STATE_IDLE;
    284284#endif
    285285                }
     
    352352        }
    353353
    354         for (Entity *e = data->list[i]; e; e = e->drawnext)
    355             if (!e->destroy)
     354        for (Entity *e = data->list[i]; e; e = e->m_drawnext)
     355            if (!e->m_destroy)
    356356            {
    357357#if !LOL_RELEASE
    358                 if (e->state != Entity::STATE_IDLE)
     358                if (e->m_tickstate != Entity::STATE_IDLE)
    359359                    Log::Error("entity not idle for draw tick\n");
    360                 e->state = Entity::STATE_PRETICK_DRAW;
     360                e->m_tickstate = Entity::STATE_PRETICK_DRAW;
    361361#endif
    362362                e->TickDraw(data->deltams);
    363363#if !LOL_RELEASE
    364                 if (e->state != Entity::STATE_POSTTICK_DRAW)
     364                if (e->m_tickstate != Entity::STATE_POSTTICK_DRAW)
    365365                    Log::Error("entity missed super draw tick\n");
    366                 e->state = Entity::STATE_IDLE;
     366                e->m_tickstate = Entity::STATE_IDLE;
    367367#endif
    368368            }
     
    412412void Ticker::Shutdown()
    413413{
    414     /* We're bailing out. Release all autorelease objects. */
     414    /* We're bailing out. Release all m_autorelease objects. */
    415415    while (data->autolist)
    416416    {
    417         data->autolist->ref--;
    418         data->autolist = data->autolist->autonext;
     417        data->autolist->m_ref--;
     418        data->autolist = data->autolist->m_autonext;
    419419    }
    420420
  • trunk/src/tileset.cpp

    r1046 r1110  
    8585    data->ntiles = data->count.i * data->count.j;
    8686
    87     drawgroup = DRAWGROUP_BEFORE;
     87    m_drawgroup = DRAWGROUP_BEFORE;
    8888}
    8989
  • trunk/src/world.cpp

    r735 r1110  
    4444    data->height = 0;
    4545
    46     drawgroup = DRAWGROUP_BEFORE;
     46    m_drawgroup = DRAWGROUP_BEFORE;
    4747}
    4848
Note: See TracChangeset for help on using the changeset viewer.