- const lisp::Lisp* tilesets_reader = reader.get_lisp("tilesets");
- if (tilesets_reader) {
- lisp::ListIterator iter(tilesets_reader);
- while(iter.next()) {
- const std::string& token = iter.item();
- if(token != "tileset") {
- log_warning << "Skipping unrecognized token \"" << token << "\" in tilemap's tilesets list" << std::endl;
- continue;
- }
- const lisp::Lisp* tileset_reader = iter.lisp();
- std::string file;
- unsigned int start = 0;
- unsigned int end = std::numeric_limits<unsigned int>::max();
- int offset = 0;
- if (!tileset_reader->get("file", file)) {
- log_warning << "Skipping tileset import without file name" << std::endl;
- continue;
- }
- tileset_reader->get("start", start);
- tileset_reader->get("end", end);
- tileset_reader->get("offset", offset);
- tilemanager->load_tileset(file, start, end, offset);
- }
- } else {
- log_warning << "No tilesets list in tilemap, loading default tiles" << std::endl;
- if (loading_worldmap) {
- tilemanager->load_tileset("images/worldmap.strf", 0, std::numeric_limits<unsigned int>::max(), 0);
- } else {
- tilemanager->load_tileset("images/tiles.strf", 0, std::numeric_limits<unsigned int>::max(), 0);
- }
- }
-