summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-23 21:12:09 +0000
committerrubidium <rubidium@openttd.org>2007-06-23 21:12:09 +0000
commit6402d001909cc0f47fa3d9654b331c0ad96267f5 (patch)
treea1cc1caa824002d18729cbbf175cfdf094f14a10 /src/newgrf_config.cpp
parentbe35df3f0363ffffe1cfed8d81084c40212e9571 (diff)
downloadopenttd-6402d001909cc0f47fa3d9654b331c0ad96267f5.tar.xz
(svn r10298) -Fix [FS#903]: show the subdirectory below the default data directory in this filename in the newgrf list. The directory was removed in r9560 because then it used to full path instead of the path relative to the data directory, but since the inclusion of "search paths" that is not necessary anymore.
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 6ac494208..49a90d0da 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -40,7 +40,7 @@ static bool CalcGRFMD5Sum(GRFConfig *config)
size_t len;
/* open the file */
- f = FioFOpenFile(config->full_path);
+ f = FioFOpenFile(config->filename);
if (f == NULL) return false;
/* calculate md5sum */
@@ -59,16 +59,11 @@ static bool CalcGRFMD5Sum(GRFConfig *config)
/* Find the GRFID and calculate the md5sum */
bool FillGRFDetails(GRFConfig *config, bool is_static)
{
- if (!FioCheckFileExists(config->full_path)) {
+ if (!FioCheckFileExists(config->filename)) {
config->status = GCS_NOT_FOUND;
return false;
}
- if (config->filename == NULL) {
- const char *t = strrchr(config->full_path, PATHSEPCHAR);
- config->filename = strdup(t != NULL ? t + 1 : config->full_path);
- }
-
/* Find and load the Action 8 information */
/* 62 is the last file slot before sample.cat.
* Should perhaps be some "don't care" value */
@@ -94,7 +89,6 @@ void ClearGRFConfig(GRFConfig **config)
/* GCF_COPY as in NOT strdupped/alloced the filename, name and info */
if (!HASBIT((*config)->flags, GCF_COPY)) {
free((*config)->filename);
- free((*config)->full_path);
free((*config)->name);
free((*config)->info);
@@ -134,7 +128,6 @@ GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_o
GRFConfig *c = CallocT<GRFConfig>(1);
*c = *src;
if (src->filename != NULL) c->filename = strdup(src->filename);
- if (src->full_path != NULL) c->full_path = strdup(src->full_path);
if (src->name != NULL) c->name = strdup(src->name);
if (src->info != NULL) c->info = strdup(src->info);
if (src->error != NULL) {
@@ -265,9 +258,7 @@ compatible_grf:
* already a local one, so there is no need to replace it. */
if (!HASBIT(c->flags, GCF_COPY)) {
free(c->filename);
- free(c->full_path);
c->filename = strdup(f->filename);
- c->full_path = strdup(f->full_path);
memcpy(c->md5sum, f->md5sum, sizeof(c->md5sum));
if (c->name == NULL && f->name != NULL) c->name = strdup(f->name);
if (c->info == NULL && f->info != NULL) c->info = strdup(f->info);
@@ -314,7 +305,7 @@ static uint ScanPath(const char *path, int basepath_length)
if (strcasecmp(ext, ".grf") != 0) continue;
GRFConfig *c = CallocT<GRFConfig>(1);
- c->full_path = strdup(filename + basepath_length);
+ c->filename = strdup(filename + basepath_length);
bool added = true;
if (FillGRFDetails(c, false)) {
@@ -341,7 +332,6 @@ static uint ScanPath(const char *path, int basepath_length)
/* File couldn't be opened, or is either not a NewGRF or is a
* 'system' NewGRF or it's already known, so forget about it. */
free(c->filename);
- free(c->full_path);
free(c->name);
free(c->info);
free(c);