mail[Wesnoth-commits] r33603 - /trunk/src/unit_map.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on March 13, 2009 - 15:14:
Author: silene
Date: Fri Mar 13 15:14:38 2009
New Revision: 33603

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33603&view=rev
Log:
Forbade insertion of units with invalid location. (Fix for bug #13174.)

Modified:
    trunk/src/unit_map.cpp

Modified: trunk/src/unit_map.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_map.cpp?rev=33603&r1=33602&r2=33603&view=diff
==============================================================================
--- trunk/src/unit_map.cpp (original)
+++ trunk/src/unit_map.cpp Fri Mar 13 15:14:38 2009
@@ -475,6 +475,14 @@
 {
        size_t unit_id = p->second.underlying_id();
        umap::iterator iter = map_.find(unit_id);
+
+       // TODO: should also check for out-of-map locations.
+       if (!p->first.valid()) {
+               ERR_NG << "Trying to add " << p->second.name() <<
+                       " - " << p->second.id() << " at an invalid location; 
Discarding.\n";
+               delete p;
+               return;
+       }
 
        if (iter == map_.end()) {
                map_[unit_id] = std::make_pair(true, p);




Related Messages


Powered by MHonArc, Updated Fri Mar 13 16:40:25 2009