mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-08-20 20:30:42 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
324a606fff
3
Makefile
3
Makefile
@ -39,7 +39,8 @@ HDR=\
|
|||||||
src/CNShardServer.hpp\
|
src/CNShardServer.hpp\
|
||||||
src/CNShared.hpp\
|
src/CNShared.hpp\
|
||||||
src/CNStructs.hpp\
|
src/CNStructs.hpp\
|
||||||
src/INIReader.hpp\
|
src/contrib/INIReader.hpp\
|
||||||
|
src/contrib/JSON.hpp\
|
||||||
src/NanoManager.hpp\
|
src/NanoManager.hpp\
|
||||||
src/ItemManager.hpp\
|
src/ItemManager.hpp\
|
||||||
src/NPCManager.hpp\
|
src/NPCManager.hpp\
|
||||||
|
@ -10,7 +10,7 @@ randomcharacters=true
|
|||||||
[shard]
|
[shard]
|
||||||
port=8002
|
port=8002
|
||||||
# you'll want to change this one
|
# you'll want to change this one
|
||||||
ip=192.168.1.183
|
ip=127.0.0.1
|
||||||
# distance at which other players and NPCs become visible
|
# distance at which other players and NPCs become visible
|
||||||
view=20000
|
view=20000
|
||||||
# little message players see when they enter the game
|
# little message players see when they enter the game
|
||||||
|
@ -73,12 +73,15 @@ CNSocket::CNSocket(SOCKET s, PacketHandler ph): sock(s), pHandler(ph) {
|
|||||||
|
|
||||||
bool CNSocket::sendData(uint8_t* data, int size) {
|
bool CNSocket::sendData(uint8_t* data, int size) {
|
||||||
int sentBytes = 0;
|
int sentBytes = 0;
|
||||||
|
int maxTries = 10;
|
||||||
|
|
||||||
while (sentBytes < size) {
|
while (sentBytes < size) {
|
||||||
int sent = send(sock, (buffer_t*)(data + sentBytes), size - sentBytes, 0); // no flags defined
|
int sent = send(sock, (buffer_t*)(data + sentBytes), size - sentBytes, 0); // no flags defined
|
||||||
if (SOCKETERROR(sent)) {
|
if (SOCKETERROR(sent)) {
|
||||||
if (errno == 11)
|
if (errno == 11 && maxTries > 0) {
|
||||||
|
maxTries--;
|
||||||
continue; // try again
|
continue; // try again
|
||||||
|
}
|
||||||
std::cout << "[FATAL] SOCKET ERROR: " << errno << std::endl;
|
std::cout << "[FATAL] SOCKET ERROR: " << errno << std::endl;
|
||||||
return false; // error occured while sending bytes
|
return false; // error occured while sending bytes
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
#include "CNStructs.hpp"
|
#include "CNStructs.hpp"
|
||||||
|
|
||||||
std::string U16toU8(char16_t* src) {
|
std::string U16toU8(char16_t* src) {
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
|
try {
|
||||||
return convert.to_bytes(src);
|
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
|
||||||
|
return convert.to_bytes(src);
|
||||||
|
} catch(std::exception e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns number of char16_t that was written at des
|
// returns number of char16_t that was written at des
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "JSON.hpp"
|
#include "contrib/JSON.hpp"
|
||||||
|
|
||||||
std::map<int32_t, BaseNPC> NPCManager::NPCs;
|
std::map<int32_t, BaseNPC> NPCManager::NPCs;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
#include "INIReader.hpp"
|
#include "contrib/INIReader.hpp"
|
||||||
|
|
||||||
// defaults :)
|
// defaults :)
|
||||||
int settings::LOGINPORT = 8001;
|
int settings::LOGINPORT = 8001;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user