Skip to content

Commit

Permalink
fixes to squash
Browse files Browse the repository at this point in the history
Signed-off-by: David Heidelberg <[email protected]>
  • Loading branch information
okias committed Feb 6, 2024
1 parent 92a6be1 commit 39eceb2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.9)

# Set policies up to 3.9 since we want to enable the IPO option
if(${CMAKE_VERSION} VERSION_LESS 3.9)
Expand Down Expand Up @@ -44,11 +44,12 @@ set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks")
set(BUILD_DOCUMENTATION TRUE CACHE BOOL "Build documentation")

set(ENABLE_LTO TRUE CACHE BOOL "Use Link Time Optimization")
set(DEFAULT_ENABLE_LTO TRUE)
# by default don't enable on Debug builds to get faster builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(ENABLE_LTO FALSE)
set(DEFAULT_ENABLE_LTO FALSE)
endif()
set(ENABLE_LTO ${DEFAULT_ENABLE_LTO} CACHE BOOL "Use Link Time Optimization")

set(DEFAULT_RUN_IN_PLACE FALSE)
if(WIN32)
Expand All @@ -72,7 +73,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
endif()

# CMake >= 3.9.0 supports LTO/IPO.
# FIXME: Windows build fails in multiple places to link, needs to be investigated.
if (ENABLE_LTO AND NOT WIN32)
include(CheckIPOSupported)
check_ipo_supported(RESULT lto_supported OUTPUT lto_output)
Expand Down
1 change: 1 addition & 0 deletions doc/compiling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ General options and their default values:
ENABLE_REDIS=ON - Build with libhiredis; Enables use of Redis map backend
ENABLE_SPATIAL=ON - Build with LibSpatial; Speeds up AreaStores
ENABLE_SOUND=ON - Build with OpenAL, libogg & libvorbis; in-game sounds
ENABLE_LTO=ON - Build with IPO/LTO optimizations (smaller and more efficient than regular build)
ENABLE_LUAJIT=ON - Build with LuaJIT (much faster than non-JIT Lua)
ENABLE_PROMETHEUS=OFF - Build with Prometheus metrics exporter (listens on tcp/30000 by default)
ENABLE_SYSTEM_GMP=ON - Use GMP from system (much faster than bundled mini-gmp)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/guiTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void GUITable::setTable(const TableOptions &options,
s32 colcount = columns.size();
assert(colcount >= 1);
// rowcount = ceil(cellcount / colcount) but use integer arithmetic
s32 rowcount = std::min(((u32)content.size() + colcount - 1) / colcount, (u32)INT_MAX);
s32 rowcount = std::min(((u32)content.size() + colcount - 1) / colcount, (u32)S32_MAX);
assert(rowcount >= 0);
// Append empty strings to content if there is an incomplete row
s32 cellcount = rowcount * colcount;
Expand Down
14 changes: 7 additions & 7 deletions src/script/lua_api/l_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,6 @@ int ModApiServer::l_get_player_information(lua_State *L)
return 1;
}

/*
Be careful not to introduce a depdendency on the connection to
the peer here. This function is >>REQUIRED<< to still be able to return
values even when the peer unexpectedly disappears.
Hence all the ConInfo values here are optional.
*/

ClientInfo info;
if (!server->getClientInfo(player->getPeerId(), info)) {
warningstream << FUNCTION_NAME << ": no client info?!" << std::endl;
Expand All @@ -198,6 +191,13 @@ int ModApiServer::l_get_player_information(lua_State *L)
}
lua_settable(L, table);

/*
Be careful not to introduce a depdendency on the connection to
the peer here. This function is >>REQUIRED<< to still be able to return
values even when the peer unexpectedly disappears.
Hence all the ConInfo values here are optional.
*/

auto getConInfo = [&] (con::rtt_stat_type type, float *value) -> bool {
return server->getClientConInfo(player->getPeerId(), type, value);
};
Expand Down

0 comments on commit 39eceb2

Please sign in to comment.