Author: ai0867
Date: Mon Jan 18 03:19:23 2010
New Revision: 40738
URL: http://svn.gna.org/viewcvs/wesnoth?rev=40738&view=rev
Log:
Prevent crashes by incomplete [tunnel] tags
Modified:
branches/fendrin_pathfind/src/game_events.cpp
branches/fendrin_pathfind/src/pathfind.cpp
Modified: branches/fendrin_pathfind/src/game_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_pathfind/src/game_events.cpp?rev=40738&r1=40737&r2=40738&view=diff
==============================================================================
--- branches/fendrin_pathfind/src/game_events.cpp (original)
+++ branches/fendrin_pathfind/src/game_events.cpp Mon Jan 18 03:19:23 2010
@@ -840,9 +840,16 @@
WML_HANDLER_FUNCTION(tunnel, /*event_info*/, cfg)
{
//TODO add recording to the savefile
- ERR_WML << cfg.get_config().debug();
- teleport_group blah = teleport_group(cfg);
- resources::game_map->set_tunnel(blah);
+
+ if (cfg.get_children("source").empty() ||
+ cfg.get_children("target").empty() ||
+ cfg.get_children("filter").empty()) {
+ ERR_WML << "[tunnel] is missing a mandatory tag:\n"
+ << cfg.get_config().debug();
+ } else {
+ teleport_group tunnel = teleport_group(cfg);
+ resources::game_map->set_tunnel(tunnel);
+ }
}
WML_HANDLER_FUNCTION(modify_ai, /*event_info*/, cfg)
Modified: branches/fendrin_pathfind/src/pathfind.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_pathfind/src/pathfind.cpp?rev=40738&r1=40737&r2=40738&view=diff
==============================================================================
--- branches/fendrin_pathfind/src/pathfind.cpp (original)
+++ branches/fendrin_pathfind/src/pathfind.cpp Mon Jan 18 03:19:23 2010
@@ -69,8 +69,8 @@
// target_filter_(cfg.get_children("target").front(), *resources::units);
// unit_filter_(cfg.get_children("filter").front());
// cfg_(cfg);
- ERR_PF << cfg.get_config().debug();
- ERR_PF << cfg_.get_config().debug();
+ ERR_PF << "cfg:\n" << cfg.get_config().debug();
+ ERR_PF << "cfg_:\n" << cfg_.get_config().debug();
//TODO error handling.
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits