- while(!lisp_nil_p(list)) {
- lisp_object_t* cur = lisp_car(list);
- if(lisp_string_p(cur)) {
- imagespecs.push_back(ImageSpec(lisp_string(cur), Rectangle(0, 0, 0, 0)));
- } 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) {
- float x = lisp_integer(lisp_list_nth(data, 1));
- float y = lisp_integer(lisp_list_nth(data, 2));
- float width = lisp_integer(lisp_list_nth(data, 3));
- float height = lisp_integer(lisp_list_nth(data, 4));
- imagespecs.push_back(ImageSpec(lisp_string(lisp_car(data)),
- Rectangle(x, y, x+width, y+height)));
- } else {
- std::cerr << "Tile: Type mismatch, should be '(region \"somestring\" x y w h)'" << std::endl;
- continue;
- }
+ const lisp::Lisp* list = &images_lisp;
+ while(list) {
+ const lisp::Lisp* cur = list->get_car();
+ if(cur->get_type() == lisp::Lisp::TYPE_STRING) {
+ std::string file;
+ cur->get(file);
+ imagespecs.push_back(ImageSpec(file, Rect(0, 0, 0, 0)));
+ } else if(cur->get_type() == lisp::Lisp::TYPE_CONS &&
+ cur->get_car()->get_type() == lisp::Lisp::TYPE_SYMBOL &&
+ cur->get_car()->get_symbol() == "region") {
+ const lisp::Lisp* ptr = cur->get_cdr();
+
+ std::string file;
+ float x = 0, y = 0, w = 0, h = 0;
+ ptr->get_car()->get(file); ptr = ptr->get_cdr();
+ ptr->get_car()->get(x); ptr = ptr->get_cdr();
+ ptr->get_car()->get(y); ptr = ptr->get_cdr();
+ ptr->get_car()->get(w); ptr = ptr->get_cdr();
+ ptr->get_car()->get(h);
+ imagespecs.push_back(ImageSpec(file, Rect(x, y, x+w, y+h)));