Browse Source

Name tilers, samples and pieces for easier debugging.

legacy
Sam Hocevar sam 14 years ago
parent
commit
d697fd40b1
3 changed files with 26 additions and 6 deletions
  1. +16
    -2
      src/dict.cpp
  2. +5
    -2
      src/sample.cpp
  3. +5
    -2
      src/tileset.cpp

+ 16
- 2
src/dict.cpp View File

@@ -77,8 +77,22 @@ int Dict::MakeSlot(char const *name)
Entity *e = data->entities[id];
if (!e)
empty = id;
else if (!strcasecmp(name, e->GetName()))
break;
else
{
char const *oldname = e->GetName();
if (*oldname == '<')
{
while (*oldname && *oldname != '>')
oldname++;
while (*oldname == '>')
oldname++;
while (*oldname == ' ')
oldname++;
}

if (!strcasecmp(name, oldname))
break;
}
}

/* If this is a new entry, create a new slot for it. */


+ 5
- 2
src/sample.cpp View File

@@ -29,7 +29,7 @@ class SampleData
friend class Sample;

private:
char *name;
char *name, *path;
Mix_Chunk *chunk;
};

@@ -40,7 +40,10 @@ private:
Sample::Sample(char const *path)
: data(new SampleData())
{
data->name = strdup(path);
data->name = (char *)malloc(9 + strlen(path) + 1);
data->path = data->name + 9;
sprintf(data->name, "<sample> %s", path);

data->chunk = Mix_LoadWAV(path);
if (!data->chunk)
{


+ 5
- 2
src/tileset.cpp View File

@@ -40,7 +40,7 @@ class TileSetData
friend class TileSet;

private:
char *name;
char *name, *path;
int *tiles;
int w, h, nw, nh, ntiles;
float dilate, tx, ty;
@@ -56,7 +56,10 @@ private:
TileSet::TileSet(char const *path, int w, int h, float dilate)
: data(new TileSetData())
{
data->name = strdup(path);
data->name = (char *)malloc(10 + strlen(path) + 1);
data->path = data->name + 10;
sprintf(data->name, "<tileset> %s", path);

data->tiles = NULL;
data->img = NULL;
data->texture = 0;


Loading…
Cancel
Save