Author: sapient
Date: Sat Apr  7 01:15:58 2007
New Revision: 16657

URL: http://svn.gna.org/viewcvs/wesnoth?rev=16657&view=rev
Log:
use the more consistent replay style for [fire_event] source locations

Modified:
    trunk/src/replay.cpp

Modified: trunk/src/replay.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=16657&r1=16656&r2=16657&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Sat Apr  7 01:15:58 2007
@@ -383,11 +383,8 @@
        config& ev = cmd->add_child("fire_event");
        ev["raise"] = name;
        if(loc.valid()) {
-               char buf[50];
-               snprintf(buf,sizeof(buf),"%d", loc.x+1);
-               ev["x1"] = buf;
-               snprintf(buf,sizeof(buf),"%d", loc.y+1);
-               ev["y1"] = buf;
+               config& source = ev.add_child("source");
+               loc.write(source);
        }
        (*cmd)["undo"] = "no";
 }
@@ -1036,10 +1033,12 @@
                        //exclude these events here, because in a replay proper 
time of execution can't be
                        //established and therefore we fire those events inside 
play_controller::init_side
                        if ((event != "side turn") && (event != "turn 1") && 
(event != "new_turn")){
-                               gamemap::location ev1;
-                               ev1.x = 
lexical_cast_default<int>((*child)["x1"].value(), 0) - 1;
-                               ev1.y = 
lexical_cast_default<int>((*child)["y1"].value(), 0) - 1;
-                               game_events::fire(event, ev1);
+                               const config* const source = 
child->child("source");
+                               if(source != NULL) {
+                                       game_events::fire(event, 
gamemap::location(*source));
+                               } else {
+                                       game_events::fire(event);
+                               }
                        }
                } else {
                        if(! cfg->child("checksum")) {


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to