fixes
This commit is contained in:
parent
d97429c4ca
commit
ee5295da03
|
@ -1486,7 +1486,7 @@ int game_cmd(char *cmd)
|
|||
img_t img;
|
||||
|
||||
if (new_pict) {
|
||||
img = gfx_load_image(dirpath(pict));
|
||||
img = gfx_load_image(pict);
|
||||
if (el_img(el_spic))
|
||||
gfx_free_image(el_img(el_spic));
|
||||
el(el_spic)->p.p = NULL;
|
||||
|
|
|
@ -637,6 +637,7 @@ static img_t _gfx_load_image(char *filename)
|
|||
img = _gfx_load_special_image(filename);
|
||||
if (img)
|
||||
return img;
|
||||
filename = dirpath(filename);
|
||||
if (strstr(filename,".gif") || strstr(filename,".GIF"))
|
||||
nr = AG_LoadGIF(filename, NULL, 0, NULL);
|
||||
if (nr > 1) { /* anigif logic */
|
||||
|
@ -708,7 +709,7 @@ static img_t _gfx_load_combined_image(char *filename)
|
|||
} else if (*ep) {
|
||||
goto err;
|
||||
}
|
||||
img = _gfx_load_image(dirpath(strip(p)));
|
||||
img = _gfx_load_image(strip(p));
|
||||
if (img)
|
||||
img = gfx_display_alpha(img);
|
||||
if (img) {
|
||||
|
@ -2550,7 +2551,7 @@ img_t get_img(struct layout *layout, char *p)
|
|||
img = cache_get(layout->img_cache, p);
|
||||
if (!img) {
|
||||
unix_path(p);
|
||||
if (!(img = gfx_load_image(dirpath(p))))
|
||||
if (!(img = gfx_load_image(p)))
|
||||
goto out;
|
||||
theme_img_scale(&img); /* bad style, no gfx layer :( */
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ char *sdl_path(char *p)
|
|||
unix_path(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
#if 1
|
||||
int setdir(const char *path)
|
||||
{
|
||||
return chdir(path);
|
||||
|
@ -317,3 +317,30 @@ char *dirpath(const char *path)
|
|||
{
|
||||
return (char*)path;
|
||||
}
|
||||
#else
|
||||
static char curdir[PATH_MAX];
|
||||
|
||||
int setdir(const char *path)
|
||||
{
|
||||
strncpy(curdir, path, sizeof(curdir) - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *getdir(char *path, size_t size)
|
||||
{
|
||||
strncpy(path, curdir, size - 1);
|
||||
return path;
|
||||
}
|
||||
|
||||
char *dirpath(const char *path)
|
||||
{
|
||||
static char fp[PATH_MAX];
|
||||
if (path[0] == '/')
|
||||
return (char*)path;
|
||||
strcpy(fp, curdir);
|
||||
strcat(fp, "/");
|
||||
strcat(fp, path);
|
||||
unix_path(fp);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -287,6 +287,8 @@ char *getdir(char *path, size_t size)
|
|||
char *dirpath(const char *path)
|
||||
{
|
||||
static char fp[PATH_MAX];
|
||||
if (path[0] == '/')
|
||||
return (char*)path;
|
||||
strcpy(fp, curdir);
|
||||
strcat(fp, "/");
|
||||
strcat(fp, path);
|
||||
|
|
Reference in a new issue