From 65a0b6f7ec1123cff959e13e1a4919dc70fe4e85 Mon Sep 17 00:00:00 2001 From: Mathnerd314 Date: Sun, 3 May 2009 22:09:12 +0000 Subject: [PATCH] * Use overloading in Lisp and Writer * Sector::collision_attributes includes SHIFT_DELTA slop in nearby tiles (allows ice to function) SVN-Revision: 5887 --- src/addon/addon.cpp | 14 ++++++------- src/addon/addon_manager.cpp | 8 ++++---- src/addon/addon_manager.hpp | 4 ++-- src/badguy/angrystone.cpp | 4 ++-- src/badguy/bouncing_snowball.cpp | 4 ++-- src/badguy/dart.cpp | 4 ++-- src/badguy/darttrap.cpp | 10 +++++----- src/badguy/dispenser.cpp | 14 ++++++------- src/badguy/fish.cpp | 4 ++-- src/badguy/flame.cpp | 8 ++++---- src/badguy/flyingsnowball.cpp | 4 ++-- src/badguy/jumpy.cpp | 4 ++-- src/badguy/kugelblitz.cpp | 2 +- src/badguy/mole.cpp | 4 ++-- src/badguy/mole_rock.cpp | 4 ++-- src/badguy/mrrocket.cpp | 4 ++-- src/badguy/plant.cpp | 4 ++-- src/badguy/skullyhop.cpp | 4 ++-- src/badguy/spidermite.cpp | 4 ++-- src/badguy/stalactite.cpp | 4 ++-- src/badguy/toad.cpp | 4 ++-- src/badguy/totem.cpp | 4 ++-- src/badguy/walking_badguy.cpp | 4 ++-- src/badguy/yeti.cpp | 4 ++-- src/badguy/yeti_stalactite.cpp | 4 ++-- src/badguy/zeekling.cpp | 4 ++-- src/control/joystickkeyboardcontroller.cpp | 22 ++++++++++---------- src/gameconfig.cpp | 32 +++++++++++++++--------------- src/level.cpp | 8 ++++---- src/lisp/lisp.hpp | 2 +- src/lisp/writer.cpp | 16 +++++++-------- src/lisp/writer.hpp | 18 +++++++++-------- src/object/background.cpp | 12 +++++------ src/object/camera.cpp | 6 +++--- src/object/decal.cpp | 8 ++++---- src/object/firefly.cpp | 4 ++-- src/object/gradient.cpp | 10 +++++----- src/object/ispy.cpp | 12 +++++------ src/object/lantern.cpp | 2 +- src/object/magicblock.cpp | 2 +- src/object/particlesystem.cpp | 6 +++--- src/object/particlesystem_interactive.cpp | 4 ++-- src/object/path.cpp | 12 +++++------ src/object/rock.cpp | 4 ++-- src/object/spotlight.cpp | 2 +- src/object/tilemap.cpp | 16 +++++++-------- src/player_status.cpp | 16 +++++++-------- src/scripting/serialize.cpp | 8 ++++---- src/sector.cpp | 30 ++++++++++++++-------------- src/sprite/sprite_data.cpp | 4 ++-- src/statistics.cpp | 14 ++++++------- src/tile_set.cpp | 10 +++++----- src/trigger/climbable.cpp | 8 ++++---- src/trigger/door.cpp | 12 +++++------ src/trigger/scripttrigger.cpp | 12 +++++------ src/trigger/secretarea_trigger.cpp | 10 +++++----- src/trigger/sequence_trigger.cpp | 10 +++++----- src/trigger/switch.cpp | 8 ++++---- src/video/font.cpp | 2 +- src/world.cpp | 6 +++--- src/worldmap/worldmap.cpp | 2 +- 61 files changed, 244 insertions(+), 242 deletions(-) diff --git a/src/addon/addon.cpp b/src/addon/addon.cpp index ff3ea215c..7e7e98ee0 100644 --- a/src/addon/addon.cpp +++ b/src/addon/addon.cpp @@ -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"); } diff --git a/src/addon/addon_manager.cpp b/src/addon/addon_manager.cpp index 1327f1c65..3186a30b1 100644 --- a/src/addon/addon_manager.cpp +++ b/src/addon/addon_manager.cpp @@ -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); } diff --git a/src/addon/addon_manager.hpp b/src/addon/addon_manager.hpp index 0b4889a62..4c6b59459 100644 --- a/src/addon/addon_manager.hpp +++ b/src/addon/addon_manager.hpp @@ -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 addons; diff --git a/src/badguy/angrystone.cpp b/src/badguy/angrystone.cpp index 34ea9c14f..3e00acd5b 100644 --- a/src/badguy/angrystone.cpp +++ b/src/badguy/angrystone.cpp @@ -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"); } diff --git a/src/badguy/bouncing_snowball.cpp b/src/badguy/bouncing_snowball.cpp index 2d9043353..044953081 100644 --- a/src/badguy/bouncing_snowball.cpp +++ b/src/badguy/bouncing_snowball.cpp @@ -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"); } diff --git a/src/badguy/dart.cpp b/src/badguy/dart.cpp index bfed64a6d..f94e35179 100644 --- a/src/badguy/dart.cpp +++ b/src/badguy/dart.cpp @@ -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"); } diff --git a/src/badguy/darttrap.cpp b/src/badguy/darttrap.cpp index b2e7f55e4..b2485fe46 100644 --- a/src/badguy/darttrap.cpp +++ b/src/badguy/darttrap.cpp @@ -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"); } diff --git a/src/badguy/dispenser.cpp b/src/badguy/dispenser.cpp index 6010b14d0..98e293554 100644 --- a/src/badguy/dispenser.cpp +++ b/src/badguy/dispenser.cpp @@ -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"); } diff --git a/src/badguy/fish.cpp b/src/badguy/fish.cpp index e83fbd4f2..9e83b5040 100644 --- a/src/badguy/fish.cpp +++ b/src/badguy/fish.cpp @@ -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"); } diff --git a/src/badguy/flame.cpp b/src/badguy/flame.cpp index 8f035a7f4..0de567db2 100644 --- a/src/badguy/flame.cpp +++ b/src/badguy/flame.cpp @@ -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"); } diff --git a/src/badguy/flyingsnowball.cpp b/src/badguy/flyingsnowball.cpp index 9b762611f..1ce1ef604 100644 --- a/src/badguy/flyingsnowball.cpp +++ b/src/badguy/flyingsnowball.cpp @@ -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"); } diff --git a/src/badguy/jumpy.cpp b/src/badguy/jumpy.cpp index 20b3f5136..a6cc81c57 100644 --- a/src/badguy/jumpy.cpp +++ b/src/badguy/jumpy.cpp @@ -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"); } diff --git a/src/badguy/kugelblitz.cpp b/src/badguy/kugelblitz.cpp index 813492d15..53211f350 100644 --- a/src/badguy/kugelblitz.cpp +++ b/src/badguy/kugelblitz.cpp @@ -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"); } diff --git a/src/badguy/mole.cpp b/src/badguy/mole.cpp index 7f1bb7eb2..4f035e2e8 100644 --- a/src/badguy/mole.cpp +++ b/src/badguy/mole.cpp @@ -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"); } diff --git a/src/badguy/mole_rock.cpp b/src/badguy/mole_rock.cpp index bf918706a..fb0135eef 100644 --- a/src/badguy/mole_rock.cpp +++ b/src/badguy/mole_rock.cpp @@ -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"); } diff --git a/src/badguy/mrrocket.cpp b/src/badguy/mrrocket.cpp index 618616063..74c83ce42 100644 --- a/src/badguy/mrrocket.cpp +++ b/src/badguy/mrrocket.cpp @@ -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"); } diff --git a/src/badguy/plant.cpp b/src/badguy/plant.cpp index cebc0c527..fa444018d 100644 --- a/src/badguy/plant.cpp +++ b/src/badguy/plant.cpp @@ -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"); } diff --git a/src/badguy/skullyhop.cpp b/src/badguy/skullyhop.cpp index 6de656eda..74d72ebd9 100644 --- a/src/badguy/skullyhop.cpp +++ b/src/badguy/skullyhop.cpp @@ -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"); } diff --git a/src/badguy/spidermite.cpp b/src/badguy/spidermite.cpp index 28b4a802a..2c5bbf1d7 100644 --- a/src/badguy/spidermite.cpp +++ b/src/badguy/spidermite.cpp @@ -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"); } diff --git a/src/badguy/stalactite.cpp b/src/badguy/stalactite.cpp index dad7103b4..6a3d67578 100644 --- a/src/badguy/stalactite.cpp +++ b/src/badguy/stalactite.cpp @@ -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"); } diff --git a/src/badguy/toad.cpp b/src/badguy/toad.cpp index 0f0582b14..6b039dde0 100644 --- a/src/badguy/toad.cpp +++ b/src/badguy/toad.cpp @@ -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"); } diff --git a/src/badguy/totem.cpp b/src/badguy/totem.cpp index 6cca78c78..e24cd54b1 100644 --- a/src/badguy/totem.cpp +++ b/src/badguy/totem.cpp @@ -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"); } diff --git a/src/badguy/walking_badguy.cpp b/src/badguy/walking_badguy.cpp index 3ac8aa583..627e62cf8 100644 --- a/src/badguy/walking_badguy.cpp +++ b/src/badguy/walking_badguy.cpp @@ -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 diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index 2eca07e2c..2547f71b0 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -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"); } diff --git a/src/badguy/yeti_stalactite.cpp b/src/badguy/yeti_stalactite.cpp index de27da329..e3edc25f8 100644 --- a/src/badguy/yeti_stalactite.cpp +++ b/src/badguy/yeti_stalactite.cpp @@ -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"); } diff --git a/src/badguy/zeekling.cpp b/src/badguy/zeekling.cpp index 83c6adfae..3d6ec901f 100644 --- a/src/badguy/zeekling.cpp +++ b/src/badguy/zeekling.cpp @@ -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"); } diff --git a/src/control/joystickkeyboardcontroller.cpp b/src/control/joystickkeyboardcontroller.cpp index ee62b4a55..3cc65d16a 100644 --- a/src/control/joystickkeyboardcontroller.cpp +++ b/src/control/joystickkeyboardcontroller.cpp @@ -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"); } diff --git a/src/gameconfig.cpp b/src/gameconfig.cpp index b90551bd1..818003448 100644 --- a/src/gameconfig.cpp +++ b/src/gameconfig.cpp @@ -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"); diff --git a/src/level.cpp b/src/level.cpp index 33c7c2523..e806aa5cf 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -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; diff --git a/src/lisp/lisp.hpp b/src/lisp/lisp.hpp index 4d800942b..099e13b82 100644 --- a/src/lisp/lisp.hpp +++ b/src/lisp/lisp.hpp @@ -148,7 +148,7 @@ public: } template - bool get_vector(const char* name, std::vector& vec) const + bool get(const char* name, std::vector& vec) const { vec.clear(); diff --git a/src/lisp/writer.cpp b/src/lisp/writer.cpp index 99ff42ba8..a531caa45 100644 --- a/src/lisp/writer.cpp +++ b/src/lisp/writer.cpp @@ -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& 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& 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& 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& value) { indent(); diff --git a/src/lisp/writer.hpp b/src/lisp/writer.hpp index c2dad8d4d..a031ab7e8 100644 --- a/src/lisp/writer.hpp +++ b/src/lisp/writer.hpp @@ -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& value); - void write_int_vector(const std::string& name, const std::vector& value); - void write_float_vector(const std::string& name, const std::vector& value); - void write_string_vector(const std::string& name, const std::vector& value); + void write(const std::string& name, const char* value, + bool translatable = false) { write(name, static_cast(value), translatable); } + void write(const std::string& name, bool value); + void write(const std::string& name, const std::vector& value); + void write(const std::string& name, const std::vector& value); + void write(const std::string& name, const std::vector& value); + void write(const std::string& name, const std::vector& value); // add more write-functions when needed... void end_list(const std::string& listname); diff --git a/src/object/background.cpp b/src/object/background.cpp index f60f18435..9d0cec660 100644 --- a/src/object/background.cpp +++ b/src/object/background.cpp @@ -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"); } diff --git a/src/object/camera.cpp b/src/object/camera.cpp index 7cea284bc..21a4ac7e8 100644 --- a/src/object/camera.cpp +++ b/src/object/camera.cpp @@ -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"); diff --git a/src/object/decal.cpp b/src/object/decal.cpp index 05ccd1b9e..62fec6166 100644 --- a/src/object/decal.cpp +++ b/src/object/decal.cpp @@ -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"); } diff --git a/src/object/firefly.cpp b/src/object/firefly.cpp index 8dd4fe4d5..ac49d195a 100644 --- a/src/object/firefly.cpp +++ b/src/object/firefly.cpp @@ -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"); } diff --git a/src/object/gradient.cpp b/src/object/gradient.cpp index d89996bb2..9c40fc069 100644 --- a/src/object/gradient.cpp +++ b/src/object/gradient.cpp @@ -40,8 +40,8 @@ Gradient::Gradient(const lisp::Lisp& reader) { reader.get("layer", layer); std::vector 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"); } diff --git a/src/object/ispy.cpp b/src/object/ispy.cpp index 09a7367a0..3ff6649d3 100644 --- a/src/object/ispy.cpp +++ b/src/object/ispy.cpp @@ -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"); diff --git a/src/object/lantern.cpp b/src/object/lantern.cpp index 8812e4bf0..f2c171281 100644 --- a/src/object/lantern.cpp +++ b/src/object/lantern.cpp @@ -31,7 +31,7 @@ Lantern::Lantern(const lisp::Lisp& reader) { //get color from lisp std::vector 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)); diff --git a/src/object/magicblock.cpp b/src/object/magicblock.cpp index 99135de94..51c92e803 100644 --- a/src/object/magicblock.cpp +++ b/src/object/magicblock.cpp @@ -48,7 +48,7 @@ MagicBlock::MagicBlock(const lisp::Lisp& lisp) set_group(COLGROUP_STATIC); //get color from lisp std::vector vColor; - lisp.get_vector("color", vColor ); + lisp.get("color", vColor ); color = Color( vColor ); //all alpha to make the sprite still visible diff --git a/src/object/particlesystem.cpp b/src/object/particlesystem.cpp index fa435be83..0a4a0dccf 100644 --- a/src/object/particlesystem.cpp +++ b/src/object/particlesystem.cpp @@ -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"); } diff --git a/src/object/particlesystem_interactive.cpp b/src/object/particlesystem_interactive.cpp index de9038aba..94955e998 100644 --- a/src/object/particlesystem_interactive.cpp +++ b/src/object/particlesystem_interactive.cpp @@ -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"); } diff --git a/src/object/path.cpp b/src/object/path.cpp index 5d7e88a7d..1e725845a 100644 --- a/src/object/path.cpp +++ b/src/object/path.cpp @@ -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"); } diff --git a/src/object/rock.cpp b/src/object/rock.cpp index 7c56e1afc..54b7c384e 100644 --- a/src/object/rock.cpp +++ b/src/object/rock.cpp @@ -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"); } diff --git a/src/object/spotlight.cpp b/src/object/spotlight.cpp index d86848cf4..5fbf18891 100644 --- a/src/object/spotlight.cpp +++ b/src/object/spotlight.cpp @@ -37,7 +37,7 @@ Spotlight::Spotlight(const lisp::Lisp& lisp) lisp.get("angle", angle); std::vector vColor; - if( lisp.get_vector( "color", vColor ) ){ + if( lisp.get( "color", vColor ) ){ color = Color( vColor ); } diff --git a/src/object/tilemap.cpp b/src/object/tilemap.cpp index 88def1853..ad5d28dbf 100644 --- a/src/object/tilemap.cpp +++ b/src/object/tilemap.cpp @@ -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"); } diff --git a/src/player_status.cpp b/src/player_status.cpp index f04ed7d96..bb00f83ed 100644 --- a/src/player_status.cpp +++ b/src/player_status.cpp @@ -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 diff --git a/src/scripting/serialize.cpp b/src/scripting/serialize.cpp index 3455d2fc6..d9dda42c2 100644 --- a/src/scripting/serialize.cpp +++ b/src/scripting/serialize.cpp @@ -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 (val)); + writer.write(key, static_cast (val)); break; } case OT_FLOAT: { SQFloat val; sq_getfloat(vm, -1, &val); - writer.write_float(key, static_cast (val)); + writer.write(key, static_cast (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 (str)); + writer.write(key, reinterpret_cast (str)); break; } case OT_TABLE: { diff --git a/src/sector.cpp b/src/sector.cpp index 2ae3931f7..28cb380ef 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -199,7 +199,7 @@ Sector::parse(const lisp::Lisp& sector) iter.value()->get(init_script); } else if(token == "ambient-light") { std::vector 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 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::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) { diff --git a/src/sprite/sprite_data.cpp b/src/sprite/sprite_data.cpp index e8128b27d..7f5a5784d 100644 --- a/src/sprite/sprite_data.cpp +++ b/src/sprite/sprite_data.cpp @@ -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 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 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 << "'."; diff --git a/src/statistics.cpp b/src/statistics.cpp index 515fb111e..285a3575b 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -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); } */ diff --git a/src/tile_set.cpp b/src/tile_set.cpp index 0974bf1d8..037d55f07 100644 --- a/src/tile_set.cpp +++ b/src/tile_set.cpp @@ -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); diff --git a/src/trigger/climbable.cpp b/src/trigger/climbable.cpp index 7ec2af1a0..44dfea54a 100644 --- a/src/trigger/climbable.cpp +++ b/src/trigger/climbable.cpp @@ -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"); } diff --git a/src/trigger/door.cpp b/src/trigger/door.cpp index 970f16525..644906dbe 100644 --- a/src/trigger/door.cpp +++ b/src/trigger/door.cpp @@ -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"); } diff --git a/src/trigger/scripttrigger.cpp b/src/trigger/scripttrigger.cpp index 6af9b8c05..161a693e0 100644 --- a/src/trigger/scripttrigger.cpp +++ b/src/trigger/scripttrigger.cpp @@ -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"); } diff --git a/src/trigger/secretarea_trigger.cpp b/src/trigger/secretarea_trigger.cpp index 51fb36401..abf342bd6 100644 --- a/src/trigger/secretarea_trigger.cpp +++ b/src/trigger/secretarea_trigger.cpp @@ -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"); } diff --git a/src/trigger/sequence_trigger.cpp b/src/trigger/sequence_trigger.cpp index 5a94419b8..5787019d4 100644 --- a/src/trigger/sequence_trigger.cpp +++ b/src/trigger/sequence_trigger.cpp @@ -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"); } diff --git a/src/trigger/switch.cpp b/src/trigger/switch.cpp index f260b4b65..82b97e13f 100644 --- a/src/trigger/switch.cpp +++ b/src/trigger/switch.cpp @@ -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"); } diff --git a/src/video/font.cpp b/src/video/font.cpp index f938279f6..e0a8e1977 100644 --- a/src/video/font.cpp +++ b/src/video/font.cpp @@ -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()); diff --git a/src/world.cpp b/src/world.cpp index 26ace8b5d..a5ec7852f 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -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"); diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 1f2e377bd..f01a0c196 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -355,7 +355,7 @@ WorldMap::load(const std::string& filename) add_object(teleporter); } else if(iter.item() == "ambient-light") { std::vector 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 { -- 2.11.0