mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2026-03-29 07:50:03 +00:00
Compare commits
5 Commits
mailfix
...
9a62ec61c9
| Author | SHA1 | Date | |
|---|---|---|---|
|
9a62ec61c9
|
|||
|
|
51d3cfbb3b | ||
|
|
8df263a64d | ||
| 572df90645 | |||
|
|
8d0587dd45 |
@@ -47,6 +47,13 @@ motd=Welcome to OpenFusion!
|
|||||||
# requires to run. You can override them by changing their values and
|
# requires to run. You can override them by changing their values and
|
||||||
# uncommenting them (removing the leading # character from that line).
|
# uncommenting them (removing the leading # character from that line).
|
||||||
|
|
||||||
|
# Should drop fixes be enabled?
|
||||||
|
# This will add drops to (mostly Academy-specific) mobs that don't have drops
|
||||||
|
# and rearrange drop tables that are either unassigned or stranded in difficult to reach mobs
|
||||||
|
# e.g. Hyper Fusionfly and Fusion Numbuh Four drops will become more accessible.
|
||||||
|
# This is a polish option that is slightly inauthentic to the original game.
|
||||||
|
#dropfixesenabled=true
|
||||||
|
|
||||||
# location of the tabledata folder
|
# location of the tabledata folder
|
||||||
#tdatadir=tdata/
|
#tdatadir=tdata/
|
||||||
# location of the patch folder
|
# location of the patch folder
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
// these are added to the NPC's static key to avoid collisions
|
// these are added to the NPC's static key to avoid collisions
|
||||||
const int NPC_ID_OFFSET = 1;
|
const int NPC_ID_OFFSET = 1;
|
||||||
const int MOB_ID_OFFSET = 10000;
|
const int MOB_ID_OFFSET = 10000;
|
||||||
const int MOB_GROUP_ID_OFFSET = 20000;
|
const int MOB_GROUP_ID_OFFSET = 30000;
|
||||||
|
|
||||||
// typedef for JSON object because I don't want to type nlohmann::json every time
|
// typedef for JSON object because I don't want to type nlohmann::json every time
|
||||||
typedef nlohmann::json json;
|
typedef nlohmann::json json;
|
||||||
|
|||||||
@@ -365,14 +365,8 @@ void CNServer::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attach socket to the port
|
// attach socket to the port
|
||||||
int opt = 1;
|
if (!setSocketOption(sock, SOL_SOCKET, SO_REUSEADDR, 1)) {
|
||||||
#ifdef _WIN32
|
|
||||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof(opt)) != 0) {
|
|
||||||
#else
|
|
||||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) != 0) {
|
|
||||||
#endif
|
|
||||||
std::cerr << "[FATAL] OpenFusion: setsockopt failed" << std::endl;
|
std::cerr << "[FATAL] OpenFusion: setsockopt failed" << std::endl;
|
||||||
printSocketError("setsockopt");
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
address.sin_family = AF_INET;
|
address.sin_family = AF_INET;
|
||||||
@@ -414,6 +408,18 @@ void CNServer::init() {
|
|||||||
CNServer::CNServer() {};
|
CNServer::CNServer() {};
|
||||||
CNServer::CNServer(uint16_t p): port(p) {}
|
CNServer::CNServer(uint16_t p): port(p) {}
|
||||||
|
|
||||||
|
bool CNServer::setSocketOption(SOCKET s, int level, int option, int value) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (setsockopt(s, level, option, (const char*)&value, sizeof(value)) != 0) {
|
||||||
|
#else
|
||||||
|
if (setsockopt(s, level, option, &value, sizeof(value)) != 0) {
|
||||||
|
#endif
|
||||||
|
printSocketError("setsockopt");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CNServer::addPollFD(SOCKET s) {
|
void CNServer::addPollFD(SOCKET s) {
|
||||||
fds.push_back({s, POLLIN});
|
fds.push_back({s, POLLIN});
|
||||||
}
|
}
|
||||||
@@ -462,6 +468,9 @@ void CNServer::start() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!setSocketOption(newConnectionSocket, IPPROTO_TCP, TCP_NODELAY, 1))
|
||||||
|
std::cout << "[WARN] OpenFusion: failed to set TCP_NODELAY on new connection" << std::endl;
|
||||||
|
|
||||||
if (!setSockNonblocking(sock, newConnectionSocket))
|
if (!setSockNonblocking(sock, newConnectionSocket))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
// posix platform
|
// posix platform
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -239,6 +240,7 @@ protected:
|
|||||||
|
|
||||||
bool active = true;
|
bool active = true;
|
||||||
|
|
||||||
|
bool setSocketOption(SOCKET s, int level, int option, int value);
|
||||||
void addPollFD(SOCKET s);
|
void addPollFD(SOCKET s);
|
||||||
void removePollFD(int i);
|
void removePollFD(int i);
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ int settings::EVENTMODE = 0;
|
|||||||
// race settings
|
// race settings
|
||||||
bool settings::IZRACESCORECAPPED = true;
|
bool settings::IZRACESCORECAPPED = true;
|
||||||
|
|
||||||
|
// drop fixes enabled
|
||||||
|
bool settings::DROPFIXESENABLED = false;
|
||||||
|
|
||||||
void settings::init() {
|
void settings::init() {
|
||||||
INIReader reader("config.ini");
|
INIReader reader("config.ini");
|
||||||
|
|
||||||
@@ -117,6 +120,7 @@ void settings::init() {
|
|||||||
TDATADIR = reader.Get("shard", "tdatadir", TDATADIR);
|
TDATADIR = reader.Get("shard", "tdatadir", TDATADIR);
|
||||||
PATCHDIR = reader.Get("shard", "patchdir", PATCHDIR);
|
PATCHDIR = reader.Get("shard", "patchdir", PATCHDIR);
|
||||||
ENABLEDPATCHES = reader.Get("shard", "enabledpatches", ENABLEDPATCHES);
|
ENABLEDPATCHES = reader.Get("shard", "enabledpatches", ENABLEDPATCHES);
|
||||||
|
DROPFIXESENABLED = reader.GetBoolean("shard", "dropfixesenabled", DROPFIXESENABLED);
|
||||||
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
||||||
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
||||||
DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG);
|
DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG);
|
||||||
@@ -126,4 +130,16 @@ void settings::init() {
|
|||||||
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
|
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
|
||||||
MONITORLISTENIP = reader.Get("monitor", "listenip", MONITORLISTENIP);
|
MONITORLISTENIP = reader.Get("monitor", "listenip", MONITORLISTENIP);
|
||||||
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);
|
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);
|
||||||
|
|
||||||
|
if (DROPFIXESENABLED) {
|
||||||
|
std::cout << "[INFO] Drop fixes enabled" << std::endl;
|
||||||
|
if (ENABLEDPATCHES.empty()) {
|
||||||
|
ENABLEDPATCHES = "0104-fixes";
|
||||||
|
} else {
|
||||||
|
ENABLEDPATCHES += " 0104-fixes";
|
||||||
|
if (ENABLEDPATCHES.find("1013") != std::string::npos) {
|
||||||
|
ENABLEDPATCHES += " 1013-fixes";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace settings {
|
|||||||
extern int MONITORINTERVAL;
|
extern int MONITORINTERVAL;
|
||||||
extern bool DISABLEFIRSTUSEFLAG;
|
extern bool DISABLEFIRSTUSEFLAG;
|
||||||
extern bool IZRACESCORECAPPED;
|
extern bool IZRACESCORECAPPED;
|
||||||
|
extern bool DROPFIXESENABLED;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
}
|
}
|
||||||
|
|||||||
2
tdata
2
tdata
Submodule tdata updated: bdb611b092...d6183b484e
Reference in New Issue
Block a user