[Commits] [wesnoth/wesnoth] 034374: Insert lua_unit's contained pointer directly

GitHub noreply at github.com
Thu May 1 19:54:09 UTC 2014


  Branch: refs/heads/1.12
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 0343748a7f233608f1daa64b418228c81639efef
      https://github.com/wesnoth/wesnoth/commit/0343748a7f233608f1daa64b418228c81639efef
  Author: Alexander van Gessel <ai0867 at gmail.com>
  Date:   2014-05-01 (Thu, 01 May 2014)

  Changed paths:
    M src/scripting/lua.cpp

  Log Message:
  -----------
  Insert lua_unit's contained pointer directly

Not copying the unit improves the speed of wesnoth.put_unit by two orders
of magnitude from lua's perspective.

To do this, we have to take ownership of any owned pointer from lua_unit.
We do this by not running lua_unit's destructor, but just overwriting the memory it's in.


  Commit: 5b92c1ef5575c0d2473b582f5368d985bf2aefff
      https://github.com/wesnoth/wesnoth/commit/5b92c1ef5575c0d2473b582f5368d985bf2aefff
  Author: Alexander van Gessel <ai0867 at gmail.com>
  Date:   2014-05-01 (Thu, 01 May 2014)

  Changed paths:
    M src/scripting/lua.cpp
    M src/scripting/lua_api.cpp
    M src/scripting/lua_api.hpp

  Log Message:
  -----------
  Give lua_unit a put_map member function

This allows us to remove the destructor-avoidance hack in wesnoth.put_unit
and simplify the function's handing of various lua_unit types.


Compare: https://github.com/wesnoth/wesnoth/compare/25c9f8698810...5b92c1ef5575


More information about the Commits mailing list