+ if (lisp_string_p(cur))
+ {
+ return new Surface(datadir + "/images/tilesets/" + lisp_string(cur),
+ true);
+ }
+ else if (lisp_cons_p(cur) && lisp_symbol_p(lisp_car(cur)))
+ {
+ lisp_object_t* sym = lisp_car(cur);
+ lisp_object_t* data = lisp_cdr(cur);
+
+ if (strcmp(lisp_symbol(sym), "region") == 0)
+ {
+ if (lisp_list_length(data) == 5) // (image-region filename x y w h)
+ {
+ return new Surface(datadir + "/images/tilesets/" + lisp_string(lisp_car(data)),
+ lisp_integer(lisp_list_nth(data, 1)),
+ lisp_integer(lisp_list_nth(data, 2)),
+ lisp_integer(lisp_list_nth(data, 3)),
+ lisp_integer(lisp_list_nth(data, 4)),
+ true);
+ }
+ else
+ {
+ std::cout << "Tile: Type mispatch, should be '(region \"somestring\" x y w h)'" << std::endl;
+ return 0;
+ }
+ }
+ else
+ {
+ std::cout << "Tile: Unhandled tag: " << lisp_symbol(sym) << std::endl;
+ return 0;
+ }
+ }
+
+ std::cout << "Tile: unhandled element" << std::endl;
+ return 0;