mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r771) Do not give a file new {struct GRFFile} if it was already loaded once. Eliminates those double entries in the newgrf manager and also some possible memory leaks.
This commit is contained in:
parent
b2e973056a
commit
f012e15c95
8
newgrf.c
8
newgrf.c
@ -1989,6 +1989,14 @@ void InitNewGRFFile(const char *filename, int sprite_offset)
|
||||
{
|
||||
struct GRFFile *newfile;
|
||||
|
||||
newfile = GetFileByFilename(filename);
|
||||
if (newfile) {
|
||||
/* We already loaded it once. */
|
||||
newfile->sprite_offset = sprite_offset;
|
||||
_cur_grffile = newfile;
|
||||
return;
|
||||
}
|
||||
|
||||
newfile = calloc(1, sizeof(struct GRFFile));
|
||||
|
||||
if (newfile == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user