Changeset 419


Ignore:
Timestamp:
Feb 7, 2011, 2:40:30 PM (12 years ago)
Author:
sam
Message:

Name tilers, samples and pieces for easier debugging.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/piece.cpp

    r384 r419  
    4949    }
    5050    state;
     51
     52    char namebuf[40];
    5153};
    5254
     
    8789
    8890    data->pos = data->cell * data->size;
     91}
     92
     93char const *Piece::GetName()
     94{
     95    sprintf(data->namebuf, "<piece> %ix%i @ %i,%i",
     96            data->size.x, data->size.y, data->cell.x, data->cell.y);
     97    return data->namebuf;
    8998}
    9099
  • trunk/monsterz/piece.h

    r384 r419  
    3434    virtual ~Piece();
    3535
     36    virtual char const *GetName();
     37
    3638    void SetCell(int2 cell);
    3739    int2 GetCell() const;
  • trunk/src/dict.cpp

    r259 r419  
    7878        if (!e)
    7979            empty = id;
    80         else if (!strcasecmp(name, e->GetName()))
    81             break;
     80        else
     81        {
     82            char const *oldname = e->GetName();
     83            if (*oldname == '<')
     84            {
     85                while (*oldname && *oldname != '>')
     86                    oldname++;
     87                while (*oldname == '>')
     88                    oldname++;
     89                while (*oldname == ' ')
     90                    oldname++;
     91            }
     92
     93            if (!strcasecmp(name, oldname))
     94                break;
     95        }
    8296    }
    8397
  • trunk/src/sample.cpp

    r280 r419  
    3030
    3131private:
    32     char *name;
     32    char *name, *path;
    3333    Mix_Chunk *chunk;
    3434};
     
    4141  : data(new SampleData())
    4242{
    43     data->name = strdup(path);
     43    data->name = (char *)malloc(9 + strlen(path) + 1);
     44    data->path = data->name + 9;
     45    sprintf(data->name, "<sample> %s", path);
     46
    4447    data->chunk = Mix_LoadWAV(path);
    4548    if (!data->chunk)
  • trunk/src/tileset.cpp

    r335 r419  
    4141
    4242private:
    43     char *name;
     43    char *name, *path;
    4444    int *tiles;
    4545    int w, h, nw, nh, ntiles;
     
    5757  : data(new TileSetData())
    5858{
    59     data->name = strdup(path);
     59    data->name = (char *)malloc(10 + strlen(path) + 1);
     60    data->path = data->name + 10;
     61    sprintf(data->name, "<tileset> %s", path);
     62
    6063    data->tiles = NULL;
    6164    data->img = NULL;
Note: See TracChangeset for help on using the changeset viewer.