| @@ -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. */ | ||||
| @@ -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) | ||||
| { | { | ||||
| @@ -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; | ||||