mail[Wesnoth-commits] r44677 - in /trunk/src/scripting: lua.cpp lua_api.hpp


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

Header


Content

Posted by guillaume . melquiond on July 25, 2010 - 17:34:
Author: silene
Date: Sun Jul 25 17:34:00 2010
New Revision: 44677

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44677&view=rev
Log:
Removed unused function lua_unit::reload.

Modified:
    trunk/src/scripting/lua.cpp
    trunk/src/scripting/lua_api.hpp

Modified: trunk/src/scripting/lua.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/scripting/lua.cpp?rev=44677&r1=44676&r2=44677&view=diff
==============================================================================
--- trunk/src/scripting/lua.cpp (original)
+++ trunk/src/scripting/lua.cpp Sun Jul 25 17:34:00 2010
@@ -432,14 +432,6 @@
        return &*ui;
 }
 
-void lua_unit::reload()
-{
-       assert(ptr);
-       uid = ptr->underlying_id();
-       delete ptr;
-       ptr= NULL;
-}
-
 /**
  * Converts a Lua value to a unit pointer.
  */
@@ -1833,8 +1825,12 @@
        resources::units->erase(loc);
        if (u) {
                resources::units->add(loc, *u);
-               if (!lu) delete u;
-               else lu->reload();
+               if (lu) {
+                       size_t uid = u->underlying_id();
+                       lu->lua_unit::~lua_unit();
+                       new(lu) lua_unit(uid);
+               } else
+                       delete u;
        }
 
        return 0;

Modified: trunk/src/scripting/lua_api.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/scripting/lua_api.hpp?rev=44677&r1=44676&r2=44677&view=diff
==============================================================================
--- trunk/src/scripting/lua_api.hpp (original)
+++ trunk/src/scripting/lua_api.hpp Sun Jul 25 17:34:00 2010
@@ -49,7 +49,6 @@
        ~lua_unit();
        bool on_map() const { return !ptr && side == 0; }
        int on_recall_list() const { return side; }
-       void reload();
        unit *get();
 };
 




Related Messages


Powered by MHonArc, Updated Sun Jul 25 17:40:14 2010