stratgame

diff level/src/level.cc @ 0:86b53f76899f

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 21 May 2012 19:07:40 +0300
parents
children 55a43e27339a
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/level/src/level.cc	Mon May 21 19:07:40 2012 +0300
     1.3 @@ -0,0 +1,24 @@
     1.4 +#include <stdio.h>
     1.5 +#include <string.h>
     1.6 +#include "level.h"
     1.7 +
     1.8 +Level::Level()
     1.9 +{
    1.10 +}
    1.11 +
    1.12 +Level::~Level()
    1.13 +{
    1.14 +}
    1.15 +
    1.16 +bool Level::load(const char *fname)
    1.17 +{
    1.18 +	if(!xml.loadFile(fname)) {
    1.19 +		fprintf(stderr, "failed to load level: %s\n", fname);
    1.20 +		return false;
    1.21 +	}
    1.22 +
    1.23 +	if(strcmp(xml.RootElement().Name(), "level") != 0) {
    1.24 +		fprintf(stderr, "invalid level file: %s\n", fname);
    1.25 +		return false;
    1.26 +	}
    1.27 +}