Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
Includes various MSVC fixes
  • Loading branch information
SmallJoker committed Oct 21, 2023
1 parent bc5b9d7 commit 55bf795
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ make.sh
# Other files
*.eelvl
*.log
*.zip
*.7z
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")

# Skip unnecessary headers
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /D WIN32_LEAN_AND_MEAN /D NOCOMM")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /MP /D WIN32_LEAN_AND_MEAN /D NOCOMM")
set(CMAKE_CXX_FLAGS_RELEASE "/Ox /MD /EHa /D NDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "/Od /MDd /RTC1")

else()
# -fsanitize=address,undefined
# -O3 is default for release
Expand Down Expand Up @@ -135,7 +134,6 @@ target_link_libraries(
${PROJECT_NAME}
${ENet_LIBRARY}
Threads::Threads
stdc++fs
)

if(BUILD_CLIENT)
Expand All @@ -153,7 +151,7 @@ if(MSVC)
# For ENet
target_link_libraries(${PROJECT_NAME} ws2_32.lib winmm.lib)
else()
target_link_libraries(${PROJECT_NAME} SQLite::SQLite3)
target_link_libraries(${PROJECT_NAME} stdc++fs SQLite::SQLite3)
endif()


Expand Down
21 changes: 14 additions & 7 deletions misc/pack.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/usr/bin/env sh
# To be executed in a separate directory for packing

# change me if needed
GAMEDIR="$PWD/OpenEdits"

# ----------------

set -e

ostype=""
binary="OpenEdits"
case "$OSTYPE" in
darwin*) ostype="macOS" ;;
linux*) ostype="Linux" ;;
Expand All @@ -12,20 +19,20 @@ case "$OSTYPE" in
esac

[ -z "$ostype" ] && echo "Unhandled platform." && exit 1


DIR="$PWD/build/OpenEdits"
[ "$ostype" = "Windows" ] && binary="OpenEdits.exe"

echo "--- Removing testing files"
rm -f "$DIR"/*.sqlite
rm -f "$DIR/client_servers.txt"
rm -vf "$GAMEDIR"/*.sqlite*
rm -vf "$GAMEDIR/client_servers.txt"
rm -vrf "$GAMEDIR/worlds"

# zipping
version=$(strings "$DIR/OpenEdits" | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]+[^ ]*")
version=$(grep -Eoa "v[0-9]+\.[0-9]+\.[0-9]+[^ ]*" "$GAMEDIR/$binary")
#version=$(strings "$GAMEDIR/$binary" | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]+[^ ]*")
zipfile="OpenEdits-$version-$ostype-x86_64.7z"

rm -f "$zipfile" # old archive
7z a -t7z -scrcSHA1 "$zipfile" "$DIR"
7z a -t7z -scrcSHA1 "$zipfile" "$GAMEDIR"

echo ""
echo "--- sha256 checksum"
Expand Down
4 changes: 2 additions & 2 deletions src/core/compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct InflateWriter {
case Z_DATA_ERROR:
case Z_MEM_ERROR:
case Z_STREAM_ERROR:
ERRORLOG("zlib: error code %d, message: %s, near index 0x%04zX\n",
ERRORLOG("zlib: error code %d, message: %s, near index 0x%04lX\n",
status, m_zs.msg ? m_zs.msg : "NULL", m_zs.total_in);
throw std::runtime_error("zlib: inflate error");
}
Expand Down Expand Up @@ -259,7 +259,7 @@ struct DeflateReader {
case Z_MEM_ERROR:
case Z_STREAM_ERROR:
//ERRORLOG("Got Adler %08lX\n", m_zs.adler);
ERRORLOG("zlib: error code %d, message: %s, near index 0x%04zX\n",
ERRORLOG("zlib: error code %d, message: %s, near index 0x%04lX\n",
status, m_zs.msg ? m_zs.msg : "NULL", m_zs.total_out);
throw std::runtime_error("zlib: inflate error");
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void Packet::writeRaw(const uint8_t *data, size_t nbytes)

size_t Packet::readRawNoCopy(const uint8_t **data, size_t nbytes)
{
nbytes = std::min(nbytes, getRemainingBytes());
nbytes = std::min<size_t>(nbytes, getRemainingBytes());

*data = &m_data->data[m_read_offset];
m_read_offset += nbytes;
Expand Down
9 changes: 6 additions & 3 deletions src/core/playerflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,25 @@ struct PlayerFlags {
PF_NONE = 0,

// Temporary world-specific flags
PF_MASK_TMP = 0x000000FF,
// Max. mask: 0x000000FF
PF_MUTED = 0x00000001,
PF_EDIT = 0x00000002,
PF_EDIT_DRAW = 0x00000004 | PF_EDIT,
PF_GODMODE = 0x00000010,
PF_MASK_TMP = PF_MUTED | PF_EDIT_DRAW | PF_GODMODE,

// Persistent world-wide roles
PF_MASK_WORLD = 0x0000FF00,
// Max. mask: 0x000FF000
PF_COLLAB = 0x00001000,
PF_COOWNER = 0x00004000,
PF_OWNER = 0x00008000, // there can only be one
PF_MASK_WORLD = PF_COLLAB | PF_COOWNER | PF_OWNER,

// Persistent server-wide roles
PF_MASK_SERVER = 0x00FF0000,
// Max. mask: 0x00FF0000
PF_MODERATOR = 0x00200000,
PF_ADMIN = 0x00800000,
PF_MASK_SERVER = PF_MODERATOR | PF_ADMIN,

// Information relevant to others
PF_MASK_SEND_OTHERS = PF_MASK_WORLD | PF_MASK_SERVER,
Expand Down
2 changes: 1 addition & 1 deletion src/gui/connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ bool SceneConnect::OnEvent(const SEvent &e)
int index;
try {
index = listbox->getSelected();
m_index_to_address.at(index); // valid?
(void)m_index_to_address.at(index); // valid?
} catch (std::exception &) {
break;
}
Expand Down
14 changes: 7 additions & 7 deletions src/server/eeo_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,18 +604,19 @@ void EEOconverter::listImportableWorlds(std::map<std::string, LobbyWorld> &world
if (!is_path_ok(entry))
continue;

std::string path = entry.path().u8string();
LobbyWorld meta;
try {
Packet pkt;
decompress_file(pkt, entry.path());
decompress_file(pkt, path);
read_eelvl_header(pkt, meta);
} catch (std::runtime_error &e) {
DEBUGLOG("Cannot read '%s': %s\n", entry.path().c_str(), e.what());
DEBUGLOG("Cannot read '%s': %s\n", path.c_str(), e.what());
continue;
}

meta.id = path_to_worldid(entry.path());
worlds[entry.path()] = meta;
meta.id = path_to_worldid(path);
worlds[path] = meta;
}
#endif
}
Expand All @@ -634,9 +635,8 @@ std::string EEOconverter::findWorldPath(const std::string &world_id)
if (!is_path_ok(entry))
continue;

if (world_id == path_to_worldid(entry.path())) {
return std::filesystem::relative(entry.path(), root);
}
if (world_id == path_to_worldid(entry.path().u8string()))
return std::filesystem::relative(entry.path(), root).u8string();
}

return "";
Expand Down
12 changes: 9 additions & 3 deletions src/server/server_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ CHATCMD_FUNC(Server::chat_Save)

auto world = player->getWorld();

if (world->getMeta().type != WorldMeta::Type::Persistent) {
systemChatSend(player, "This world cannot be saved.");
return;
}

if (!player->getFlags().check(PlayerFlags::PF_OWNER)) {
systemChatSend(player, "Insufficient permissions");
return;
Expand All @@ -776,9 +781,10 @@ CHATCMD_FUNC(Server::chat_Save)
m_auth_db->ban(entry);
}

m_world_db->save(world.get());

systemChatSend(player, "Saved!");
if (m_world_db->save(world.get()))
systemChatSend(player, "Saved!");
else
systemChatSend(player, "Failed to save (server error)");
}

CHATCMD_FUNC(Server::chat_Title)
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

const char *VERSION_STRING = "OpenEdits v1.0.9-${GIT_SHA1} (${CMAKE_BUILD_TYPE})";
const char *VERSION_STRING = "OpenEdits v1.1.0-${GIT_SHA1} (${CMAKE_BUILD_TYPE})";

0 comments on commit 55bf795

Please sign in to comment.