dungeon_crawler
diff prototype/src/renderer_deferred.cc @ 63:7f52d6310317
fixed design issue with datafile_path
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 02 Oct 2012 04:52:59 +0300 |
parents | f71381c9e245 |
children | fc2b3d06d07c |
line diff
1.1 --- a/prototype/src/renderer_deferred.cc Tue Sep 25 06:59:11 2012 +0300 1.2 +++ b/prototype/src/renderer_deferred.cc Tue Oct 02 04:52:59 2012 +0300 1.3 @@ -255,22 +255,16 @@ 1.4 1.5 static unsigned int load_sdr(const char *vfname, const char *pfname) 1.6 { 1.7 - char vsfile[PATH_MAX], psfile[PATH_MAX]; 1.8 - const char *fname; 1.9 unsigned int prog; 1.10 1.11 - if((fname = datafile_path(vfname))) { 1.12 - strcpy(vsfile, fname); 1.13 - } else { 1.14 - vsfile[0] = 0; 1.15 - } 1.16 - if((fname = datafile_path(pfname))) { 1.17 - strcpy(psfile, fname); 1.18 - } else { 1.19 - psfile[0] = 0; 1.20 - } 1.21 - if(!(prog = create_program_load(vsfile, psfile))) { 1.22 - fprintf(stderr, "failed to load shader program (%s, %s)\n", vsfile, psfile); 1.23 + std::string vsfile = datafile_path(vfname); 1.24 + std::string psfile = datafile_path(pfname); 1.25 + 1.26 + const char *vs = vsfile.empty() ? 0 : vsfile.c_str(); 1.27 + const char *ps = psfile.empty() ? 0 : psfile.c_str(); 1.28 + 1.29 + if(!(prog = create_program_load(vs, ps))) { 1.30 + fprintf(stderr, "failed to load shader program (%s, %s)\n", vs, ps); 1.31 return 0; 1.32 } 1.33 return prog;