- Remove parse_direction and write_direction; instead just always require directions as strings
- Remove zero, as it's pointless - just use {0,0}
- Add vector_diff
Plus a bunch of changes which were necessary for the script to work:
* The "simulate lobby activity" plugin now exits when the server is shut
down.
* The plugin now uses wesnoth.random() for random number generation.
Math.random() uses a fixed seed, which would make all the clients
perform the exact same actions.
* Exposed wesnoth.random() to plugins to allow the change above.
* --nogui no longer implies --wconsole on Windows. With implied --wconsole
the clients attached themselves to the standard output of the Python
script, which made it impossible to see the output of the script itself.
(Also some minor code cleanup in another function)
The two main improvements from this commit are:
- Tab completion can now work for any valid variable path, including ones that contain brackets or even ones that are not tables
- Tab completion no longer returns attributes that are not valid identifiers
There's also a new mechanism for userdata to hook into the tab completion using a metafunction.
At present no userdata uses this mechanism, so it is untested.
Instead of passing the video object to the Lua kernel, the game now simply
fetches the video singleton when displaying dialogs. This means there is
no longer any need to store a reference to the video object.
luaconf.h provides a place for us to make changes, avoiding the need to change the original definitions. Move everything down there. This encompases the following changes:
1) Disable compatibility with old versions of Lua in the C++. Compatability is maintained only for the Lua runtime. Only one correction was needed: in application_lua_kernel.cpp
2) Change how the backpointer is defined, for forward compatability with Lua 5.3. This effected only one line: in lua_kernel_base.cpp. Using the Lua 5.3 macro caused a GCC warning, suppressed it for that line.
3) Certain Windows-only features are no longer available in the Lua runtime. These features are all in the Lua io module, which we don't allow access to, so this is a non-change for the runtime.
4) Lua will behave as if it is a standard C environment. This, again, mainly effects the Windows environment and features we don't allow access to in the runtime.
adds code comments for a number of method declarations in header,
and in the implementation file, prefixes many method calls with
`this->`. This convention disambiguates whether the call is a method
of the class or a function at global scope. On some projects like
gcc, it is part of the coding standard to do this to avoid subtle
bugs -- I have come to believe that it makes your code more easily
readable, even if it is a little more typing.
@gfgtdf pointed out that preferences contain MP passwords. We can't allow
untrusted code to access them. Since we only need preference access from
plugins for now, the simplest way to avoid security issues is to block Lua
code outside of plugins from accessing preferences at all.
This constitutes drop-in replacements for:
* boost::shared_ptr
* boost::scoped_ptr
* boost::weak_ptr
* boost::enable_shared_from_this
* boost::static_pointer_cast
* boost::dynamic_pointer_cast
This excludes boost::intrusive_ptr, except for stray includes. Refactoring that is more complicated.
This commit converts the following function calls:
* boost::bind -> std::bind
* boost::function and boost::functionN -> std::function
* boost::ref and boost::cref -> std::ref and std::cref
* boost::bad_function_call -> std::bad_function_call
In the process, it was discovered that std::bind has trouble with overloaded
functions. There were two such cases in the code:
* gui2::twindow had an ancient unused overload to draw(). The overload was removed.
* gui2::trepeating_button was binding tdispatcher::fire. This case was converted
to a lambda.