[langband-cvs] CVS: langband/zterm main-x11.c,1.15,1.16
Status: Alpha
Brought to you by:
stig
From: Stig E S. <st...@us...> - 2002-09-26 00:02:57
|
Update of /cvsroot/langband/langband/zterm In directory usw-pr-cvs1:/tmp/cvs-serv29326 Modified Files: main-x11.c Log Message: does check on filetype when loading, png+bmp supported Index: main-x11.c =================================================================== RCS file: /cvsroot/langband/langband/zterm/main-x11.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** main-x11.c 20 Sep 2002 13:51:55 -0000 1.15 --- main-x11.c 26 Sep 2002 00:02:53 -0000 1.16 *************** *** 2502,2506 **** // fprintf(stderr, "Reading file %s %d %d\n", filename, tiled, image_index); /* Load the graphical tiles */ ! tiles_raw = ReadBMP(dpy, (char *)filename); /* No such file */ --- 2502,2522 ---- // fprintf(stderr, "Reading file %s %d %d\n", filename, tiled, image_index); /* Load the graphical tiles */ ! char *last = strrchr(filename, '.'); ! if (last == NULL) { ! fprintf(stderr, "Unable to decide filetype of %s\n", filename); ! return -1; ! } ! ! last++; ! if (!strcmp(last,"png")) { ! tiles_raw = readPng(dpy, (char *)filename); ! } ! else if (!strcmp(last,"bmp")) { ! tiles_raw = ReadBMP(dpy, (char *)filename); ! } ! else { ! fprintf(stderr, "Don't know how to handle filetype '%s'\n", last); ! return -1; ! } /* No such file */ |