mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-20 13:15:16 -04:00
allow all MAP files to be read from DDL archive
This commit is contained in:
parent
96eaeb4851
commit
73a4187f79
18 changed files with 185 additions and 165 deletions
17
game/lang.c
17
game/lang.c
|
@ -3,6 +3,7 @@
|
|||
#include "globals.h"
|
||||
#include "lang.h"
|
||||
#include <libs/strlite.h>
|
||||
#include <libs/memman.h>
|
||||
|
||||
|
||||
static char *lang_folder = NULL;
|
||||
|
@ -47,3 +48,19 @@ const char *lang_replace_path_if_exists(const char *file) {
|
|||
if (check_file_exists(path)) return path;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
char *lang_load_string(const char *filename) {
|
||||
if (lang_folder == NULL) return NULL;
|
||||
const char *path = build_pathname(2, lang_folder, filename);
|
||||
FILE *f = fopen(path, "r");
|
||||
if (f == NULL) return NULL;
|
||||
fseek(f, 0, SEEK_END);
|
||||
long sz = ftell(f);
|
||||
char *trg = getmem(sz+1);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
fread(trg, 1 , sz, f);
|
||||
fclose(f);
|
||||
trg[sz] = 0;
|
||||
return trg;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue