[C++20] Enable C++20 + Fixes + FMT 9.1 (#2664)

* [CPP] Enable and build compliance with cpp20

* Windows build fix

* bump fmt version

* Updated fmt to 9.1, updated cmake minimum and verified preprocessor stuff works.

* Missing :

* Fix warning: top-level comma expression in array subscript is deprecated

* Fix warning: top-level comma expression in array subscript is deprecated

Co-authored-by: KimLS <KimLS@peqtgc.com>
This commit is contained in:
Chris Miles 2022-12-20 21:52:36 -06:00 committed by GitHub
parent db12c069ef
commit c236c57a2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 145 additions and 151 deletions

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.7)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
@ -12,7 +12,7 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(export_sources
main.cpp

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(import_sources
main.cpp

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(common_sources
base_packet.cpp

View File

@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@ -41,7 +41,7 @@ namespace EQ
MemoryBuffer& operator+=(const MemoryBuffer &rhs);
friend MemoryBuffer operator+(MemoryBuffer lhs, const MemoryBuffer& rhs) { return lhs += rhs; }
~MemoryBuffer();
uchar& operator[](size_t pos);
const uchar& operator[](size_t pos) const;
@ -64,20 +64,20 @@ namespace EQ
size_t Size() const;
size_t Capacity();
size_t Capacity() const;
void Resize(size_t sz);
void Clear();
void Zero();
template<typename T>
void Write(T val) {
static_assert(std::is_pod<T>::value, "MemoryBuffer::Write<T>(T val) only works on pod and string types.");
static_assert(std::is_standard_layout<T>::value, "MemoryBuffer::Write<T>(T val) only works on pod and string types.");
Write((const char*)&val, sizeof(T));
}
template<typename T>
T Read() {
static_assert(std::is_pod<T>::value, "MemoryBuffer::Read<T>() only works on pod and string types.");
static_assert(std::is_standard_layout<T>::value, "MemoryBuffer::Read<T>() only works on pod and string types.");
T temp;
Read((uchar*)&temp, sizeof(T));
return temp;
@ -102,7 +102,7 @@ namespace EQ
read_pos_ += len + 1;
return ret;
}
void Write(const char *val, size_t len);
void Read(uchar *buf, size_t len);
void Read(char *str);
@ -113,7 +113,7 @@ namespace EQ
inline size_t GetReadPosition() { return read_pos_; }
inline void SetReadPosition(size_t rp) { read_pos_ = rp; }
inline void ReadSkipBytes(size_t skip) { read_pos_ += skip; }
private:
uchar *buffer_;
size_t size_;

View File

@ -75,8 +75,6 @@ public:
Database& db, const std::vector<uint32_t>& character_ids,
const std::string& expedition_name, const std::string& ordered_event_name)
{
auto joined_character_ids = fmt::join(character_ids, ",");
auto results = db.QueryDatabase(fmt::format(SQL(
SELECT
character_id,
@ -93,9 +91,9 @@ public:
FIELD(character_id, {}),
FIELD(event_name, '{}') DESC
),
joined_character_ids,
fmt::join(character_ids, ","),
Strings::Escape(expedition_name),
joined_character_ids,
fmt::join(character_ids, ","),
Strings::Escape(ordered_event_name)
));

View File

@ -44,9 +44,10 @@
#include <tuple>
#include <type_traits>
#include <fmt/format.h>
#ifndef _WIN32
// this doesn't appear to affect linux-based systems..need feedback for _WIN64
#include <fmt/format.h>
#endif

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(eqlaunch_sources
eqlaunch.cpp

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(lb_sources
src/class.cpp

View File

@ -33,7 +33,7 @@ namespace luabind
LUABIND_API class_info get_class_info(argument const& o)
{
lua_State* L = o.interpreter();
o.push(L);
detail::object_rep* obj = detail::get_instance(L, -1);
@ -106,15 +106,15 @@ namespace luabind
LUABIND_API void bind_class_info(lua_State* L)
{
module(L)
[
[(
class_<class_info>("class_info_data")
.def_readonly("name", &class_info::name)
.def_readonly("methods", &class_info::methods)
.def_readonly("attributes", &class_info::attributes),
def("class_info", &get_class_info),
def("class_names", &get_class_names)
];
)];
}
}

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(eqlogin_sources
account_management.cpp

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(qserv_sources
database.cpp

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(shared_memory_sources
base_data.cpp

@ -1 +1 @@
Subproject commit 9e554999ce02cf86fcdfe74fe740c4fe3f5a56d5
Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50

View File

@ -1,5 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(ucs_sources
chatchannel.cpp
clientlist.cpp

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(world_sources
adventure.cpp

View File

@ -989,7 +989,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) {
uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer);
if(char_acct_id == GetAccountID()) {
LogInfo("Delete character: [{}]", app->pBuffer);
LogInfo("Delete character: [{}]", (const char*)app->pBuffer);
database.DeleteCharacter((char *)app->pBuffer);
SendCharInfo();
}

View File

@ -319,7 +319,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
strcpy(newline, "\r\n");
else
strcpy(newline, "^");
fmt::memory_buffer out;
std::vector<char> out;
iterator.Reset();
while(iterator.MoreElements()) {
@ -328,22 +328,21 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
struct in_addr in;
in.s_addr = cle->GetIP();
if (addnewline) {
fmt::format_to(out, newline);
fmt::format_to(std::back_inserter(out), fmt::runtime(newline));
}
fmt::format_to(out, "ID: {} Acc# {} AccName: {} IP: {}", cle->GetID(), cle->AccountID(), cle->AccountName(), inet_ntoa(in));
fmt::format_to(out, "{} Stale: {} Online: {} Admin: {}", newline, cle->GetStaleCounter(), cle->Online(), cle->Admin());
fmt::format_to(std::back_inserter(out), "ID: {} Acc# {} AccName: {} IP: {}", cle->GetID(), cle->AccountID(), cle->AccountName(), inet_ntoa(in));
fmt::format_to(std::back_inserter(out), "{} Stale: {} Online: {} Admin: {}", newline, cle->GetStaleCounter(), cle->Online(), cle->Admin());
if (cle->LSID())
fmt::format_to(out, "{} LSID: {} LSName: {} WorldAdmin: {}", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin());
fmt::format_to(std::back_inserter(out), "{} LSID: {} LSName: {} WorldAdmin: {}", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin());
if (cle->CharID())
fmt:format_to(out, "{} CharID: {} CharName: {} Zone: {} ({})", newline, cle->CharID(), cle->name(), ZoneName(cle->zone()), cle->zone());
fmt::format_to(std::back_inserter(out), "{} CharID: {} CharName: {} Zone: {} ({})", newline, cle->CharID(), cle->name(), ZoneName(cle->zone()), cle->zone());
if (out.size() >= 3072) {
auto output = fmt::to_string(out);
connection->SendEmoteMessageRaw(
to,
0,
AccountStatus::Player,
Chat::NPCQuestSay,
output.c_str()
out.data()
);
addnewline = false;
out.clear();
@ -355,14 +354,13 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
iterator.Advance();
x++;
}
fmt::format_to(out, "{}{} CLEs in memory. {} CLEs listed. numplayers = {}.", newline, x, y, numplayers);
auto output = fmt::to_string(out);
fmt::format_to(std::back_inserter(out), "{}{} CLEs in memory. {} CLEs listed. numplayers = {}.", newline, x, y, numplayers);
connection->SendEmoteMessageRaw(
to,
0,
AccountStatus::Player,
Chat::NPCQuestSay,
output.c_str()
out.data()
);
}
@ -1061,12 +1059,12 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
if (whom)
whomlen = strlen(whom->whom);
fmt::memory_buffer out;
fmt::format_to(out, "Players on server:");
std::vector<char> out;
fmt::format_to(std::back_inserter(out), "Players on server:");
if (connection->IsConsole())
fmt::format_to(out, "\r\n");
fmt::format_to(std::back_inserter(out), "\r\n");
else
fmt::format_to(out, "\n");
fmt::format_to(std::back_inserter(out), "\n");
iterator.Reset();
while (iterator.MoreElements()) {
cle = iterator.GetData();
@ -1162,23 +1160,22 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
else
sprintf(line, " %s[%i %s] %s (%s)%s zone: %s%s%s", tmpgm, cle->level(), GetClassIDName(cle->class_(), cle->level()), cle->name(), GetRaceIDName(cle->race()), tmpguild, tmpZone, LFG, accinfo);
fmt::format_to(out, line);
fmt::format_to(std::back_inserter(out), fmt::runtime(line));
if (out.size() >= 3584) {
auto output = fmt::to_string(out);
connection->SendEmoteMessageRaw(
to,
0,
AccountStatus::Player,
Chat::NPCQuestSay,
output.c_str()
out.data()
);
out.clear();
}
else {
if (connection->IsConsole())
fmt::format_to(out, "\r\n");
fmt::format_to(std::back_inserter(out), "\r\n");
else
fmt::format_to(out, "\n");
fmt::format_to(std::back_inserter(out), "\n");
}
x++;
if (x >= 20 && admin < AccountStatus::QuestTroupe)
@ -1188,24 +1185,24 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
}
if (x >= 20 && admin < AccountStatus::QuestTroupe)
fmt::format_to(out, "too many results...20 players shown");
fmt::format_to(std::back_inserter(out), "too many results...20 players shown");
else
fmt::format_to(out, "{} players online", x);
fmt::format_to(std::back_inserter(out), "{} players online", x);
if (admin >= AccountStatus::GMAdmin && (whom == 0 || whom->gmlookup != 0xFFFF)) {
if (connection->IsConsole())
fmt::format_to(out, "\r\n");
fmt::format_to(std::back_inserter(out), "\r\n");
else
fmt::format_to(out, "\n");
fmt::format_to(std::back_inserter(out), "\n");
//console_list.SendConsoleWho(connection, to, admin, &output, &outsize, &outlen);
}
auto output = fmt::to_string(out);
connection->SendEmoteMessageRaw(
to,
0,
AccountStatus::Player,
Chat::NPCQuestSay,
output.c_str()
out.data()
);
}

View File

@ -60,9 +60,8 @@ void ExpeditionDatabase::PurgeExpiredExpeditions()
if (!expedition_ids.empty())
{
auto joined_expedition_ids = fmt::join(expedition_ids, ",");
ExpeditionsRepository::DeleteWhere(database, fmt::format("id IN ({})", joined_expedition_ids));
ExpeditionLockoutsRepository::DeleteWhere(database, fmt::format("expedition_id IN ({})", joined_expedition_ids));
ExpeditionsRepository::DeleteWhere(database, fmt::format("id IN ({})", fmt::join(expedition_ids, ",")));
ExpeditionLockoutsRepository::DeleteWhere(database, fmt::format("expedition_id IN ({})", fmt::join(expedition_ids, ",")));
DynamicZoneMembersRepository::RemoveAllMembers(database, dynamic_zone_ids);
}
}

View File

@ -311,19 +311,19 @@ void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* con
strcpy(locked, "No");
}
fmt::memory_buffer out;
std::vector<char> out;
if (connection->IsConsole()) {
fmt::format_to(out, "World Locked: {}\r\n", locked);
fmt::format_to(std::back_inserter(out), "World Locked: {}\r\n", locked);
}
else {
fmt::format_to(out, "World Locked: {}^", locked);
fmt::format_to(std::back_inserter(out), "World Locked: {}^", locked);
}
if (connection->IsConsole()) {
fmt::format_to(out, "Zoneservers online:\r\n");
fmt::format_to(std::back_inserter(out), "Zoneservers online:\r\n");
}
else {
fmt::format_to(out, "Zoneservers online:^");
fmt::format_to(std::back_inserter(out), "Zoneservers online:^");
}
int v = 0, w = 0, x = 0, y = 0, z = 0;
@ -363,7 +363,7 @@ void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* con
zone_data_string[0] = 0;
}
fmt::format_to(out,
fmt::format_to(std::back_inserter(out),
"#{:<3} :: {} :: {}:{:<5} :: {:2} :: {}:{} :: {} :: ({})",
zone_server_data->GetID(),
is_static_string,
@ -377,21 +377,20 @@ void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* con
);
if (out.size() >= 3584) {
auto output = fmt::to_string(out);
connection->SendEmoteMessageRaw(
to,
0,
AccountStatus::Player,
Chat::NPCQuestSay,
output.c_str()
out.data()
);
out.clear();
}
else {
if (connection->IsConsole())
fmt::format_to(out, "\r\n");
fmt::format_to(std::back_inserter(out), "\r\n");
else
fmt::format_to(out, "^");
fmt::format_to(std::back_inserter(out), "^");
}
x++;
}
@ -400,24 +399,23 @@ void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* con
strcpy(zone_data_string, zone_server_data->GetZoneName());
else
zone_data_string[0] = 0;
fmt::format_to(out, " #{} {} {}", zone_server_data->GetID(), is_static_string, zone_data_string);
fmt::format_to(std::back_inserter(out), " #{} {} {}", zone_server_data->GetID(), is_static_string, zone_data_string);
if (out.size() >= 3584) {
auto output = fmt::to_string(out);
connection->SendEmoteMessageRaw(
to,
0,
AccountStatus::Player,
Chat::NPCQuestSay,
output.c_str()
out.data()
);
out.clear();
}
else {
if (connection->IsConsole()) {
fmt::format_to(out, "\r\n");
fmt::format_to(std::back_inserter(out), "\r\n");
}
else {
fmt::format_to(out, "^");
fmt::format_to(std::back_inserter(out), "^");
}
}
x++;
@ -427,21 +425,20 @@ void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* con
}
if (connection->IsConsole()) {
fmt::format_to(out, "{} servers listed. {} servers online.\r\n", x, y);
fmt::format_to(std::back_inserter(out), "{} servers listed. {} servers online.\r\n", x, y);
}
else {
fmt::format_to(out, "{} servers listed. {} servers online.^", x, y);
fmt::format_to(std::back_inserter(out), "{} servers listed. {} servers online.^", x, y);
}
fmt::format_to(out, "{} zones are static zones, {} zones are booted zones, {} zones available.", z, w, v);
fmt::format_to(std::back_inserter(out), "{} zones are static zones, {} zones are booted zones, {} zones available.", z, w, v);
auto output = fmt::to_string(out);
connection->SendEmoteMessageRaw(
to,
0,
AccountStatus::Player,
Chat::NPCQuestSay,
output.c_str()
out.data()
);
}

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
SET(zone_sources
aa.cpp

View File

@ -43,7 +43,7 @@ void EntityList::DescribeAggro(Client *to_who, NPC *from_who, float d, bool verb
to_who->Message(
Chat::White,
fmt::format(
"Describing aggro for {} ({}).",
"Describing aggro for {}.",
to_who->GetTargetDescription(from_who)
).c_str()
);

View File

@ -42,7 +42,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
std::string export_string = fmt::format(
"{} {} {}",
position1.x,
@ -71,7 +71,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
std::string export_string = fmt::format(
"{} {} {}",
position1.x,
@ -97,7 +97,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
}
break;
case MQWarpKnockBack:
@ -115,7 +115,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
}
break;
@ -135,7 +135,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
}
}
break;
@ -155,7 +155,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
}
break;
case MQZoneUnknownDest:
@ -173,7 +173,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
}
break;
case MQGate:
@ -191,7 +191,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
}
break;
case MQGhost:
@ -228,7 +228,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
}
break;
default:
@ -244,7 +244,7 @@ void CheatManager::CheatDetected(CheatTypes type, glm::vec3 position1, glm::vec3
message.c_str(),
zone->GetShortName()
);
LogCheat(message);
LogCheat(fmt::runtime(message));
break;
}
}

View File

@ -3661,7 +3661,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app)
return;
}
else {
LogTrading("Malformed BazaarSearch_Struct packe, Action [{}]t received, ignoring");
LogTrading("Malformed BazaarSearch_Struct packet received, ignoring");
LogError("Malformed BazaarSearch_Struct packet received, ignoring\n");
}

View File

@ -27,9 +27,6 @@
extern WorldServer worldserver;
// message string 8312 added in September 08 2020 Test patch (used by both dz and shared tasks)
const char* const CREATE_NOT_ALL_ADDED = "Not all players in your {} were added to the {}. The {} can take a maximum of {} players, and your {} has {}.";
DynamicZone::DynamicZone(
uint32_t zone_id, uint32_t version, uint32_t duration, DynamicZoneType type)
{

View File

@ -32,8 +32,6 @@ class Database;
class EQApplicationPacket;
class ServerPacket;
extern const char* const CREATE_NOT_ALL_ADDED;
class DynamicZone : public DynamicZoneBase
{
public:

View File

@ -35,8 +35,6 @@ extern Zone* zone;
// message string 8271 (not in emu clients)
const char* const DZ_YOU_NOT_ASSIGNED = "You could not use this command because you are not currently assigned to a dynamic zone.";
// message string 9265 (not in emu clients)
const char* const EXPEDITION_OTHER_BELONGS = "{} attempted to create an expedition but {} already belongs to one.";
// lockout warnings were added to live in March 11 2020 patch
const char* const DZADD_INVITE_WARNING = "Warning! You will be given replay timers for the following events if you enter %s:";
const char* const DZADD_INVITE_WARNING_TIMER = "%s - %sD:%sH:%sM";
@ -47,6 +45,12 @@ constexpr char LOCK_BEGIN[] = "The trial has begun. You cannot
const int32_t Expedition::REPLAY_TIMER_ID = -1;
const int32_t Expedition::EVENT_TIMER_ID = 1;
Expedition::Expedition(DynamicZone* dz) :
m_dynamic_zone(dz)
{
assert(m_dynamic_zone != nullptr);
}
Expedition::Expedition(DynamicZone* dz, uint32_t id, uint32_t dz_id) :
m_dynamic_zone(dz),
m_id(id),

View File

@ -37,7 +37,6 @@ class ExpeditionRequest;
class ServerPacket;
extern const char* const DZ_YOU_NOT_ASSIGNED;
extern const char* const EXPEDITION_OTHER_BELONGS;
enum class ExpeditionLockMessage : uint8_t
{
@ -50,7 +49,7 @@ class Expedition
{
public:
Expedition() = delete;
Expedition(DynamicZone* dz) : m_dynamic_zone(dz) { assert(m_dynamic_zone != nullptr); }
Expedition(DynamicZone* dz);
Expedition(DynamicZone* dz, uint32_t id, uint32_t dz_id);
static Expedition* TryCreate(Client* requester, DynamicZone& dynamiczone, bool disable_messages);

View File

@ -30,6 +30,11 @@
constexpr char SystemName[] = "expedition";
// message string 8312 added in September 08 2020 Test patch (used by both dz and shared tasks)
constexpr const char* CREATE_NOT_ALL_ADDED = "Not all players in your {} were added to the {}. The {} can take a maximum of {} players, and your {} has {}.";
// message string 9265 (not in emu clients)
constexpr const char* EXPEDITION_OTHER_BELONGS = "{} attempted to create an expedition but {} already belongs to one.";
ExpeditionRequest::ExpeditionRequest(const DynamicZone& dz, bool disable_messages) :
m_expedition_name(dz.GetName()),
m_min_players(dz.GetMinPlayers()),

View File

@ -73,7 +73,7 @@ void command_rules(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Rule Set {} | {} ({})",
"Rule Set {} ({})",
e.second,
e.first
).c_str()

View File

@ -65,7 +65,7 @@ void command_zonelock(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Usage: #zonelock {} [Zone ID] or #zonelock {} [Zone Short Name]",
"Usage: #zonelock {0} [Zone ID] or #zonelock {0} [Zone Short Name]",
is_lock ? "lock" : "unlock"
).c_str()
);

View File

@ -3506,13 +3506,13 @@ luabind::scope lua_register_client() {
luabind::scope lua_register_inventory_where() {
return luabind::class_<InventoryWhere>("InventoryWhere")
.enum_("constants")
[
[(
luabind::value("Personal", static_cast<int>(invWherePersonal)),
luabind::value("Bank", static_cast<int>(invWhereBank)),
luabind::value("SharedBank", static_cast<int>(invWhereSharedBank)),
luabind::value("Trading", static_cast<int>(invWhereTrading)),
luabind::value("Cursor", static_cast<int>(invWhereCursor))
];
)];
}

View File

@ -284,11 +284,11 @@ luabind::scope lua_register_expedition() {
luabind::scope lua_register_expedition_lock_messages() {
return luabind::class_<ExpeditionLockMessage>("ExpeditionLockMessage")
.enum_("constants")
[
[(
luabind::value("None", static_cast<int>(ExpeditionLockMessage::None)),
luabind::value("Close", static_cast<int>(ExpeditionLockMessage::Close)),
luabind::value("Begin", static_cast<int>(ExpeditionLockMessage::Begin))
];
)];
}
#endif // LUA_EQEMU

View File

@ -3836,7 +3836,7 @@ bool get_ruleb(int rule) {
luabind::scope lua_register_general() {
return luabind::namespace_("eq")
[
[(
luabind::def("load_encounter", &load_encounter),
luabind::def("unload_encounter", &unload_encounter),
luabind::def("load_encounter_with_data", &load_encounter_with_data),
@ -4449,25 +4449,25 @@ luabind::scope lua_register_general() {
luabind::def("remove_expedition_lockout_by_char_id", &lua_remove_expedition_lockout_by_char_id),
luabind::def("remove_all_expedition_lockouts_by_char_id", (void(*)(uint32))&lua_remove_all_expedition_lockouts_by_char_id),
luabind::def("remove_all_expedition_lockouts_by_char_id", (void(*)(uint32, std::string))&lua_remove_all_expedition_lockouts_by_char_id)
];
)];
}
luabind::scope lua_register_random() {
return luabind::namespace_("Random")
[
[(
luabind::def("Int", &random_int),
luabind::def("Real", &random_real),
luabind::def("Roll", &random_roll_int),
luabind::def("RollReal", &random_roll_real),
luabind::def("Roll0", &random_roll0)
];
)];
}
luabind::scope lua_register_events() {
return luabind::class_<Events>("Event")
.enum_("constants")
[
[(
luabind::value("say", static_cast<int>(EVENT_SAY)),
luabind::value("trade", static_cast<int>(EVENT_TRADE)),
luabind::value("death", static_cast<int>(EVENT_DEATH)),
@ -4566,13 +4566,13 @@ luabind::scope lua_register_events() {
luabind::value("payload", static_cast<int>(EVENT_PAYLOAD)),
luabind::value("level_down", static_cast<int>(EVENT_LEVEL_DOWN)),
luabind::value("gm_command", static_cast<int>(EVENT_GM_COMMAND))
];
)];
}
luabind::scope lua_register_faction() {
return luabind::class_<Factions>("Faction")
.enum_("constants")
[
[(
luabind::value("Ally", static_cast<int>(FACTION_ALLY)),
luabind::value("Warmly", static_cast<int>(FACTION_WARMLY)),
luabind::value("Kindly", static_cast<int>(FACTION_KINDLY)),
@ -4582,13 +4582,13 @@ luabind::scope lua_register_faction() {
luabind::value("Dubious", static_cast<int>(FACTION_DUBIOUSLY)),
luabind::value("Threatenly", static_cast<int>(FACTION_THREATENINGLY)),
luabind::value("Scowls", static_cast<int>(FACTION_SCOWLS))
];
)];
}
luabind::scope lua_register_slot() {
return luabind::class_<Slots>("Slot")
.enum_("constants")
[
[(
luabind::value("Charm", static_cast<int>(EQ::invslot::slotCharm)),
luabind::value("Ear1", static_cast<int>(EQ::invslot::slotEar1)),
luabind::value("Head", static_cast<int>(EQ::invslot::slotHead)),
@ -4679,13 +4679,13 @@ luabind::scope lua_register_slot() {
luabind::value("PersonalBegin", static_cast<int>(EQ::invslot::GENERAL_BEGIN)), // deprecated
luabind::value("PersonalEnd", static_cast<int>(EQ::invslot::GENERAL_END)), // deprecated
luabind::value("CursorEnd", 0xFFFE) // deprecated (not in use..and never valid vis-a-vis client behavior)
];
)];
}
luabind::scope lua_register_material() {
return luabind::class_<Materials>("Material")
.enum_("constants")
[
[(
luabind::value("Head", static_cast<int>(EQ::textures::armorHead)),
luabind::value("Chest", static_cast<int>(EQ::textures::armorChest)),
luabind::value("Arms", static_cast<int>(EQ::textures::armorArms)),
@ -4700,13 +4700,13 @@ luabind::scope lua_register_material() {
luabind::value("Bracer", static_cast<int>(EQ::textures::armorWrist)), // deprecated
luabind::value("Max", static_cast<int>(EQ::textures::materialCount)) // deprecated
];
)];
}
luabind::scope lua_register_client_version() {
return luabind::class_<ClientVersions>("ClientVersion")
.enum_("constants")
[
[(
luabind::value("Unknown", static_cast<int>(EQ::versions::ClientVersion::Unknown)),
luabind::value("Titanium", static_cast<int>(EQ::versions::ClientVersion::Titanium)),
luabind::value("SoF", static_cast<int>(EQ::versions::ClientVersion::SoF)),
@ -4715,25 +4715,25 @@ luabind::scope lua_register_client_version() {
luabind::value("UF", static_cast<int>(EQ::versions::ClientVersion::UF)),
luabind::value("RoF", static_cast<int>(EQ::versions::ClientVersion::RoF)),
luabind::value("RoF2", static_cast<int>(EQ::versions::ClientVersion::RoF2))
];
)];
}
luabind::scope lua_register_appearance() {
return luabind::class_<Appearances>("Appearance")
.enum_("constants")
[
[(
luabind::value("Standing", static_cast<int>(eaStanding)),
luabind::value("Sitting", static_cast<int>(eaSitting)),
luabind::value("Crouching", static_cast<int>(eaCrouching)),
luabind::value("Dead", static_cast<int>(eaDead)),
luabind::value("Looting", static_cast<int>(eaLooting))
];
)];
}
luabind::scope lua_register_classes() {
return luabind::class_<Classes>("Class")
.enum_("constants")
[
[(
luabind::value("WARRIOR", WARRIOR),
luabind::value("CLERIC", CLERIC),
luabind::value("PALADIN", PALADIN),
@ -4779,13 +4779,13 @@ luabind::scope lua_register_classes() {
luabind::value("FELLOWSHIP_MASTER", FELLOWSHIP_MASTER),
luabind::value("ALT_CURRENCY_MERCHANT", ALT_CURRENCY_MERCHANT),
luabind::value("MERCENARY_MASTER", MERCENARY_MASTER)
];
)];
}
luabind::scope lua_register_skills() {
return luabind::class_<Skills>("Skill")
.enum_("constants")
[
[(
luabind::value("1HBlunt", EQ::skills::Skill1HBlunt),
luabind::value("Blunt1H", EQ::skills::Skill1HBlunt),
luabind::value("1HSlashing", EQ::skills::Skill1HSlashing),
@ -4872,13 +4872,13 @@ luabind::scope lua_register_skills() {
luabind::value("2HPiercing", EQ::skills::Skill2HPiercing),
luabind::value("Piercing2H", EQ::skills::Skill2HPiercing),
luabind::value("HIGHEST_SKILL", EQ::skills::HIGHEST_SKILL)
];
)];
}
luabind::scope lua_register_bodytypes() {
return luabind::class_<BodyTypes>("BT")
.enum_("constants")
[
[(
luabind::value("Humanoid", 1),
luabind::value("Lycanthrope", 2),
luabind::value("Undead", 3),
@ -4913,13 +4913,13 @@ luabind::scope lua_register_bodytypes() {
luabind::value("SwarmPet", 63),
luabind::value("InvisMan", 66),
luabind::value("Special", 67)
];
)];
}
luabind::scope lua_register_filters() {
return luabind::class_<Filters>("Filter")
.enum_("constants")
[
[(
luabind::value("None", FilterNone),
luabind::value("GuildChat", FilterGuildChat),
luabind::value("Socials", FilterSocials),
@ -4949,13 +4949,13 @@ luabind::scope lua_register_filters() {
luabind::value("Unknown26", FilterUnknown26),
luabind::value("Unknown27", FilterUnknown27),
luabind::value("Unknown28", FilterUnknown28)
];
)];
}
luabind::scope lua_register_message_types() {
return luabind::class_<MessageTypes>("MT")
.enum_("constants")
[
[(
luabind::value("White", Chat::White),
luabind::value("DimGray", Chat::DimGray),
luabind::value("Default", Chat::Default),
@ -5059,13 +5059,13 @@ luabind::scope lua_register_message_types() {
luabind::value("ItemSpeech", Chat::ItemSpeech),
luabind::value("StrikeThrough", Chat::StrikeThrough),
luabind::value("Stun", Chat::Stun)
];
)];
}
luabind::scope lua_register_rules_const() {
return luabind::class_<Rule>("Rule")
.enum_("constants")
[
[(
#define RULE_INT(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::Int__##rule),
#include "../common/ruletypes.h"
@ -5080,7 +5080,7 @@ luabind::scope lua_register_rules_const() {
luabind::value(#rule, RuleManager::Bool__##rule),
#include "../common/ruletypes.h"
luabind::value("_BoolRuleCount", RuleManager::_BoolRuleCount)
];
)];
}
luabind::scope lua_register_rulei() {
@ -5107,24 +5107,24 @@ luabind::scope lua_register_ruleb() {
luabind::scope lua_register_journal_speakmode() {
return luabind::class_<Journal_SpeakMode>("SpeakMode")
.enum_("constants")
[
[(
luabind::value("Raw", static_cast<int>(Journal::SpeakMode::Raw)),
luabind::value("Say", static_cast<int>(Journal::SpeakMode::Say)),
luabind::value("Shout", static_cast<int>(Journal::SpeakMode::Shout)),
luabind::value("EmoteAlt", static_cast<int>(Journal::SpeakMode::EmoteAlt)),
luabind::value("Emote", static_cast<int>(Journal::SpeakMode::Emote)),
luabind::value("Group", static_cast<int>(Journal::SpeakMode::Group))
];
)];
}
luabind::scope lua_register_journal_mode() {
return luabind::class_<Journal_Mode>("JournalMode")
.enum_("constants")
[
[(
luabind::value("None", static_cast<int>(Journal::Mode::None)),
luabind::value("Log1", static_cast<int>(Journal::Mode::Log1)),
luabind::value("Log2", static_cast<int>(Journal::Mode::Log2))
];
)];
}
#endif

View File

@ -3308,7 +3308,7 @@ luabind::scope lua_register_special_abilities() {
return luabind::class_<SpecialAbilities>("SpecialAbility")
.enum_("constants")
[
[(
luabind::value("summon", static_cast<int>(SPECATK_SUMMON)),
luabind::value("enrage", static_cast<int>(SPECATK_ENRAGE)),
luabind::value("rampage", static_cast<int>(SPECATK_RAMPAGE)),
@ -3360,7 +3360,7 @@ luabind::scope lua_register_special_abilities() {
luabind::value("immune_aggro_npc", static_cast<int>(IMMUNE_AGGRO_NPC)),
luabind::value("modify_avoid_damage", static_cast<int>(MODIFY_AVOID_DAMAGE)),
luabind::value("immune_open", static_cast<int>(IMMUNE_OPEN))
];
)];
}
#endif

View File

@ -365,7 +365,7 @@ luabind::scope lua_register_packet() {
luabind::scope lua_register_packet_opcodes() {
return luabind::class_<Opcodes>("Opcode")
.enum_("constants")
[
[(
luabind::value("ExploreUnknown", static_cast<int>(OP_ExploreUnknown)),
luabind::value("Heartbeat", static_cast<int>(OP_Heartbeat)),
luabind::value("ReloadUI", static_cast<int>(OP_ReloadUI)),
@ -911,7 +911,7 @@ luabind::scope lua_register_packet_opcodes() {
luabind::value("ClientTimeStamp", static_cast<int>(OP_ClientTimeStamp)),
luabind::value("GuildPromote", static_cast<int>(OP_GuildPromote)),
luabind::value("Fling", static_cast<int>(OP_Fling))
];
)];
}
#endif

View File

@ -1159,7 +1159,7 @@ void LuaParser::MapFunctions(lua_State *L) {
luabind::open(L);
luabind::module(L)
[
[(
lua_register_general(),
lua_register_random(),
lua_register_events(),
@ -1219,7 +1219,7 @@ void LuaParser::MapFunctions(lua_State *L) {
lua_register_journal_mode(),
lua_register_expedition(),
lua_register_expedition_lock_messages()
];
)];
} catch(std::exception &ex) {
std::string error = ex.what();

View File

@ -1318,7 +1318,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
const EQ::ItemData* item = RangeWeapon->GetItem();
if (item->ItemType != EQ::item::ItemTypeLargeThrowing && item->ItemType != EQ::item::ItemTypeSmallThrowing) {
LogCombat("Ranged attack canceled. Ranged item [{}] is not a throwing weapon. type [{}]", item->ItemType);
LogCombat("Ranged attack canceled. Ranged item [{}] is not a throwing weapon. type [{}]", item->ID, item->ItemType);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQ::invslot::slotRange));
return;
}

View File

@ -1361,7 +1361,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
{
if (IsBardSong(spell_id) && slot < CastingSlot::MaxGems) {
if (spells[spell_id].buff_duration == 0xFFFF) {
LogSpells("Bard song [{}] not applying bard logic because duration. dur=[{}], recast=[{}]", spells[spell_id].buff_duration);
LogSpells("Bard song [{}] not applying bard logic because duration. dur=[{}], recast=[{}]", spell_id, spells[spell_id].buff_duration, spells[spell_id].recast_time);
}
else {
if (IsPulsingBardSong(spell_id)) {

View File

@ -2022,7 +2022,7 @@ void ClientTaskState::AcceptNewTask(
else if (timer_type == TaskTimerType::Request)
{
auto eqstr = TaskStr::Get(TaskStr::ASSIGN_REQUEST_TIMER);
client->Message(Chat::Red, fmt::format(eqstr, days, hours, mins).c_str());
client->Message(Chat::Red, fmt::format(fmt::runtime(eqstr), days, hours, mins).c_str());
}
return;
@ -2284,7 +2284,7 @@ void ClientTaskState::ListTaskTimers(Client* client)
else
{
auto eqstr = TaskStr::Get(TaskStr::REQUEST_TIMER_REMAINING);
client->Message(Chat::Yellow, fmt::format(eqstr, task->title, days, hours, mins).c_str());
client->Message(Chat::Yellow, fmt::format(fmt::runtime(eqstr), task->title, days, hours, mins).c_str());
}
}
}

View File

@ -274,7 +274,7 @@ bool TaskManager::SaveClientState(Client *client, ClientTaskState *cts)
return false;
}
const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::SaveClientState {}";
constexpr const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::SaveClientState {}";
int character_id = client->CharacterID();