Ignore:
Timestamp:
Feb 6, 2013, 12:17:54 AM (7 years ago)
Author:
sam
Message:

base: start being more aggressive in the error reportings; most error
messages in the Ticker class are now full asserts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ticker.cpp

    r2216 r2374  
    4545    ~TickerData()
    4646    {
    47 #if !LOL_RELEASE
    48         if (nentities)
    49             Log::Error("still %i entities in ticker\n", nentities);
     47        ASSERT(nentities == 0,
     48               "still %i entities in ticker\n", nentities);
     49#if !LOL_RELEASE
    5050        if (autolist)
    5151        {
     
    5353            for (Entity *e = autolist; e; e = e->m_autonext, count++)
    5454                ;
    55             Log::Error("still %i autoreleased entities\n", count);
    56         }
     55            ASSERT(count == 0, "still %i autoreleased entities\n", count);
     56        }
     57#endif
    5758        Log::Debug("%i frames required to quit\n",
    5859                frame - quitframe);
    59 #endif
     60
    6061        gametick.Push(0);
    6162        disktick.Push(0);
     
    114115void Ticker::Ref(Entity *entity)
    115116{
    116 #if !LOL_RELEASE
    117     if (!entity)
    118     {
    119         Log::Error("referencing NULL entity\n");
    120         return;
    121     }
    122     if (entity->m_destroy)
    123         Log::Error("referencing entity scheduled for destruction\n");
    124 #endif
     117    ASSERT(entity, "dereferencing NULL entity\n");
     118    ASSERT(!entity->m_destroy,
     119           "referencing entity scheduled for destruction %s\n",
     120           entity->GetName());
     121
    125122    if (entity->m_autorelease)
    126123    {
     
    145142int Ticker::Unref(Entity *entity)
    146143{
    147 #if !LOL_RELEASE
    148     if (!entity)
    149     {
    150         Log::Error("dereferencing NULL entity\n");
    151         return 0;
    152     }
    153     if (entity->m_ref <= 0)
    154         Log::Error("dereferencing unreferenced entity\n");
    155     if (entity->m_autorelease)
    156         Log::Error("dereferencing autoreleased entity\n");
    157 #endif
     144    ASSERT(entity, "dereferencing NULL entity\n");
     145    ASSERT(entity->m_ref > 0, "dereferencing unreferenced entity %s\n",
     146           entity->GetName())
     147    ASSERT(!entity->m_autorelease, "dereferencing autoreleased entity %s\n",
     148           entity->GetName())
     149
    158150    return --entity->m_ref;
    159151}
Note: See TracChangeset for help on using the changeset viewer.