* Use overloading in Lisp and Writer
authorMathnerd314 <man.is.allan@gmail.com>
Sun, 3 May 2009 22:09:12 +0000 (22:09 +0000)
committerMathnerd314 <man.is.allan@gmail.com>
Sun, 3 May 2009 22:09:12 +0000 (22:09 +0000)
* Sector::collision_attributes includes SHIFT_DELTA slop in nearby tiles (allows ice to function)

SVN-Revision: 5887

61 files changed:
src/addon/addon.cpp
src/addon/addon_manager.cpp
src/addon/addon_manager.hpp
src/badguy/angrystone.cpp
src/badguy/bouncing_snowball.cpp
src/badguy/dart.cpp
src/badguy/darttrap.cpp
src/badguy/dispenser.cpp
src/badguy/fish.cpp
src/badguy/flame.cpp
src/badguy/flyingsnowball.cpp
src/badguy/jumpy.cpp
src/badguy/kugelblitz.cpp
src/badguy/mole.cpp
src/badguy/mole_rock.cpp
src/badguy/mrrocket.cpp
src/badguy/plant.cpp
src/badguy/skullyhop.cpp
src/badguy/spidermite.cpp
src/badguy/stalactite.cpp
src/badguy/toad.cpp
src/badguy/totem.cpp
src/badguy/walking_badguy.cpp
src/badguy/yeti.cpp
src/badguy/yeti_stalactite.cpp
src/badguy/zeekling.cpp
src/control/joystickkeyboardcontroller.cpp
src/gameconfig.cpp
src/level.cpp
src/lisp/lisp.hpp
src/lisp/writer.cpp
src/lisp/writer.hpp
src/object/background.cpp
src/object/camera.cpp
src/object/decal.cpp
src/object/firefly.cpp
src/object/gradient.cpp
src/object/ispy.cpp
src/object/lantern.cpp
src/object/magicblock.cpp
src/object/particlesystem.cpp
src/object/particlesystem_interactive.cpp
src/object/path.cpp
src/object/rock.cpp
src/object/spotlight.cpp
src/object/tilemap.cpp
src/player_status.cpp
src/scripting/serialize.cpp
src/sector.cpp
src/sprite/sprite_data.cpp
src/statistics.cpp
src/tile_set.cpp
src/trigger/climbable.cpp
src/trigger/door.cpp
src/trigger/scripttrigger.cpp
src/trigger/secretarea_trigger.cpp
src/trigger/sequence_trigger.cpp
src/trigger/switch.cpp
src/video/font.cpp
src/world.cpp
src/worldmap/worldmap.cpp

index ff3ea21..7e7e98e 100644 (file)
@@ -101,13 +101,13 @@ void
 Addon::write(lisp::Writer& writer) const
 {
   writer.start_list("supertux-addoninfo");
-  if (kind != "") writer.write_string("kind", kind);  
-  if (title != "") writer.write_string("title", title);
-  if (author != "") writer.write_string("author", author);
-  if (license != "") writer.write_string("license", license);
-  if (http_url != "") writer.write_string("http-url", http_url);
-  if (suggested_filename != "") writer.write_string("file", suggested_filename);
-  if (stored_md5 != "") writer.write_string("md5", stored_md5);
+  if (kind != "") writer.write("kind", kind);  
+  if (title != "") writer.write("title", title);
+  if (author != "") writer.write("author", author);
+  if (license != "") writer.write("license", license);
+  if (http_url != "") writer.write("http-url", http_url);
+  if (suggested_filename != "") writer.write("file", suggested_filename);
+  if (stored_md5 != "") writer.write("md5", stored_md5);
   writer.end_list("supertux-addoninfo");
 }
 
index 1327f1c..3186a30 100644 (file)
@@ -432,14 +432,14 @@ AddonManager::load_addons()
 
 
 void
-AddonManager::read_config(const lisp::Lisp& lisp)
+AddonManager::read(const lisp::Lisp& lisp)
 {
-  lisp.get_vector("disabled-addons", ignored_addon_filenames); 
+  lisp.get("disabled-addons", ignored_addon_filenames); 
 }
 
 void
-AddonManager::write_config(lisp::Writer& writer)
+AddonManager::write(lisp::Writer& writer)
 {
-  writer.write_string_vector("disabled-addons", ignored_addon_filenames); 
+  writer.write("disabled-addons", ignored_addon_filenames); 
 }
 
index 0b4889a..4c6b594 100644 (file)
@@ -89,12 +89,12 @@ public:
   /**
    * Write AddonManager configuration to Lisp
    */
-  void write_config(lisp::Writer& writer);
+  void write(lisp::Writer& writer);
 
   /**
    * Read AddonManager configuration from Lisp
    */
-  void read_config(const lisp::Lisp& lisp);
+  void read(const lisp::Lisp& lisp);
 
 protected:
   std::vector<Addon*> addons;
index 34ea9c1..3e00acd 100644 (file)
@@ -42,8 +42,8 @@ AngryStone::write(lisp::Writer& writer)
 {
   writer.start_list("angrystone");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("angrystone");
 }
index 2d90433..0449530 100644 (file)
@@ -39,8 +39,8 @@ BouncingSnowball::write(lisp::Writer& writer)
 {
   writer.start_list("bouncingsnowball");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("bouncingsnowball");
 }
index bfed64a..f94e351 100644 (file)
@@ -74,8 +74,8 @@ void
 Dart::write(lisp::Writer& writer)
 {
   writer.start_list("dart");
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
   writer.end_list("dart");
 }
 
index b2e7f55..b2485fe 100644 (file)
@@ -44,11 +44,11 @@ void
 DartTrap::write(lisp::Writer& writer)
 {
   writer.start_list("darttrap");
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
-  writer.write_float("initial-delay", initial_delay);
-  writer.write_float("fire-delay", fire_delay);
-  writer.write_int("ammo", ammo);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
+  writer.write("initial-delay", initial_delay);
+  writer.write("fire-delay", fire_delay);
+  writer.write("ammo", ammo);
   writer.end_list("darttrap");
 }
 
index 6010b14..98e2935 100644 (file)
@@ -30,7 +30,7 @@ Dispenser::Dispenser(const lisp::Lisp& reader)
   set_colgroup_active(COLGROUP_MOVING_STATIC);
   sound_manager->preload("sounds/squish.wav");
   reader.get("cycle", cycle);
-  reader.get_vector("badguy", badguys);
+  reader.get("badguy", badguys);
   random = false; // default
   reader.get("random", random);
   type = "dropper"; //default
@@ -65,12 +65,12 @@ Dispenser::write(lisp::Writer& writer)
 {
   writer.start_list("dispenser");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
-  writer.write_float("cycle", cycle);
-  writer.write_bool("random", random);
-  writer.write_string("type", type);
-  writer.write_string_vector("badguy", badguys);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
+  writer.write("cycle", cycle);
+  writer.write("random", random);
+  writer.write("type", type);
+  writer.write("badguy", badguys);
 
   writer.end_list("dispenser");
 }
index e83fbd4..9e83b50 100644 (file)
@@ -44,8 +44,8 @@ Fish::write(lisp::Writer& writer)
 {
   writer.start_list("fish");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("fish");
 }
index 8f035a7..0de567d 100644 (file)
@@ -42,10 +42,10 @@ Flame::write(lisp::Writer& writer)
 {
   writer.start_list("flame");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
-  writer.write_float("radius", radius);
-  writer.write_float("speed", speed);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
+  writer.write("radius", radius);
+  writer.write("speed", speed);
 
   writer.end_list("flame");
 }
index 9b76261..1ce1ef6 100644 (file)
@@ -47,8 +47,8 @@ FlyingSnowBall::write(lisp::Writer& writer)
 {
   writer.start_list("flyingsnowball");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("flyingsnowball");
 }
index 20b3f51..a6cc81c 100644 (file)
@@ -37,8 +37,8 @@ Jumpy::write(lisp::Writer& writer)
 {
   writer.start_list("jumpy");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("jumpy");
 }
index 813492d..53211f3 100644 (file)
@@ -46,7 +46,7 @@ Kugelblitz::write(lisp::Writer& writer)
 {
   writer.start_list("kugelblitz");
 
-  writer.write_float("x", start_position.x);
+  writer.write("x", start_position.x);
 
   writer.end_list("kugelblitz");
 }
index 7f1bb7e..4f035e2 100644 (file)
@@ -54,8 +54,8 @@ void
 Mole::write(lisp::Writer& writer)
 {
   writer.start_list("mole");
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
   writer.end_list("mole");
 }
 
index bf91870..fb0135e 100644 (file)
@@ -65,8 +65,8 @@ void
 MoleRock::write(lisp::Writer& writer)
 {
   writer.start_list("mole_rock");
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
   writer.end_list("mole_rock");
 }
 
index 6186160..74c83ce 100644 (file)
@@ -39,8 +39,8 @@ MrRocket::write(lisp::Writer& writer)
 {
   writer.start_list("mrrocket");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("mrrocket");
 }
index cebc0c5..fa44401 100644 (file)
@@ -35,8 +35,8 @@ Plant::write(lisp::Writer& writer)
 {
   writer.start_list("plant");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("plant");
 }
index 6de656e..74d72eb 100644 (file)
@@ -46,8 +46,8 @@ void
 SkullyHop::write(lisp::Writer& writer)
 {
   writer.start_list("skullyhop");
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
   writer.end_list("skullyhop");
 }
 
index 28b4a80..2c5bbf1 100644 (file)
@@ -42,8 +42,8 @@ SpiderMite::write(lisp::Writer& writer)
 {
   writer.start_list("spidermite");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("spidermite");
 }
index dad7103..6a3d675 100644 (file)
@@ -37,8 +37,8 @@ void
 Stalactite::write(lisp::Writer& writer)
 {
   writer.start_list("stalactite");
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
   writer.end_list("stalactite");
 }
 
index 0f0582b..6b039dd 100644 (file)
@@ -45,8 +45,8 @@ void
 Toad::write(lisp::Writer& writer)
 {
   writer.start_list("toad");
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
   writer.end_list("toad");
 }
 
index 6cca78c..e24cd54 100644 (file)
@@ -67,8 +67,8 @@ Totem::write(lisp::Writer& writer)
 {
   writer.start_list("totem");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("totem");
 }
index 3ac8aa5..627e62c 100644 (file)
@@ -41,8 +41,8 @@ WalkingBadguy::WalkingBadguy(const lisp::Lisp& reader, const std::string& sprite
 void
 WalkingBadguy::write(lisp::Writer& writer)
 {
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 }
 
 void
index 2eca07e..2547f71 100644 (file)
@@ -246,8 +246,8 @@ Yeti::write(lisp::Writer& writer)
 {
   writer.start_list("yeti");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("yeti");
 }
index de27da3..e3edc25 100644 (file)
@@ -34,8 +34,8 @@ void
 YetiStalactite::write(lisp::Writer& writer)
 {
   writer.start_list("yeti_stalactite");
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
   writer.end_list("yeti_stalactite");
 }
 
index 83c6adf..3d6ec90 100644 (file)
@@ -46,8 +46,8 @@ Zeekling::write(lisp::Writer& writer)
 {
   writer.start_list("zeekling");
 
-  writer.write_float("x", start_position.x);
-  writer.write_float("y", start_position.y);
+  writer.write("x", start_position.x);
+  writer.write("y", start_position.y);
 
   writer.end_list("zeekling");
 }
index ee62b4a..3cc65d1 100644 (file)
@@ -291,38 +291,38 @@ void
 JoystickKeyboardController::write(lisp::Writer& writer)
 {
   writer.start_list("keymap");
-  writer.write_bool("jump-with-up", jump_with_up_kbd);
+  writer.write("jump-with-up", jump_with_up_kbd);
   for(KeyMap::iterator i = keymap.begin(); i != keymap.end(); ++i) {
     writer.start_list("map");
-    writer.write_int("key", (int) i->first);
-    writer.write_string("control", controlNames[i->second]);
+    writer.write("key", (int) i->first);
+    writer.write("control", controlNames[i->second]);
     writer.end_list("map");
   }
   writer.end_list("keymap");
 
   writer.start_list("joystick");
-  writer.write_int("dead-zone", dead_zone);
-  writer.write_bool("jump-with-up", jump_with_up_joy);
+  writer.write("dead-zone", dead_zone);
+  writer.write("jump-with-up", jump_with_up_joy);
 
   for(ButtonMap::iterator i = joy_button_map.begin(); i != joy_button_map.end();
       ++i) {
     writer.start_list("map");
-    writer.write_int("button", i->first);
-    writer.write_string("control", controlNames[i->second]);
+    writer.write("button", i->first);
+    writer.write("control", controlNames[i->second]);
     writer.end_list("map");
   }
 
   for(HatMap::iterator i = joy_hat_map.begin(); i != joy_hat_map.end(); ++i) {
     writer.start_list("map");
-    writer.write_int("hat", i->first);
-    writer.write_string("control", controlNames[i->second]);
+    writer.write("hat", i->first);
+    writer.write("control", controlNames[i->second]);
     writer.end_list("map");
   }
 
   for(AxisMap::iterator i = joy_axis_map.begin(); i != joy_axis_map.end(); ++i) {
     writer.start_list("map");
-    writer.write_int("axis", i->first);
-    writer.write_string("control", controlNames[i->second]);
+    writer.write("axis", i->first);
+    writer.write("control", controlNames[i->second]);
     writer.end_list("map");
   }
 
index b90551b..8180034 100644 (file)
@@ -111,7 +111,7 @@ Config::load()
 
   const lisp::Lisp* config_addons_lisp = config_lisp->get_lisp("addons");
   if(config_addons_lisp) {
-    AddonManager::get_instance().read_config(*config_addons_lisp);
+    AddonManager::get_instance().read(*config_addons_lisp);
   }
 }
 
@@ -122,29 +122,29 @@ Config::save()
 
   writer.start_list("supertux-config");
 
-  writer.write_bool("show_fps", show_fps);
-  writer.write_bool("console", console_enabled);
-  writer.write_string("locale", locale);
+  writer.write("show_fps", show_fps);
+  writer.write("console", console_enabled);
+  writer.write("locale", locale);
 
   writer.start_list("video");
-  writer.write_bool("fullscreen", use_fullscreen);
-  writer.write_string("video", get_video_string(video));
-  writer.write_bool("vsync", try_vsync);
+  writer.write("fullscreen", use_fullscreen);
+  writer.write("video", get_video_string(video));
+  writer.write("vsync", try_vsync);
 
-  writer.write_int("fullscreen_width",  fullscreen_width);
-  writer.write_int("fullscreen_height", fullscreen_height);
+  writer.write("fullscreen_width",  fullscreen_width);
+  writer.write("fullscreen_height", fullscreen_height);
 
-  writer.write_int("window_width",  window_width);
-  writer.write_int("window_height", window_height);
+  writer.write("window_width",  window_width);
+  writer.write("window_height", window_height);
 
-  writer.write_int("aspect_width",  aspect_width);
-  writer.write_int("aspect_height", aspect_height);
+  writer.write("aspect_width",  aspect_width);
+  writer.write("aspect_height", aspect_height);
 
   writer.end_list("video");
 
   writer.start_list("audio");
-  writer.write_bool("sound_enabled", sound_enabled);
-  writer.write_bool("music_enabled", music_enabled);
+  writer.write("sound_enabled", sound_enabled);
+  writer.write("music_enabled", music_enabled);
   writer.end_list("audio");
 
   if(main_controller) {
@@ -154,7 +154,7 @@ Config::save()
   }
 
   writer.start_list("addons");
-  AddonManager::get_instance().write_config(writer);
+  AddonManager::get_instance().write(writer);
   writer.end_list("addons");
 
   writer.end_list("supertux-config");
index 33c7c25..e806aa5 100644 (file)
@@ -164,12 +164,12 @@ Level::save(const std::string& filename)
   writer->start_list("supertux-level");
 
   int version = 2;
-  writer->write_int("version", version);
+  writer->write("version", version);
 
-  writer->write_string("name", name, true);
-  writer->write_string("author", author);
+  writer->write("name", name, true);
+  writer->write("author", author);
   if(on_menukey_script != "")
-    writer->write_string("on-menukey-script", on_menukey_script);
+    writer->write("on-menukey-script", on_menukey_script);
 
   for(Sectors::iterator i = sectors.begin(); i != sectors.end(); ++i) {
     Sector* sector = *i;
index 4d80094..099e13b 100644 (file)
@@ -148,7 +148,7 @@ public:
   }
 
   template<class T>
-  bool get_vector(const char* name, std::vector<T>& vec) const
+  bool get(const char* name, std::vector<T>& vec) const
   {
     vec.clear();
 
index 99ff42b..a531caa 100644 (file)
@@ -93,21 +93,21 @@ Writer::end_list(const std::string& listname)
 }
 
 void
-Writer::write_int(const std::string& name, int value)
+Writer::write(const std::string& name, int value)
 {
   indent();
   *out << '(' << name << ' ' << value << ")\n";
 }
 
 void
-Writer::write_float(const std::string& name, float value)
+Writer::write(const std::string& name, float value)
 {
   indent();
   *out << '(' << name << ' ' << value << ")\n";
 }
 
 void
-Writer::write_string(const std::string& name, const std::string& value,
+Writer::write(const std::string& name, const std::string& value,
     bool translatable)
 {
   indent();
@@ -124,14 +124,14 @@ Writer::write_string(const std::string& name, const std::string& value,
 }
 
 void
-Writer::write_bool(const std::string& name, bool value)
+Writer::write(const std::string& name, bool value)
 {
   indent();
   *out << '(' << name << ' ' << (value ? "#t" : "#f") << ")\n";
 }
 
 void
-Writer::write_int_vector(const std::string& name,
+Writer::write(const std::string& name,
     const std::vector<int>& value)
 {
   indent();
@@ -142,7 +142,7 @@ Writer::write_int_vector(const std::string& name,
 }
 
 void
-Writer::write_int_vector(const std::string& name,
+Writer::write(const std::string& name,
     const std::vector<unsigned int>& value)
 {
   indent();
@@ -153,7 +153,7 @@ Writer::write_int_vector(const std::string& name,
 }
 
 void
-Writer::write_float_vector(const std::string& name,
+Writer::write(const std::string& name,
                            const std::vector<float>& value)
 {
   indent();
@@ -164,7 +164,7 @@ Writer::write_float_vector(const std::string& name,
 }
 
 void
-Writer::write_string_vector(const std::string& name,
+Writer::write(const std::string& name,
                            const std::vector<std::string>& value)
 {
   indent();
index c2dad8d..a031ab7 100644 (file)
@@ -38,15 +38,17 @@ namespace lisp
 
     void start_list(const std::string& listname, bool string = false);
 
-    void write_int(const std::string& name, int value);
-    void write_float(const std::string& name, float value);
-    void write_string(const std::string& name, const std::string& value,
+    void write(const std::string& name, int value);
+    void write(const std::string& name, float value);
+    void write(const std::string& name, const std::string& value,
         bool translatable = false);
-    void write_bool(const std::string& name, bool value);
-    void write_int_vector(const std::string& name, const std::vector<int>& value);
-    void write_int_vector(const std::string& name, const std::vector<unsigned int>& value);
-    void write_float_vector(const std::string& name, const std::vector<float>& value);
-    void write_string_vector(const std::string& name, const std::vector<std::string>& value);
+    void write(const std::string& name, const char* value,
+        bool translatable = false) { write(name, static_cast<const std::string&>(value), translatable); }
+    void write(const std::string& name, bool value);
+    void write(const std::string& name, const std::vector<int>& value);
+    void write(const std::string& name, const std::vector<unsigned int>& value);
+    void write(const std::string& name, const std::vector<float>& value);
+    void write(const std::string& name, const std::vector<std::string>& value);
     // add more write-functions when needed...
 
     void end_list(const std::string& listname);
index f60f184..9d0cec6 100644 (file)
@@ -72,15 +72,15 @@ Background::write(lisp::Writer& writer)
   writer.start_list("background");
 
   if (image_top.get() != NULL)
-    writer.write_string("image-top", imagefile_top);
+    writer.write("image-top", imagefile_top);
 
-  writer.write_string("image", imagefile);
+  writer.write("image", imagefile);
   if (image_bottom.get() != NULL)
-    writer.write_string("image-bottom", imagefile_bottom);
+    writer.write("image-bottom", imagefile_bottom);
 
-  writer.write_float("speed", speed);
-  writer.write_float("speed-y", speed_y);
-  writer.write_int("layer", layer);
+  writer.write("speed", speed);
+  writer.write("speed-y", speed_y);
+  writer.write("layer", layer);
 
   writer.end_list("background");
 }
index 7cea284..21a4ac7 100644 (file)
@@ -192,12 +192,12 @@ Camera::write(lisp::Writer& writer)
   writer.start_list("camera");
 
   if(mode == NORMAL) {
-    writer.write_string("mode", "normal");
+    writer.write("mode", "normal");
   } else if(mode == AUTOSCROLL) {
-    writer.write_string("mode", "autoscroll");
+    writer.write("mode", "autoscroll");
     autoscroll_path->write(writer);
   } else if(mode == MANUAL) {
-    writer.write_string("mode", "manual");
+    writer.write("mode", "manual");
   }
 
   writer.end_list("camera");
index 05ccd1b..62fec61 100644 (file)
@@ -53,10 +53,10 @@ void
 Decal::write(lisp::Writer& writer)
 {
   writer.start_list("decal");
-  writer.write_float("x", pos.x);
-  writer.write_float("y", pos.y);
-  writer.write_string("image", imagefile);
-  writer.write_int("layer", layer);
+  writer.write("x", pos.x);
+  writer.write("y", pos.y);
+  writer.write("image", imagefile);
+  writer.write("layer", layer);
   writer.end_list("decal");
 }
 
index 8dd4fe4..ac49d19 100644 (file)
@@ -66,8 +66,8 @@ void
 Firefly::write(lisp::Writer& writer)
 {
   writer.start_list("firefly");
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
   writer.end_list("firefly");
 }
 
index d89996b..9c40fc0 100644 (file)
@@ -40,8 +40,8 @@ Gradient::Gradient(const lisp::Lisp& reader)
 {
   reader.get("layer", layer);
   std::vector<float> bkgd_top_color, bkgd_bottom_color;
-  if(!reader.get_vector("top_color", bkgd_top_color) ||
-     !reader.get_vector("bottom_color", bkgd_bottom_color))
+  if(!reader.get("top_color", bkgd_top_color) ||
+     !reader.get("bottom_color", bkgd_bottom_color))
     throw std::runtime_error("Must specify top_color and bottom_color in gradient");
 
   gradient_top = Color(bkgd_top_color);
@@ -64,10 +64,10 @@ Gradient::write(lisp::Writer& writer)
   bkgd_bottom_color.push_back(gradient_bottom.red);
   bkgd_bottom_color.push_back(gradient_bottom.green);
   bkgd_bottom_color.push_back(gradient_bottom.blue);
-  writer.write_float_vector("top_color", bkgd_top_color);
-  writer.write_float_vector("bottom_color", bkgd_bottom_color);
+  writer.write("top_color", bkgd_top_color);
+  writer.write("bottom_color", bkgd_bottom_color);
 
-  writer.write_int("layer", layer);
+  writer.write("layer", layer);
 
   writer.end_list("gradient");
 }
index 09a7367..3ff6649 100644 (file)
@@ -56,17 +56,17 @@ void
 Ispy::write(lisp::Writer& writer)
 {
   writer.start_list("ispy");
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
-  writer.write_string("script", script);
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
+  writer.write("script", script);
   switch (dir)
   {
     case DOWN:
-      writer.write_string("direction", "down"); break;
+      writer.write("direction", "down"); break;
     case LEFT:
-      writer.write_string("direction", "left"); break;
+      writer.write("direction", "left"); break;
     case RIGHT:
-      writer.write_string("direction", "right"); break;
+      writer.write("direction", "right"); break;
     default: break;
   }
   writer.end_list("ispy");
index 8812e4b..f2c1712 100644 (file)
@@ -31,7 +31,7 @@ Lantern::Lantern(const lisp::Lisp& reader)
 {
   //get color from lisp
   std::vector<float> vColor;
-  reader.get_vector("color", vColor);
+  reader.get("color", vColor);
   lightcolor = Color(vColor);
   lightsprite = sprite_manager->create("images/objects/lightmap_light/lightmap_light.sprite");
   lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
index 99135de..51c92e8 100644 (file)
@@ -48,7 +48,7 @@ MagicBlock::MagicBlock(const lisp::Lisp& lisp)
   set_group(COLGROUP_STATIC);
   //get color from lisp
   std::vector<float> vColor;
-  lisp.get_vector("color", vColor );
+  lisp.get("color", vColor );
   color = Color( vColor );
 
   //all alpha to make the sprite still visible
index fa435be..0a4a0dc 100644 (file)
@@ -118,7 +118,7 @@ void
 SnowParticleSystem::write(lisp::Writer& writer)
 {
   writer.start_list("particles-snow");
-  writer.write_int("z-pos", z_pos);
+  writer.write("z-pos", z_pos);
   writer.end_list("particles-snow");
 }
 
@@ -178,7 +178,7 @@ void
 GhostParticleSystem::write(lisp::Writer& writer)
 {
   writer.start_list("particles-ghosts");
-  writer.write_int("z-pos", z_pos);
+  writer.write("z-pos", z_pos);
   writer.end_list("particles-ghosts");
 }
 
@@ -231,7 +231,7 @@ void
 CloudParticleSystem::write(lisp::Writer& writer)
 {
   writer.start_list("particles-clouds");
-  writer.write_int("z-pos", z_pos);
+  writer.write("z-pos", z_pos);
   writer.end_list("particles-clouds");
 }
 
index de9038a..94955e9 100644 (file)
@@ -183,7 +183,7 @@ void
 RainParticleSystem::write(lisp::Writer& writer)
 {
   writer.start_list("particles-rain");
-  writer.write_int("z-pos", z_pos);
+  writer.write("z-pos", z_pos);
   writer.end_list("particles-rain");
 }
 
@@ -265,7 +265,7 @@ void
 CometParticleSystem::write(lisp::Writer& writer)
 {
   writer.start_list("particles-comets");
-  writer.write_int("z-pos", z_pos);
+  writer.write("z-pos", z_pos);
   writer.end_list("particles-comets");
 }
 
index 5d7e88a..1e72584 100644 (file)
@@ -99,13 +99,13 @@ Path::write(lisp::Writer& writer)
 
   switch(mode) {
     case ONE_SHOT:
-      writer.write_string("mode", "oneshot");
+      writer.write("mode", "oneshot");
       break;
     case PING_PONG:
-      writer.write_string("mode", "pingpong");
+      writer.write("mode", "pingpong");
       break;
     case CIRCULAR:
-      writer.write_string("mode", "circular");
+      writer.write("mode", "circular");
       break;
     default:
       log_warning << "Don't know how to write mode " << (int) mode << " ?!?" << std::endl;
@@ -116,9 +116,9 @@ Path::write(lisp::Writer& writer)
     const Node& node = nodes[i];
 
     writer.start_list("node");
-    writer.write_float("x", node.position.x);
-    writer.write_float("y", node.position.y);
-    writer.write_float("time", node.time);
+    writer.write("x", node.position.x);
+    writer.write("y", node.position.y);
+    writer.write("time", node.time);
 
     writer.end_list("node");
   }
index 7c56e1a..54b7c38 100644 (file)
@@ -61,8 +61,8 @@ Rock::write(lisp::Writer& writer)
 {
   writer.start_list("rock");
 
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
 
   writer.end_list("rock");
 }
index d86848c..5fbf188 100644 (file)
@@ -37,7 +37,7 @@ Spotlight::Spotlight(const lisp::Lisp& lisp)
   lisp.get("angle", angle);
 
   std::vector<float> vColor;
-  if( lisp.get_vector( "color", vColor ) ){
+  if( lisp.get( "color", vColor ) ){
     color = Color( vColor );
   }
 
index 88def18..ad5d28d 100644 (file)
@@ -95,7 +95,7 @@ TileMap::TileMap(const lisp::Lisp& reader)
   if(width < 0 || height < 0)
     throw std::runtime_error("Invalid/No width/height specified in tilemap.");
 
-  if(!reader.get_vector("tiles", tiles))
+  if(!reader.get("tiles", tiles))
     throw std::runtime_error("No tiles in tilemap.");
 
   if(int(tiles.size()) != width*height) {
@@ -128,14 +128,14 @@ TileMap::write(lisp::Writer& writer)
 {
   writer.start_list("tilemap");
 
-  writer.write_int("z-pos", z_pos);
+  writer.write("z-pos", z_pos);
 
-  writer.write_bool("solid", solid);
-  writer.write_float("speed", speed_x);
-  writer.write_float("speed-y", speed_y);
-  writer.write_int("width", width);
-  writer.write_int("height", height);
-  writer.write_int_vector("tiles", tiles);
+  writer.write("solid", solid);
+  writer.write("speed", speed_x);
+  writer.write("speed-y", speed_y);
+  writer.write("width", width);
+  writer.write("height", height);
+  writer.write("tiles", tiles);
 
   writer.end_list("tilemap");
 }
index f04ed7d..bb00f83 100644 (file)
@@ -81,25 +81,25 @@ PlayerStatus::write(lisp::Writer& writer)
 {
   switch(bonus) {
     case NO_BONUS:
-      writer.write_string("bonus", "none");
+      writer.write("bonus", "none");
       break;
     case GROWUP_BONUS:
-      writer.write_string("bonus", "growup");
+      writer.write("bonus", "growup");
       break;
     case FIRE_BONUS:
-      writer.write_string("bonus", "fireflower");
+      writer.write("bonus", "fireflower");
       break;
     case ICE_BONUS:
-      writer.write_string("bonus", "iceflower");
+      writer.write("bonus", "iceflower");
       break;
     default:
       log_warning << "Unknown bonus type." << std::endl;
-      writer.write_string("bonus", "none");
+      writer.write("bonus", "none");
   }
-  writer.write_int("fireflowers", max_fire_bullets);
-  writer.write_int("iceflowers", max_ice_bullets);
+  writer.write("fireflowers", max_fire_bullets);
+  writer.write("iceflowers", max_ice_bullets);
 
-  writer.write_int("coins", coins);
+  writer.write("coins", coins);
 }
 
 void
index 3455d2f..d9dda42 100644 (file)
@@ -95,25 +95,25 @@ void save_squirrel_table(HSQUIRRELVM vm, SQInteger table_idx, lisp::Writer& writ
       case OT_INTEGER: {
         SQInteger val;
         sq_getinteger(vm, -1, &val);
-        writer.write_int(key, static_cast<int> (val));
+        writer.write(key, static_cast<int> (val));
         break;
       }
       case OT_FLOAT: {
         SQFloat val;
         sq_getfloat(vm, -1, &val);
-        writer.write_float(key, static_cast<float> (val));
+        writer.write(key, static_cast<float> (val));
         break;
       }
       case OT_BOOL: {
         SQBool val;
         sq_getbool(vm, -1, &val);
-        writer.write_bool(key, val == SQTrue);
+        writer.write(key, val == SQTrue);
         break;
       }
       case OT_STRING: {
         const SQChar* str;
         sq_getstring(vm, -1, &str);
-        writer.write_string(key, reinterpret_cast<const char*> (str));
+        writer.write(key, reinterpret_cast<const char*> (str));
         break;
       }
       case OT_TABLE: {
index 2ae3931..28cb380 100644 (file)
@@ -199,7 +199,7 @@ Sector::parse(const lisp::Lisp& sector)
       iter.value()->get(init_script);
     } else if(token == "ambient-light") {
       std::vector<float> vColor;
-      sector.get_vector( "ambient-light", vColor );
+      sector.get( "ambient-light", vColor );
       if(vColor.size() < 3) {
         log_warning << "(ambient-light) requires a color as argument" << std::endl;
       } else {
@@ -316,8 +316,8 @@ Sector::parse_old_format(const lisp::Lisp& reader)
   reader.get("height", height);
 
   std::vector<unsigned int> tiles;
-  if(reader.get_vector("interactive-tm", tiles)
-      || reader.get_vector("tilemap", tiles)) {
+  if(reader.get("interactive-tm", tiles)
+      || reader.get("tilemap", tiles)) {
     TileMap* tilemap = new TileMap(level->get_tileset());
     tilemap->set(width, height, tiles, LAYER_TILES, true);
 
@@ -334,14 +334,14 @@ Sector::parse_old_format(const lisp::Lisp& reader)
     add_object(tilemap);
   }
 
-  if(reader.get_vector("background-tm", tiles)) {
+  if(reader.get("background-tm", tiles)) {
     TileMap* tilemap = new TileMap(level->get_tileset());
     tilemap->set(width, height, tiles, LAYER_BACKGROUNDTILES, false);
     if (height < 19) tilemap->resize(width, 19);
     add_object(tilemap);
   }
 
-  if(reader.get_vector("foreground-tm", tiles)) {
+  if(reader.get("foreground-tm", tiles)) {
     TileMap* tilemap = new TileMap(level->get_tileset());
     tilemap->set(width, height, tiles, LAYER_FOREGROUNDTILES, false);
 
@@ -465,18 +465,18 @@ Sector::fix_old_tiles()
 void
 Sector::write(lisp::Writer& writer)
 {
-  writer.write_string("name", name);
-  writer.write_float("gravity", gravity);
-  writer.write_string("music", music);
+  writer.write("name", name);
+  writer.write("gravity", gravity);
+  writer.write("music", music);
 
   // write spawnpoints
   for(SpawnPoints::iterator i = spawnpoints.begin(); i != spawnpoints.end();
       ++i) {
     SpawnPoint* spawn = *i;
     writer.start_list("spawn-points");
-    writer.write_string("name", spawn->name);
-    writer.write_float("x", spawn->pos.x);
-    writer.write_float("y", spawn->pos.y);
+    writer.write("name", spawn->name);
+    writer.write("x", spawn->pos.x);
+    writer.write("y", spawn->pos.y);
     writer.end_list("spawn-points");
   }
 
@@ -1026,10 +1026,10 @@ Sector::collision_tilemap(collision::Constraints* constraints,
 uint32_t
 Sector::collision_tile_attributes(const Rect& dest) const
 {
-  float x1 = dest.p1.x;
-  float y1 = dest.p1.y;
-  float x2 = dest.p2.x;
-  float y2 = dest.p2.y;
+  float x1 = dest.p1.x - SHIFT_DELTA;
+  float y1 = dest.p1.y - SHIFT_DELTA;
+  float x2 = dest.p2.x + SHIFT_DELTA;
+  float y2 = dest.p2.y + SHIFT_DELTA;
 
   uint32_t result = 0;
   for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
index e8128b2..7f5a578 100644 (file)
@@ -80,7 +80,7 @@ SpriteData::parse_action(const lisp::Lisp* lisp, const std::string& basedir)
           "If there are more than one action, they need names!");
   }
   std::vector<float> hitbox;
-  if (lisp->get_vector("hitbox", hitbox)) {
+  if (lisp->get("hitbox", hitbox)) {
     if (hitbox.size() != 4) throw std::runtime_error("hitbox must specify exactly 4 coordinates");
     action->x_offset = hitbox[0];
     action->y_offset = hitbox[1];
@@ -113,7 +113,7 @@ SpriteData::parse_action(const lisp::Lisp* lisp, const std::string& basedir)
     }
   } else { // Load images
     std::vector<std::string> images;
-    if(!lisp->get_vector("images", images)) {
+    if(!lisp->get("images", images)) {
       std::stringstream msg;
       msg << "Sprite '" << name << "' contains no images in action '"
           << action->name << "'.";
index 515fb11..285a357 100644 (file)
@@ -75,13 +75,13 @@ Statistics::parse(const lisp::Lisp& reader)
 void
 Statistics::write(lisp::Writer& writer)
 {
-  writer.write_int("coins-collected", coins);
-  writer.write_int("coins-collected-total", total_coins);
-  writer.write_int("badguys-killed", badguys);
-  writer.write_int("badguys-killed-total", total_badguys);
-  writer.write_float("time-needed", time);
-  writer.write_int("secrets-found", secrets);
-  writer.write_int("secrets-found-total", total_secrets);
+  writer.write("coins-collected", coins);
+  writer.write("coins-collected-total", total_coins);
+  writer.write("badguys-killed", badguys);
+  writer.write("badguys-killed-total", total_badguys);
+  writer.write("time-needed", time);
+  writer.write("secrets-found", secrets);
+  writer.write("secrets-found-total", total_secrets);
 }
 */
 
index 0974bf1..037d55f 100644 (file)
@@ -86,12 +86,12 @@ TileSet::TileSet(const std::string& filename)
       unsigned int width  = 0;
       unsigned int height = 0;
 
-      iter.lisp()->get_vector("ids",        ids);
-      bool has_attributes = iter.lisp()->get_vector("attributes", attributes);
-      bool has_datas = iter.lisp()->get_vector("datas", datas);
+      iter.lisp()->get("ids",        ids);
+      bool has_attributes = iter.lisp()->get("attributes", attributes);
+      bool has_datas = iter.lisp()->get("datas", datas);
 
-      if(!iter.lisp()->get_vector("image",      images))
-        iter.lisp()->get_vector( "images",      images);
+      if(!iter.lisp()->get("image",      images))
+        iter.lisp()->get( "images",      images);
 
       iter.lisp()->get("width",      width);
       iter.lisp()->get("height",     height);
index 7ec2af1..44dfea5 100644 (file)
@@ -68,10 +68,10 @@ Climbable::write(lisp::Writer& writer)
 {
   writer.start_list("climbable");
 
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
-  writer.write_float("width", bbox.get_width());
-  writer.write_float("height", bbox.get_height());
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
+  writer.write("width", bbox.get_width());
+  writer.write("height", bbox.get_height());
 
   writer.end_list("climbable");
 }
index 970f165..644906d 100644 (file)
@@ -69,13 +69,13 @@ Door::write(lisp::Writer& writer)
 {
   writer.start_list("door");
 
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
-  writer.write_float("width", bbox.get_width());
-  writer.write_float("height", bbox.get_height());
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
+  writer.write("width", bbox.get_width());
+  writer.write("height", bbox.get_height());
 
-  writer.write_string("sector", target_sector);
-  writer.write_string("spawnpoint", target_spawnpoint);
+  writer.write("sector", target_sector);
+  writer.write("spawnpoint", target_spawnpoint);
 
   writer.end_list("door");
 }
index 6af9b8c..161a693 100644 (file)
@@ -69,12 +69,12 @@ ScriptTrigger::write(lisp::Writer& writer)
 {
   writer.start_list("scripttrigger");
 
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
-  writer.write_float("width", bbox.get_width());
-  writer.write_float("height", bbox.get_height());
-  writer.write_string("script", script);
-  writer.write_bool("button", triggerevent == EVENT_ACTIVATE);
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
+  writer.write("width", bbox.get_width());
+  writer.write("height", bbox.get_height());
+  writer.write("script", script);
+  writer.write("button", triggerevent == EVENT_ACTIVATE);
 
   writer.end_list("scripttrigger");
 }
index 51fb364..abf342b 100644 (file)
@@ -62,11 +62,11 @@ SecretAreaTrigger::write(lisp::Writer& writer)
 {
   writer.start_list("secretarea");
 
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
-  writer.write_float("width", bbox.get_width());
-  writer.write_float("height", bbox.get_height());
-  writer.write_string("fade-tilemap", fade_tilemap);
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
+  writer.write("width", bbox.get_width());
+  writer.write("height", bbox.get_height());
+  writer.write("fade-tilemap", fade_tilemap);
 
   writer.end_list("secretarea");
 }
index 5a94419..5787019 100644 (file)
@@ -55,11 +55,11 @@ SequenceTrigger::write(lisp::Writer& writer)
 {
   writer.start_list("sequencetrigger");
 
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
-  writer.write_float("width", bbox.get_width());
-  writer.write_float("height", bbox.get_height());
-  writer.write_string("sequence", sequence_name);
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
+  writer.write("width", bbox.get_width());
+  writer.write("height", bbox.get_height());
+  writer.write("sequence", sequence_name);
 
   writer.end_list("sequencetrigger");
 }
index f260b4b..82b97e1 100644 (file)
@@ -53,10 +53,10 @@ void
 Switch::write(lisp::Writer& writer)
 {
   writer.start_list("switch");
-  writer.write_float("x", bbox.p1.x);
-  writer.write_float("y", bbox.p1.y);
-  writer.write_string("sprite", sprite_name);
-  writer.write_string("script", script);
+  writer.write("x", bbox.p1.x);
+  writer.write("y", bbox.p1.y);
+  writer.write("sprite", sprite_name);
+  writer.write("script", script);
   writer.end_list("switch");
 }
 
index f938279..e0a8e19 100644 (file)
@@ -179,7 +179,7 @@ Font::loadFontFile(const std::string &filename)
         msg << "Font:" << filename << ": missing shadows image";
         throw std::runtime_error(msg.str());
         }
-      if( ! glyphs_val->get_vector("chars", chars) || chars.size() == 0) {
+      if( ! glyphs_val->get("chars", chars) || chars.size() == 0) {
         std::ostringstream msg;
         msg << "Font:" << filename << ": missing chars definition";
         throw std::runtime_error(msg.str());
index 26ace8b..a5ec785 100644 (file)
@@ -101,7 +101,7 @@ World::load(const std::string& filename)
   info->get("title", title);
   info->get("description", description);
   info->get("levelset", is_levelset);
-  info->get_vector("levels", levels);
+  info->get("levels", levels);
   info->get("hide-from-contribs", hide_from_contribs);
 
   // Level info file doesn't define any levels, so read the
@@ -163,7 +163,7 @@ World::save_state()
   lisp::Writer writer(savegame_filename);
 
   writer.start_list("supertux-savegame");
-  writer.write_int("version", 1);
+  writer.write("version", 1);
 
   using namespace WorldMapNS;
   if(WorldMap::current() != NULL) {
@@ -171,7 +171,7 @@ World::save_state()
     title << WorldMap::current()->get_title();
     title << " (" << WorldMap::current()->solved_level_count()
           << "/" << WorldMap::current()->level_count() << ")";
-    writer.write_string("title", title.str());
+    writer.write("title", title.str());
   }
 
   writer.start_list("tux");
index 1f2e377..f01a0c1 100644 (file)
@@ -355,7 +355,7 @@ WorldMap::load(const std::string& filename)
         add_object(teleporter);
       } else if(iter.item() == "ambient-light") {
         std::vector<float> vColor;
-        sector->get_vector( "ambient-light", vColor );
+        sector->get( "ambient-light", vColor );
         if(vColor.size() < 3) {
           log_warning << "(ambient-light) requires a color as argument" << std::endl;
         } else {