dungeon_crawler

changeset 64:0b130c6e534d

whatever
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 02 Oct 2012 05:03:26 +0300
parents 7f52d6310317
children fc2b3d06d07c
files prototype/src/dataset.h
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/prototype/src/dataset.h	Tue Oct 02 04:52:59 2012 +0300
     1.2 +++ b/prototype/src/dataset.h	Tue Oct 02 05:03:26 2012 +0300
     1.3 @@ -47,18 +47,20 @@
     1.4  		return iter->second;
     1.5  	}
     1.6  
     1.7 -	const char *path, *slash;
     1.8 +	const char *fname, *slash;
     1.9  	if((slash = strrchr(name, '/'))) {
    1.10 -		path = slash + 1;
    1.11 +		fname = slash + 1;
    1.12  	} else {
    1.13 -		path = name;
    1.14 +		fname = name;
    1.15  	}
    1.16 -	if(!(path = datafile_path(path).c_str()) || !*path) {
    1.17 +
    1.18 +	std::string path = datafile_path(fname);
    1.19 +	if(path.empty()) {
    1.20  		fprintf(stderr, "can't find data file: %s\n", name);
    1.21  		return 0;
    1.22  	}
    1.23  
    1.24 -	T res = load(path);
    1.25 +	T res = load(path.c_str());
    1.26  	if(res) {
    1.27  		data[name] = res;
    1.28  	}