浏览代码

Name tilers, samples and pieces for easier debugging.

legacy
Sam Hocevar sam 15 年前
父节点
当前提交
d697fd40b1
共有 3 个文件被更改,包括 26 次插入6 次删除
  1. +16
    -2
      src/dict.cpp
  2. +5
    -2
      src/sample.cpp
  3. +5
    -2
      src/tileset.cpp

+ 16
- 2
src/dict.cpp 查看文件

@@ -77,8 +77,22 @@ int Dict::MakeSlot(char const *name)
Entity *e = data->entities[id]; Entity *e = data->entities[id];
if (!e) if (!e)
empty = id; 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. */ /* If this is a new entry, create a new slot for it. */


+ 5
- 2
src/sample.cpp 查看文件

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


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


@@ -40,7 +40,10 @@ private:
Sample::Sample(char const *path) Sample::Sample(char const *path)
: data(new SampleData()) : 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); data->chunk = Mix_LoadWAV(path);
if (!data->chunk) if (!data->chunk)
{ {


+ 5
- 2
src/tileset.cpp 查看文件

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


private: private:
char *name;
char *name, *path;
int *tiles; int *tiles;
int w, h, nw, nh, ntiles; int w, h, nw, nh, ntiles;
float dilate, tx, ty; float dilate, tx, ty;
@@ -56,7 +56,10 @@ private:
TileSet::TileSet(char const *path, int w, int h, float dilate) TileSet::TileSet(char const *path, int w, int h, float dilate)
: data(new TileSetData()) : 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->tiles = NULL;
data->img = NULL; data->img = NULL;
data->texture = 0; data->texture = 0;


正在加载...
取消
保存