diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 705640a4..9ec136c3 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -16,8 +16,13 @@ IF(NOT CMAKE_BUILD_TYPE) ENDIF() # find needed libraries +IF(WIN32) + SET(Boost_THREADAPI win32) +ENDIF() + +SET(Boost_USE_MULTITHREADED ON) SET(Boost_USE_STATIC_LIBS ON) -FIND_PACKAGE(Boost COMPONENTS system REQUIRED) +FIND_PACKAGE(Boost COMPONENTS system thread REQUIRED) IF(USE_OPENGL_ES2) FIND_PACKAGE(OpenGLES2 REQUIRED) @@ -37,6 +42,8 @@ FIND_PACKAGE(GMP REQUIRED) FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(OpenAL REQUIRED) FIND_PACKAGE(VorbisFile REQUIRED) +FIND_PACKAGE(Vorbis REQUIRED) +FIND_PACKAGE(Ogg REQUIRED) # setup compiler options SET(CXX_WARNS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable") @@ -90,7 +97,10 @@ IF(WIN32) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads") ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) - SET(ADDITIONAL_LIBRARIES ws2_32 mswsock imagehlp) + SET(ADDITIONAL_LIBRARIES ws2_32 mswsock imagehlp winmm) + + # fix boost thread linkage + ADD_DEFINITIONS(-DBOOST_THREAD_USE_LIB) SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/win32window.cpp @@ -116,24 +126,23 @@ ENDIF() INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIR} - ${OPENAL_INCLUDE_DIR} + ${OPENAL_INCLUDE_DIR} ${VORBISFILE_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${PHYSFS_INCLUDE_DIR} ${GMP_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} - ${VORBISFILE_INCLUDE_DIR} "${CMAKE_CURRENT_LIST_DIR}/.." ) SET(framework_LIBRARIES ${Boost_LIBRARIES} - ${OPENGL_LIBRARIES} - ${OPENAL_LIBRARY} ${LUA_LIBRARIES} ${PHYSFS_LIBRARY} ${GMP_LIBRARY} ${ZLIB_LIBRARY} - ${VORBISFILE_LIBRARY} + ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY} + ${OPENGL_LIBRARIES} + ${OPENAL_LIBRARY} ${ADDITIONAL_LIBRARIES} ) diff --git a/src/framework/application.cpp b/src/framework/application.cpp index 4decd4b3..30a05b07 100644 --- a/src/framework/application.cpp +++ b/src/framework/application.cpp @@ -95,8 +95,8 @@ void Application::init(const std::vector& args) g_window.init(); g_window.hide(); - g_window.setOnResize(std::bind(&Application::resize, this, _1)); - g_window.setOnInputEvent(std::bind(&Application::inputEvent, this, _1)); + g_window.setOnResize(std::bind(&Application::resize, this, std::placeholders::_1)); + g_window.setOnInputEvent(std::bind(&Application::inputEvent, this, std::placeholders::_1)); g_window.setOnClose(std::bind(&Application::close, this)); // initialize graphics diff --git a/src/framework/cmake/FindOgg.cmake b/src/framework/cmake/FindOgg.cmake new file mode 100644 index 00000000..4416aeba --- /dev/null +++ b/src/framework/cmake/FindOgg.cmake @@ -0,0 +1,10 @@ +# Try to find the OGG library +# OGG_FOUND - system has OGG +# OGG_INCLUDE_DIR - the OGG include directory +# OGG_LIBRARY - the OGG library + +FIND_PATH(OGG_INCLUDE_DIR NAMES ogg/ogg.h) +FIND_LIBRARY(OGG_LIBRARY NAMES libogg.a ogg) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ogg DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR) +MARK_AS_ADVANCED(OGG_LIBRARY OGG_INCLUDE_DIR) diff --git a/src/framework/cmake/FindOpenAL.cmake b/src/framework/cmake/FindOpenAL.cmake new file mode 100644 index 00000000..0cca89c3 --- /dev/null +++ b/src/framework/cmake/FindOpenAL.cmake @@ -0,0 +1,102 @@ +# Locate OpenAL +# This module defines +# OPENAL_LIBRARY +# OPENAL_FOUND, if false, do not try to link to OpenAL +# OPENAL_INCLUDE_DIR, where to find the headers +# +# $OPENALDIR is an environment variable that would +# correspond to the ./configure --prefix=$OPENALDIR +# used in building OpenAL. +# +# Created by Eric Wing. This was influenced by the FindSDL.cmake module. + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This makes the presumption that you are include al.h like +# #include "al.h" +# and not +# #include +# The reason for this is that the latter is not entirely portable. +# Windows/Creative Labs does not by default put their headers in AL/ and +# OS X uses the convention . +# +# For Windows, Creative Labs seems to have added a registry key for their +# OpenAL 1.1 installer. I have added that key to the list of search paths, +# however, the key looks like it could be a little fragile depending on +# if they decide to change the 1.00.0000 number for bug fix releases. +# Also, they seem to have laid down groundwork for multiple library platforms +# which puts the library in an extra subdirectory. Currently there is only +# Win32 and I have hardcoded that here. This may need to be adjusted as +# platforms are introduced. +# The OpenAL 1.0 installer doesn't seem to have a useful key I can use. +# I do not know if the Nvidia OpenAL SDK has a registry key. +# +# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger). +# To support the framework, I originally wrote special framework detection +# code in this module which I have now removed with CMake's introduction +# of native support for frameworks. +# In addition, OpenAL is open source, and it is possible to compile on Panther. +# Furthermore, due to bugs in the initial OpenAL release, and the +# transition to OpenAL 1.1, it is common to need to override the built-in +# framework. +# Per my request, CMake should search for frameworks first in +# the following order: +# ~/Library/Frameworks/OpenAL.framework/Headers +# /Library/Frameworks/OpenAL.framework/Headers +# /System/Library/Frameworks/OpenAL.framework/Headers +# +# On OS X, this will prefer the Framework version (if found) over others. +# People will have to manually change the cache values of +# OPENAL_LIBRARY to override this selection or set the CMake environment +# CMAKE_INCLUDE_PATH to modify the search paths. + +FIND_PATH(OPENAL_INCLUDE_DIR AL/al.h + HINTS + $ENV{OPENALDIR} + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] +) + +FIND_LIBRARY(OPENAL_LIBRARY + NAMES OpenAL al openal OpenAL32 + HINTS + $ENV{OPENALDIR} + PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] +) + + +# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR) + +MARK_AS_ADVANCED(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) diff --git a/src/framework/cmake/FindPhysFS.cmake b/src/framework/cmake/FindPhysFS.cmake index 44d3c749..a63af81d 100644 --- a/src/framework/cmake/FindPhysFS.cmake +++ b/src/framework/cmake/FindPhysFS.cmake @@ -8,4 +8,3 @@ FIND_LIBRARY(PHYSFS_LIBRARY NAMES libphysfs.a physfs) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) MARK_AS_ADVANCED(PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) - diff --git a/src/framework/cmake/FindVorbis.cmake b/src/framework/cmake/FindVorbis.cmake new file mode 100644 index 00000000..ae13453c --- /dev/null +++ b/src/framework/cmake/FindVorbis.cmake @@ -0,0 +1,10 @@ +# Try to find the VORBIS library +# VORBIS_FOUND - system has VORBIS +# VORBIS_INCLUDE_DIR - the VORBIS include directory +# VORBIS_LIBRARY - the VORBIS library + +FIND_PATH(VORBIS_INCLUDE_DIR NAMES vorbis/codec.h) +FIND_LIBRARY(VORBIS_LIBRARY NAMES libvorbis.a vorbis) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Vorbis DEFAULT_MSG VORBIS_LIBRARY VORBIS_INCLUDE_DIR) +MARK_AS_ADVANCED(VORBIS_LIBRARY VORBIS_INCLUDE_DIR) diff --git a/src/framework/cmake/FindVorbisFile.cmake b/src/framework/cmake/FindVorbisFile.cmake index bab2a682..66d365c7 100644 --- a/src/framework/cmake/FindVorbisFile.cmake +++ b/src/framework/cmake/FindVorbisFile.cmake @@ -4,7 +4,7 @@ # VORBISFILE_LIBRARY - the VORBISFILE library FIND_PATH(VORBISFILE_INCLUDE_DIR NAMES vorbis/vorbisfile.h) -FIND_LIBRARY(VORBISFILE_LIBRARY NAMES vorbisfile) +FIND_LIBRARY(VORBISFILE_LIBRARY NAMES libvorbisfile.a vorbisfile) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(VORBISFILE DEFAULT_MSG VORBISFILE_LIBRARY VORBISFILE_INCLUDE_DIR) -MARK_AS_ADVANCED(VORBISFILE_LIBRARY VORBISFILE_INCLUDE_DIR) \ No newline at end of file +FIND_PACKAGE_HANDLE_STANDARD_ARGS(VorbisFile DEFAULT_MSG VORBISFILE_LIBRARY VORBISFILE_INCLUDE_DIR) +MARK_AS_ADVANCED(VORBISFILE_LIBRARY VORBISFILE_INCLUDE_DIR) diff --git a/src/framework/cmake/FindZLIB.cmake b/src/framework/cmake/FindZLIB.cmake index 6bc28e66..e89a3359 100644 --- a/src/framework/cmake/FindZLIB.cmake +++ b/src/framework/cmake/FindZLIB.cmake @@ -4,7 +4,7 @@ # ZLIB_LIBRARY - the zlib library FIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h) -FIND_LIBRARY(ZLIB_LIBRARY NAMES libz.a libzlib.a zlib1.a zlibd.a zlibd1.a z zlib zdll zlib1 zlibd zlibd1) +FIND_LIBRARY(ZLIB_LIBRARY NAMES libz.a libzlib.a zlib1.a z zlib zdll zlib1) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARY ZLIB_INCLUDE_DIR) MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) diff --git a/src/framework/global.h b/src/framework/global.h index f30f6e49..e91d2fe9 100644 --- a/src/framework/global.h +++ b/src/framework/global.h @@ -38,6 +38,7 @@ #include "const.h" // additional utilities +#include "util/compiler.h" #include "util/types.h" #include "util/tools.h" #include "math/point.h" @@ -49,7 +50,4 @@ // logger #include "core/logger.h" -// easy typing for _1, _2, ... -using namespace std::placeholders; - #endif diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index da5a6287..97428298 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -431,7 +431,7 @@ void Application::registerLuaFunctions() // Application g_lua.registerStaticClass("g_app"); g_lua.bindClassStaticFunction("g_app", "exit", std::bind(&Application::exit, g_app)); - g_lua.bindClassStaticFunction("g_app", "setFrameSleep", std::bind(&Application::setFrameSleep, g_app, _1)); + g_lua.bindClassStaticFunction("g_app", "setFrameSleep", std::bind(&Application::setFrameSleep, g_app, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_app", "isRunning", std::bind(&Application::isRunning, g_app)); g_lua.bindClassStaticFunction("g_app", "isStopping", std::bind(&Application::isStopping, g_app)); g_lua.bindClassStaticFunction("g_app", "getFrameSleep", std::bind(&Application::getFrameSleep, g_app)); @@ -444,33 +444,33 @@ void Application::registerLuaFunctions() // ConfigManager g_lua.registerStaticClass("g_configs"); - g_lua.bindClassStaticFunction("g_configs", "set", std::bind(&ConfigManager::set, &g_configs, _1, _2)); - g_lua.bindClassStaticFunction("g_configs", "setList", std::bind(&ConfigManager::setList, &g_configs, _1, _2)); - g_lua.bindClassStaticFunction("g_configs", "get", std::bind(&ConfigManager::get, &g_configs, _1)); - g_lua.bindClassStaticFunction("g_configs", "getList", std::bind(&ConfigManager::getList, &g_configs, _1)); - g_lua.bindClassStaticFunction("g_configs", "exists", std::bind(&ConfigManager::exists, &g_configs, _1)); - g_lua.bindClassStaticFunction("g_configs", "remove", std::bind(&ConfigManager::remove, &g_configs, _1)); - g_lua.bindClassStaticFunction("g_configs", "setNode", std::bind(&ConfigManager::setNode, &g_configs, _1, _2)); - g_lua.bindClassStaticFunction("g_configs", "addNode", std::bind(&ConfigManager::addNode, &g_configs, _1, _2)); - g_lua.bindClassStaticFunction("g_configs", "getNode", std::bind(&ConfigManager::getNode, &g_configs, _1)); + g_lua.bindClassStaticFunction("g_configs", "set", std::bind(&ConfigManager::set, &g_configs, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_configs", "setList", std::bind(&ConfigManager::setList, &g_configs, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_configs", "get", std::bind(&ConfigManager::get, &g_configs, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_configs", "getList", std::bind(&ConfigManager::getList, &g_configs, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_configs", "exists", std::bind(&ConfigManager::exists, &g_configs, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_configs", "remove", std::bind(&ConfigManager::remove, &g_configs, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_configs", "setNode", std::bind(&ConfigManager::setNode, &g_configs, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_configs", "addNode", std::bind(&ConfigManager::addNode, &g_configs, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_configs", "getNode", std::bind(&ConfigManager::getNode, &g_configs, std::placeholders::_1)); // PlatformWindow g_lua.registerStaticClass("g_window"); - g_lua.bindClassStaticFunction("g_window", "move", std::bind(&PlatformWindow::move, &g_window, _1)); - g_lua.bindClassStaticFunction("g_window", "resize", std::bind(&PlatformWindow::resize, &g_window, _1)); + g_lua.bindClassStaticFunction("g_window", "move", std::bind(&PlatformWindow::move, &g_window, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_window", "resize", std::bind(&PlatformWindow::resize, &g_window, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_window", "show", std::bind(&PlatformWindow::show, &g_window)); g_lua.bindClassStaticFunction("g_window", "hide", std::bind(&PlatformWindow::hide, &g_window)); g_lua.bindClassStaticFunction("g_window", "maximize", std::bind(&PlatformWindow::maximize, &g_window)); g_lua.bindClassStaticFunction("g_window", "restoreMouseCursor", std::bind(&PlatformWindow::restoreMouseCursor, &g_window)); g_lua.bindClassStaticFunction("g_window", "showMouse", std::bind(&PlatformWindow::showMouse, &g_window)); g_lua.bindClassStaticFunction("g_window", "hideMouse", std::bind(&PlatformWindow::hideMouse, &g_window)); - g_lua.bindClassStaticFunction("g_window", "setTitle", std::bind(&PlatformWindow::setTitle, &g_window, _1)); - g_lua.bindClassStaticFunction("g_window", "setMouseCursor", std::bind(&PlatformWindow::setMouseCursor, &g_window, _1, _2)); - g_lua.bindClassStaticFunction("g_window", "setMinimumSize", std::bind(&PlatformWindow::setMinimumSize, &g_window, _1)); - g_lua.bindClassStaticFunction("g_window", "setFullscreen", std::bind(&PlatformWindow::setFullscreen, &g_window, _1)); - g_lua.bindClassStaticFunction("g_window", "setVerticalSync", std::bind(&PlatformWindow::setVerticalSync, &g_window, _1)); - g_lua.bindClassStaticFunction("g_window", "setIcon", std::bind(&PlatformWindow::setIcon, &g_window, _1)); - g_lua.bindClassStaticFunction("g_window", "setClipboardText", std::bind(&PlatformWindow::setClipboardText, &g_window, _1)); + g_lua.bindClassStaticFunction("g_window", "setTitle", std::bind(&PlatformWindow::setTitle, &g_window, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_window", "setMouseCursor", std::bind(&PlatformWindow::setMouseCursor, &g_window, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_window", "setMinimumSize", std::bind(&PlatformWindow::setMinimumSize, &g_window, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_window", "setFullscreen", std::bind(&PlatformWindow::setFullscreen, &g_window, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_window", "setVerticalSync", std::bind(&PlatformWindow::setVerticalSync, &g_window, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_window", "setIcon", std::bind(&PlatformWindow::setIcon, &g_window, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_window", "setClipboardText", std::bind(&PlatformWindow::setClipboardText, &g_window, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_window", "getDisplaySize", std::bind(&PlatformWindow::getDisplaySize, &g_window)); g_lua.bindClassStaticFunction("g_window", "getClipboardText", std::bind(&PlatformWindow::getClipboardText, &g_window)); g_lua.bindClassStaticFunction("g_window", "getPlatformType", std::bind(&PlatformWindow::getPlatformType, &g_window)); @@ -486,8 +486,8 @@ void Application::registerLuaFunctions() g_lua.bindClassStaticFunction("g_window", "getY", std::bind(&PlatformWindow::getY, &g_window)); g_lua.bindClassStaticFunction("g_window", "getMousePosition", std::bind(&PlatformWindow::getMousePosition, &g_window)); g_lua.bindClassStaticFunction("g_window", "getKeyboardModifiers", std::bind(&PlatformWindow::getKeyboardModifiers, &g_window)); - g_lua.bindClassStaticFunction("g_window", "isKeyPressed", std::bind(&PlatformWindow::isKeyPressed, &g_window, _1)); - g_lua.bindClassStaticFunction("g_window", "isMouseButtonPressed", std::bind(&PlatformWindow::isMouseButtonPressed, &g_window, _1)); + g_lua.bindClassStaticFunction("g_window", "isKeyPressed", std::bind(&PlatformWindow::isKeyPressed, &g_window, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_window", "isMouseButtonPressed", std::bind(&PlatformWindow::isMouseButtonPressed, &g_window, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_window", "isVisible", std::bind(&PlatformWindow::isVisible, &g_window)); g_lua.bindClassStaticFunction("g_window", "isFullscreen", std::bind(&PlatformWindow::isFullscreen, &g_window)); g_lua.bindClassStaticFunction("g_window", "isMaximized", std::bind(&PlatformWindow::isMaximized, &g_window)); @@ -495,44 +495,44 @@ void Application::registerLuaFunctions() // Logger g_lua.registerStaticClass("g_logger"); - g_lua.bindClassStaticFunction("g_logger", "log", std::bind(&Logger::log, &g_logger, _1, _2)); + g_lua.bindClassStaticFunction("g_logger", "log", std::bind(&Logger::log, &g_logger, std::placeholders::_1, std::placeholders::_2)); g_lua.bindClassStaticFunction("g_logger", "fireOldMessages", std::bind(&Logger::fireOldMessages, &g_logger)); - g_lua.bindClassStaticFunction("g_logger", "setOnLog", std::bind(&Logger::setOnLog, &g_logger, _1)); + g_lua.bindClassStaticFunction("g_logger", "setOnLog", std::bind(&Logger::setOnLog, &g_logger, std::placeholders::_1)); // UI g_lua.registerStaticClass("g_ui"); - g_lua.bindClassStaticFunction("g_ui", "importStyle", std::bind(&UIManager::importStyle, &g_ui, _1)); - g_lua.bindClassStaticFunction("g_ui", "getStyle", std::bind(&UIManager::getStyle, &g_ui, _1)); - g_lua.bindClassStaticFunction("g_ui", "getStyleClass", std::bind(&UIManager::getStyleClass, &g_ui, _1)); - g_lua.bindClassStaticFunction("g_ui", "loadUI", std::bind(&UIManager::loadUI, &g_ui, _1, _2)); - g_lua.bindClassStaticFunction("g_ui", "createWidgetFromStyle", std::bind(&UIManager::createWidgetFromStyle, &g_ui, _1, _2)); - g_lua.bindClassStaticFunction("g_ui", "createWidgetFromOTML", std::bind(&UIManager::createWidgetFromOTML, &g_ui, _1, _2)); + g_lua.bindClassStaticFunction("g_ui", "importStyle", std::bind(&UIManager::importStyle, &g_ui, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_ui", "getStyle", std::bind(&UIManager::getStyle, &g_ui, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_ui", "getStyleClass", std::bind(&UIManager::getStyleClass, &g_ui, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_ui", "loadUI", std::bind(&UIManager::loadUI, &g_ui, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_ui", "createWidgetFromStyle", std::bind(&UIManager::createWidgetFromStyle, &g_ui, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_ui", "createWidgetFromOTML", std::bind(&UIManager::createWidgetFromOTML, &g_ui, std::placeholders::_1, std::placeholders::_2)); g_lua.bindClassStaticFunction("g_ui", "getRootWidget", std::bind(&UIManager::getRootWidget, &g_ui)); g_lua.bindClassStaticFunction("g_ui", "getDraggingWidget", std::bind(&UIManager::getDraggingWidget, &g_ui)); g_lua.bindClassStaticFunction("g_ui", "getPressedWidget", std::bind(&UIManager::getPressedWidget, &g_ui)); - g_lua.bindClassStaticFunction("g_ui", "setDebugBoxesDrawing", std::bind(&UIManager::setDebugBoxesDrawing, &g_ui, _1)); - g_lua.bindClassStaticFunction("g_ui", "isDrawingDebugBoxes", std::bind(&UIManager::setDebugBoxesDrawing, &g_ui, _1)); + g_lua.bindClassStaticFunction("g_ui", "setDebugBoxesDrawing", std::bind(&UIManager::setDebugBoxesDrawing, &g_ui, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_ui", "isDrawingDebugBoxes", std::bind(&UIManager::setDebugBoxesDrawing, &g_ui, std::placeholders::_1)); // ModuleManager g_lua.registerStaticClass("g_modules"); g_lua.bindClassStaticFunction("g_modules", "discoverModulesPath", std::bind(&ModuleManager::discoverModulesPath, &g_modules)); g_lua.bindClassStaticFunction("g_modules", "discoverModules", std::bind(&ModuleManager::discoverModules, &g_modules)); - g_lua.bindClassStaticFunction("g_modules", "autoLoadModules", std::bind(&ModuleManager::autoLoadModules, &g_modules, _1)); - g_lua.bindClassStaticFunction("g_modules", "discoverModule", std::bind(&ModuleManager::discoverModule, &g_modules, _1)); - g_lua.bindClassStaticFunction("g_modules", "ensureModuleLoaded", std::bind(&ModuleManager::ensureModuleLoaded, &g_modules, _1)); + g_lua.bindClassStaticFunction("g_modules", "autoLoadModules", std::bind(&ModuleManager::autoLoadModules, &g_modules, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_modules", "discoverModule", std::bind(&ModuleManager::discoverModule, &g_modules, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_modules", "ensureModuleLoaded", std::bind(&ModuleManager::ensureModuleLoaded, &g_modules, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_modules", "unloadModules", std::bind(&ModuleManager::unloadModules, &g_modules)); g_lua.bindClassStaticFunction("g_modules", "reloadModules", std::bind(&ModuleManager::reloadModules, &g_modules)); - g_lua.bindClassStaticFunction("g_modules", "getModule", std::bind(&ModuleManager::getModule, &g_modules, _1)); + g_lua.bindClassStaticFunction("g_modules", "getModule", std::bind(&ModuleManager::getModule, &g_modules, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_modules", "getModules", std::bind(&ModuleManager::getModules, &g_modules)); // FontManager g_lua.registerStaticClass("g_fonts"); - g_lua.bindClassStaticFunction("g_fonts", "importFont", std::bind(&FontManager::importFont, &g_fonts, _1)); - g_lua.bindClassStaticFunction("g_fonts", "fontExists", std::bind(&FontManager::fontExists, &g_fonts, _1)); - g_lua.bindClassStaticFunction("g_fonts", "setDefaultFont", std::bind(&FontManager::setDefaultFont, &g_fonts, _1)); + g_lua.bindClassStaticFunction("g_fonts", "importFont", std::bind(&FontManager::importFont, &g_fonts, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_fonts", "fontExists", std::bind(&FontManager::fontExists, &g_fonts, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_fonts", "setDefaultFont", std::bind(&FontManager::setDefaultFont, &g_fonts, std::placeholders::_1)); // EventDispatcher g_lua.registerStaticClass("g_eventDispatcher"); - g_lua.bindClassStaticFunction("g_eventDispatcher", "addEvent", std::bind(&EventDispatcher::addEvent, &g_eventDispatcher, _1, _2)); - g_lua.bindClassStaticFunction("g_eventDispatcher", "scheduleEvent", std::bind(&EventDispatcher::scheduleEvent, &g_eventDispatcher, _1, _2)); + g_lua.bindClassStaticFunction("g_eventDispatcher", "addEvent", std::bind(&EventDispatcher::addEvent, &g_eventDispatcher, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_eventDispatcher", "scheduleEvent", std::bind(&EventDispatcher::scheduleEvent, &g_eventDispatcher, std::placeholders::_1, std::placeholders::_2)); } diff --git a/src/framework/net/connection.cpp b/src/framework/net/connection.cpp index 34267529..c4a2ef4f 100644 --- a/src/framework/net/connection.cpp +++ b/src/framework/net/connection.cpp @@ -70,16 +70,16 @@ void Connection::connect(const std::string& host, uint16 port, const SimpleCallb m_readTimer.cancel(); if(!error) { - m_socket.async_connect(*endpointIterator, std::bind(&Connection::onConnect, shared_from_this(), _1)); + m_socket.async_connect(*endpointIterator, std::bind(&Connection::onConnect, shared_from_this(), std::placeholders::_1)); m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); - m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1)); + m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1)); } else handleError(error); }); m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); - m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1)); + m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1)); } void Connection::close() @@ -132,10 +132,10 @@ void Connection::write(uint8* buffer, uint16 size) asio::async_write(m_socket, asio::buffer(m_sendBuffer, m_sendBufferSize), - std::bind(&Connection::onWrite, shared_from_this(), _1, _2)); + std::bind(&Connection::onWrite, shared_from_this(), std::placeholders::_1, std::placeholders::_2)); m_writeTimer.expires_from_now(boost::posix_time::seconds(WRITE_TIMEOUT)); - m_writeTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1)); + m_writeTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1)); m_sendBufferSize = 0; }, SEND_INTERVAL); @@ -153,10 +153,10 @@ void Connection::read(uint16 bytes, const RecvCallback& callback) asio::async_read(m_socket, asio::buffer(m_recvBuffer, bytes), - std::bind(&Connection::onRecv, shared_from_this(), _1, bytes)); + std::bind(&Connection::onRecv, shared_from_this(), std::placeholders::_1, bytes)); m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); - m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1)); + m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1)); } void Connection::read_some(const RecvCallback& callback) @@ -169,10 +169,10 @@ void Connection::read_some(const RecvCallback& callback) m_recvCallback = callback; m_socket.async_read_some(asio::buffer(m_recvBuffer, RECV_BUFFER_SIZE), - std::bind(&Connection::onRecv, shared_from_this(), _1, _2)); + std::bind(&Connection::onRecv, shared_from_this(), std::placeholders::_1, std::placeholders::_2)); m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); - m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1)); + m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1)); } void Connection::onConnect(const boost::system::error_code& error) diff --git a/src/framework/net/protocol.cpp b/src/framework/net/protocol.cpp index 6e061c15..f019d462 100644 --- a/src/framework/net/protocol.cpp +++ b/src/framework/net/protocol.cpp @@ -37,7 +37,7 @@ Protocol::~Protocol() void Protocol::connect(const std::string& host, uint16 port) { m_connection = ConnectionPtr(new Connection); - m_connection->setErrorCallback(std::bind(&Protocol::onError, asProtocol(), _1)); + m_connection->setErrorCallback(std::bind(&Protocol::onError, asProtocol(), std::placeholders::_1)); m_connection->connect(host, port, std::bind(&Protocol::onConnect, asProtocol())); } @@ -89,7 +89,7 @@ void Protocol::recv() m_inputMessage.reset(); if(m_connection) - m_connection->read(InputMessage::HEADER_LENGTH, std::bind(&Protocol::internalRecvHeader, asProtocol(), _1, _2)); + m_connection->read(InputMessage::HEADER_LENGTH, std::bind(&Protocol::internalRecvHeader, asProtocol(), std::placeholders::_1, std::placeholders::_2)); } void Protocol::internalRecvHeader(uint8* buffer, uint16 size) @@ -102,7 +102,7 @@ void Protocol::internalRecvHeader(uint8* buffer, uint16 size) // schedule read for message data if(m_connection) - m_connection->read(dataSize, std::bind(&Protocol::internalRecvData, asProtocol(), _1, _2)); + m_connection->read(dataSize, std::bind(&Protocol::internalRecvData, asProtocol(), std::placeholders::_1, std::placeholders::_2)); } void Protocol::internalRecvData(uint8* buffer, uint16 size) diff --git a/src/framework/sound/declarations.h b/src/framework/sound/declarations.h index 6ebbc685..c2bd0040 100644 --- a/src/framework/sound/declarations.h +++ b/src/framework/sound/declarations.h @@ -25,6 +25,8 @@ #include +#define AL_LIBTYPE_STATIC + #include #include diff --git a/src/framework/util/compiler.h b/src/framework/util/compiler.h new file mode 100644 index 00000000..b4fb9dd3 --- /dev/null +++ b/src/framework/util/compiler.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2010-2012 OTClient + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __COMPILER_H__ +#define __COMPILER_H__ + +// hack to enable std::thread on mingw32 4.6 +#if !defined(_GLIBCXX_HAS_GTHREADS) && defined(__GNUG__) +#include +#include +#include +#include +#include +namespace std { + using boost::thread; + + using boost::mutex; + using boost::timed_mutex; + using boost::recursive_mutex; + using boost::recursive_timed_mutex; + + using boost::lock_guard; + using boost::unique_lock; + + using boost::condition_variable; + using boost::condition_variable_any; +} +#endif + +#endif diff --git a/src/otclient/luafunctions.cpp b/src/otclient/luafunctions.cpp index 9e4030f3..7a72e54a 100644 --- a/src/otclient/luafunctions.cpp +++ b/src/otclient/luafunctions.cpp @@ -50,105 +50,105 @@ void OTClient::registerLuaFunctions() Application::registerLuaFunctions(); g_lua.registerStaticClass("g_thingsType"); - g_lua.bindClassStaticFunction("g_thingsType", "load", std::bind(&ThingsType::load, &g_thingsType, _1)); + g_lua.bindClassStaticFunction("g_thingsType", "load", std::bind(&ThingsType::load, &g_thingsType, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_thingsType", "isLoaded", std::bind(&ThingsType::isLoaded, &g_thingsType)); g_lua.bindClassStaticFunction("g_thingsType", "getSignature", std::bind(&ThingsType::getSignature, &g_thingsType)); g_lua.registerStaticClass("g_sprites"); - g_lua.bindClassStaticFunction("g_sprites", "load", std::bind(&SpriteManager::load, &g_sprites, _1)); + g_lua.bindClassStaticFunction("g_sprites", "load", std::bind(&SpriteManager::load, &g_sprites, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_sprites", "isLoaded", std::bind(&SpriteManager::isLoaded, &g_sprites)); g_lua.bindClassStaticFunction("g_sprites", "getSignature", std::bind(&SpriteManager::getSignature, &g_sprites)); g_lua.bindClassStaticFunction("g_sprites", "preloadSprites", std::bind(&SpriteManager::preloadSprites, &g_sprites)); g_lua.registerStaticClass("g_map"); - g_lua.bindClassStaticFunction("g_map", "isLookPossible", std::bind(&Map::isLookPossible, &g_map, _1)); - g_lua.bindClassStaticFunction("g_map", "isCovered", std::bind(&Map::isCovered, &g_map, _1, _2)); - g_lua.bindClassStaticFunction("g_map", "isCompletelyCovered", std::bind(&Map::isCompletelyCovered, &g_map, _1, _2)); - g_lua.bindClassStaticFunction("g_map", "addThing", std::bind(&Map::addThing, &g_map, _1, _2, _3)); - g_lua.bindClassStaticFunction("g_map", "getThing", std::bind(&Map::getThing, &g_map, _1, _2)); - g_lua.bindClassStaticFunction("g_map", "removeThingByPos", std::bind(&Map::removeThingByPos, &g_map, _1, _2)); - g_lua.bindClassStaticFunction("g_map", "removeThing", std::bind(&Map::removeThing, &g_map, _1)); - g_lua.bindClassStaticFunction("g_map", "cleanTile", std::bind(&Map::cleanTile, &g_map, _1)); - g_lua.bindClassStaticFunction("g_map", "getTile", std::bind(&Map::getTile, &g_map, _1)); - g_lua.bindClassStaticFunction("g_map", "setCentralPosition", std::bind(&Map::setCentralPosition, &g_map, _1)); + g_lua.bindClassStaticFunction("g_map", "isLookPossible", std::bind(&Map::isLookPossible, &g_map, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_map", "isCovered", std::bind(&Map::isCovered, &g_map, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_map", "isCompletelyCovered", std::bind(&Map::isCompletelyCovered, &g_map, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_map", "addThing", std::bind(&Map::addThing, &g_map, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + g_lua.bindClassStaticFunction("g_map", "getThing", std::bind(&Map::getThing, &g_map, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_map", "removeThingByPos", std::bind(&Map::removeThingByPos, &g_map, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_map", "removeThing", std::bind(&Map::removeThing, &g_map, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_map", "cleanTile", std::bind(&Map::cleanTile, &g_map, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_map", "getTile", std::bind(&Map::getTile, &g_map, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_map", "setCentralPosition", std::bind(&Map::setCentralPosition, &g_map, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_map", "getCentralPosition", std::bind(&Map::getCentralPosition, &g_map)); - g_lua.bindClassStaticFunction("g_map", "getCreatureById", std::bind(&Map::getCreatureById, &g_map, _1)); - g_lua.bindClassStaticFunction("g_map", "removeCreatureById", std::bind(&Map::removeCreatureById, &g_map, _1)); - g_lua.bindClassStaticFunction("g_map", "getSpectators", std::bind(&Map::getSpectators, &g_map, _1, _2)); - g_lua.bindClassStaticFunction("g_map", "findPath", std::bind(&Map::findPath, &g_map, _1, _2, _3)); + g_lua.bindClassStaticFunction("g_map", "getCreatureById", std::bind(&Map::getCreatureById, &g_map, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_map", "removeCreatureById", std::bind(&Map::removeCreatureById, &g_map, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_map", "getSpectators", std::bind(&Map::getSpectators, &g_map, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_map", "findPath", std::bind(&Map::findPath, &g_map, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); g_lua.registerStaticClass("g_game"); - g_lua.bindClassStaticFunction("g_game", "loginWorld", std::bind(&Game::loginWorld, &g_game, _1, _2, _3, _4, _5, _6)); + g_lua.bindClassStaticFunction("g_game", "loginWorld", std::bind(&Game::loginWorld, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6)); g_lua.bindClassStaticFunction("g_game", "cancelLogin", std::bind(&Game::cancelLogin, &g_game)); g_lua.bindClassStaticFunction("g_game", "forceLogout", std::bind(&Game::forceLogout, &g_game)); g_lua.bindClassStaticFunction("g_game", "safeLogout", std::bind(&Game::safeLogout, &g_game)); - g_lua.bindClassStaticFunction("g_game", "walk", std::bind(&Game::walk, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "autoWalk", std::bind(&Game::autoWalk, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "forceWalk", std::bind(&Game::forceWalk, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "turn", std::bind(&Game::turn, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "walk", std::bind(&Game::walk, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "autoWalk", std::bind(&Game::autoWalk, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "forceWalk", std::bind(&Game::forceWalk, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "turn", std::bind(&Game::turn, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "stop", std::bind(&Game::stop, &g_game)); - g_lua.bindClassStaticFunction("g_game", "look", std::bind(&Game::look, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "move", std::bind(&Game::move, &g_game, _1, _2, _3)); - g_lua.bindClassStaticFunction("g_game", "rotate", std::bind(&Game::rotate, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "use", std::bind(&Game::use, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "useWith", std::bind(&Game::useWith, &g_game, _1, _2)); - g_lua.bindClassStaticFunction("g_game", "useInventoryItem", std::bind(&Game::useInventoryItem, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "useInventoryItemWith", std::bind(&Game::useInventoryItemWith, &g_game, _1, _2)); - g_lua.bindClassStaticFunction("g_game", "open", std::bind(&Game::open, &g_game, _1, _2)); - g_lua.bindClassStaticFunction("g_game", "openParent", std::bind(&Game::openParent, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "close", std::bind(&Game::close, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "look", std::bind(&Game::look, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "move", std::bind(&Game::move, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + g_lua.bindClassStaticFunction("g_game", "rotate", std::bind(&Game::rotate, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "use", std::bind(&Game::use, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "useWith", std::bind(&Game::useWith, &g_game, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_game", "useInventoryItem", std::bind(&Game::useInventoryItem, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "useInventoryItemWith", std::bind(&Game::useInventoryItemWith, &g_game, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_game", "open", std::bind(&Game::open, &g_game, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_game", "openParent", std::bind(&Game::openParent, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "close", std::bind(&Game::close, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "refreshContainer", std::bind(&Game::refreshContainer, &g_game)); - g_lua.bindClassStaticFunction("g_game", "attack", std::bind(&Game::attack, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "attack", std::bind(&Game::attack, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "cancelAttack", std::bind(&Game::cancelAttack, &g_game)); - g_lua.bindClassStaticFunction("g_game", "follow", std::bind(&Game::follow, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "follow", std::bind(&Game::follow, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "cancelFollow", std::bind(&Game::cancelFollow, &g_game)); g_lua.bindClassStaticFunction("g_game", "cancelAttackAndFollow", std::bind(&Game::cancelAttackAndFollow, &g_game)); - g_lua.bindClassStaticFunction("g_game", "talk", std::bind(&Game::talk, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "talkChannel", std::bind(&Game::talkChannel, &g_game, _1, _2, _3)); - g_lua.bindClassStaticFunction("g_game", "talkPrivate", std::bind(&Game::talkPrivate, &g_game, _1, _2, _3)); - g_lua.bindClassStaticFunction("g_game", "openPrivateChannel", std::bind(&Game::openPrivateChannel, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "talk", std::bind(&Game::talk, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "talkChannel", std::bind(&Game::talkChannel, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + g_lua.bindClassStaticFunction("g_game", "talkPrivate", std::bind(&Game::talkPrivate, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + g_lua.bindClassStaticFunction("g_game", "openPrivateChannel", std::bind(&Game::openPrivateChannel, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "requestChannels", std::bind(&Game::requestChannels, &g_game)); - g_lua.bindClassStaticFunction("g_game", "joinChannel", std::bind(&Game::joinChannel, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "leaveChannel", std::bind(&Game::leaveChannel, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "joinChannel", std::bind(&Game::joinChannel, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "leaveChannel", std::bind(&Game::leaveChannel, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "closeNpcChannel", std::bind(&Game::closeNpcChannel, &g_game)); g_lua.bindClassStaticFunction("g_game", "openOwnChannel", std::bind(&Game::openOwnChannel, &g_game)); - g_lua.bindClassStaticFunction("g_game", "inviteToOwnChannel", std::bind(&Game::inviteToOwnChannel, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "excludeFromOwnChannel", std::bind(&Game::excludeFromOwnChannel, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "partyInvite", std::bind(&Game::partyInvite, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "partyJoin", std::bind(&Game::partyJoin, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "partyRevokeInvitation", std::bind(&Game::partyRevokeInvitation, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "partyPassLeadership", std::bind(&Game::partyPassLeadership, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "inviteToOwnChannel", std::bind(&Game::inviteToOwnChannel, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "excludeFromOwnChannel", std::bind(&Game::excludeFromOwnChannel, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "partyInvite", std::bind(&Game::partyInvite, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "partyJoin", std::bind(&Game::partyJoin, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "partyRevokeInvitation", std::bind(&Game::partyRevokeInvitation, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "partyPassLeadership", std::bind(&Game::partyPassLeadership, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "partyLeave", std::bind(&Game::partyLeave, &g_game)); - g_lua.bindClassStaticFunction("g_game", "partyShareExperience", std::bind(&Game::partyShareExperience, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "partyShareExperience", std::bind(&Game::partyShareExperience, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "requestOutfit", std::bind(&Game::requestOutfit, &g_game)); - g_lua.bindClassStaticFunction("g_game", "changeOutfit", std::bind(&Game::changeOutfit, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "addVip", std::bind(&Game::addVip, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "removeVip", std::bind(&Game::removeVip, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "setChaseMode", std::bind(&Game::setChaseMode, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "setFightMode", std::bind(&Game::setFightMode, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "setSafeFight", std::bind(&Game::setSafeFight, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "changeOutfit", std::bind(&Game::changeOutfit, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "addVip", std::bind(&Game::addVip, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "removeVip", std::bind(&Game::removeVip, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "setChaseMode", std::bind(&Game::setChaseMode, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "setFightMode", std::bind(&Game::setFightMode, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "setSafeFight", std::bind(&Game::setSafeFight, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "getChaseMode", std::bind(&Game::getChaseMode, &g_game)); g_lua.bindClassStaticFunction("g_game", "getFightMode", std::bind(&Game::getFightMode, &g_game)); g_lua.bindClassStaticFunction("g_game", "isSafeFight", std::bind(&Game::isSafeFight, &g_game)); - g_lua.bindClassStaticFunction("g_game", "inspectNpcTrade", std::bind(&Game::inspectNpcTrade, &g_game, _1)); - g_lua.bindClassStaticFunction("g_game", "buyItem", std::bind(&Game::buyItem, &g_game, _1, _2, _3, _4)); - g_lua.bindClassStaticFunction("g_game", "sellItem", std::bind(&Game::sellItem, &g_game, _1, _2, _3)); + g_lua.bindClassStaticFunction("g_game", "inspectNpcTrade", std::bind(&Game::inspectNpcTrade, &g_game, std::placeholders::_1)); + g_lua.bindClassStaticFunction("g_game", "buyItem", std::bind(&Game::buyItem, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4)); + g_lua.bindClassStaticFunction("g_game", "sellItem", std::bind(&Game::sellItem, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); g_lua.bindClassStaticFunction("g_game", "closeNpcTrade", std::bind(&Game::closeNpcTrade, &g_game)); - g_lua.bindClassStaticFunction("g_game", "requestTrade", std::bind(&Game::requestTrade, &g_game, _1, _2)); - g_lua.bindClassStaticFunction("g_game", "inspectTrade", std::bind(&Game::inspectTrade, &g_game, _1, _2)); + g_lua.bindClassStaticFunction("g_game", "requestTrade", std::bind(&Game::requestTrade, &g_game, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_game", "inspectTrade", std::bind(&Game::inspectTrade, &g_game, std::placeholders::_1, std::placeholders::_2)); g_lua.bindClassStaticFunction("g_game", "acceptTrade", std::bind(&Game::acceptTrade, &g_game)); g_lua.bindClassStaticFunction("g_game", "rejectTrade", std::bind(&Game::rejectTrade, &g_game)); - g_lua.bindClassStaticFunction("g_game", "editText", std::bind(&Game::editText, &g_game, _1, _2)); - g_lua.bindClassStaticFunction("g_game", "editList", std::bind(&Game::editList, &g_game, _1, _2, _3)); + g_lua.bindClassStaticFunction("g_game", "editText", std::bind(&Game::editText, &g_game, std::placeholders::_1, std::placeholders::_2)); + g_lua.bindClassStaticFunction("g_game", "editList", std::bind(&Game::editList, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); g_lua.bindClassStaticFunction("g_game", "requestQuestLog", std::bind(&Game::requestQuestLog, &g_game)); - g_lua.bindClassStaticFunction("g_game", "requestQuestLine", std::bind(&Game::requestQuestLine, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "requestQuestLine", std::bind(&Game::requestQuestLine, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "canPerformGameAction", std::bind(&Game::canPerformGameAction, &g_game)); g_lua.bindClassStaticFunction("g_game", "checkBotProtection", std::bind(&Game::checkBotProtection, &g_game)); g_lua.bindClassStaticFunction("g_game", "isOnline", std::bind(&Game::isOnline, &g_game)); g_lua.bindClassStaticFunction("g_game", "isDead", std::bind(&Game::isDead, &g_game)); g_lua.bindClassStaticFunction("g_game", "isAttacking", std::bind(&Game::isAttacking, &g_game)); g_lua.bindClassStaticFunction("g_game", "isFollowing", std::bind(&Game::isFollowing, &g_game)); - g_lua.bindClassStaticFunction("g_game", "getContainer", std::bind(&Game::getContainer, &g_game, _1)); + g_lua.bindClassStaticFunction("g_game", "getContainer", std::bind(&Game::getContainer, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "getContainers", std::bind(&Game::getContainers, &g_game)); g_lua.bindClassStaticFunction("g_game", "getAttackingCreature", std::bind(&Game::getAttackingCreature, &g_game)); g_lua.bindClassStaticFunction("g_game", "getFollowingCreature", std::bind(&Game::getFollowingCreature, &g_game));