summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Collision/Maps/MapDefines.h2
-rw-r--r--src/common/Collision/VMapDefinitions.h4
-rw-r--r--src/common/Common.h2
-rw-r--r--src/common/Utilities/Systemd.cpp59
-rw-r--r--src/common/Utilities/Systemd.h31
-rw-r--r--src/common/Utilities/Util.h9
6 files changed, 94 insertions, 13 deletions
diff --git a/src/common/Collision/Maps/MapDefines.h b/src/common/Collision/Maps/MapDefines.h
index d928c51721..a3527f16c2 100644
--- a/src/common/Collision/Maps/MapDefines.h
+++ b/src/common/Collision/Maps/MapDefines.h
@@ -26,7 +26,7 @@
#define SIZE_OF_GRIDS 533.3333f
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
-#define MMAP_VERSION 18
+#define MMAP_VERSION 19
struct MmapTileRecastConfig
{
diff --git a/src/common/Collision/VMapDefinitions.h b/src/common/Collision/VMapDefinitions.h
index 623dea5020..b8026d9496 100644
--- a/src/common/Collision/VMapDefinitions.h
+++ b/src/common/Collision/VMapDefinitions.h
@@ -22,8 +22,8 @@
namespace VMAP
{
- const char VMAP_MAGIC[] = "VMAP_4.7";
- const char RAW_VMAP_MAGIC[] = "VMAP047"; // used in extracted vmap files with raw data
+ const char VMAP_MAGIC[] = "VMAP_4.8";
+ const char RAW_VMAP_MAGIC[] = "VMAP048"; // used in extracted vmap files with raw data
const char GAMEOBJECT_MODELS[] = "GameObjectModels.dtree";
// defined in TileAssembler.cpp currently...
diff --git a/src/common/Common.h b/src/common/Common.h
index 6b258207b4..1a2c0a3902 100644
--- a/src/common/Common.h
+++ b/src/common/Common.h
@@ -49,7 +49,7 @@ constexpr auto HOUR = MINUTE * 60;
constexpr auto DAY = HOUR * 24;
constexpr auto WEEK = DAY * 7;
constexpr auto MONTH = DAY * 30;
-constexpr auto YEAR = MONTH * 12;
+constexpr auto YEAR = DAY * 365;
constexpr auto IN_MILLISECONDS = 1000;
enum AccountTypes
diff --git a/src/common/Utilities/Systemd.cpp b/src/common/Utilities/Systemd.cpp
new file mode 100644
index 0000000000..f7c39cfb17
--- /dev/null
+++ b/src/common/Utilities/Systemd.cpp
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information.
+ *
+ * Portions of this file are derived from systemd, licensed under:
+ * - GPL-2.0-or-later (if the original systemd file was GPL-2.0+)
+ * OR
+ * - LGPL-2.1-or-later, relicensed under GPL-2.0-or-later as permitted by LGPL-2.1+
+ *
+ * Original systemd copyright:
+ * Copyright (c) the systemd contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if defined(__linux__)
+#include "Log.h"
+#include "StringConvert.h"
+#include <cstdlib>
+#include <unistd.h>
+#include <string>
+
+int get_listen_fd()
+{
+ char* const listen_pid = std::getenv("LISTEN_PID");
+ char* const listen_fds = std::getenv("LISTEN_FDS");
+ if (!listen_pid || !listen_fds)
+ return 0;
+
+ pid_t pid = Acore::StringTo<int>(listen_pid).value_or(0);
+ if (pid != getpid())
+ return 0;
+
+ int fds = Acore::StringTo<int>(listen_fds).value_or(0);
+ if (fds <= 0)
+ return 0;
+
+ if (fds > 1)
+ LOG_WARN("network", "Multiple file descriptors received from systemd socket activation, only the first will be used");
+
+ return 3;
+}
+#else
+// On non-Linux systems, just return 0 (no socket activation)
+int get_listen_fd()
+{
+ return 0;
+}
+#endif
diff --git a/src/common/Utilities/Systemd.h b/src/common/Utilities/Systemd.h
new file mode 100644
index 0000000000..312345cea1
--- /dev/null
+++ b/src/common/Utilities/Systemd.h
@@ -0,0 +1,31 @@
+/*
+ * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information.
+ *
+ * Portions of this file are derived from systemd, licensed under:
+ * - GPL-2.0-or-later (if the original systemd file was GPL-2.0+)
+ * OR
+ * - LGPL-2.1-or-later, relicensed under GPL-2.0-or-later as permitted by LGPL-2.1+
+ *
+ * Original systemd copyright:
+ * Copyright (c) the systemd contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _SYSTEMD_H_
+#define _SYSTEMD_H_
+
+int get_listen_fd();
+
+#endif
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h
index b1fbeabb33..3976d4e76b 100644
--- a/src/common/Utilities/Util.h
+++ b/src/common/Utilities/Util.h
@@ -47,15 +47,6 @@ AC_COMMON_API Optional<int32> MoneyStringToMoney(std::string_view moneyString);
std::string secsToTimeString(uint64 timeInSecs, bool shortText = false);
uint32 TimeStringToSecs(const std::string& timestring);
-inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
-{
- if (val == -100.0f) // prevent set var to zero
- {
- val = -99.99f;
- }
- var *= (apply ? (100.0f + val) / 100.0f : 100.0f / (100.0f + val));
-}
-
// Percentage calculation
template <class T, class U>
inline T CalculatePct(T base, U pct)