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