Merge fix

This commit is contained in:
KimLS
2016-11-19 15:54:31 -08:00
144 changed files with 8239 additions and 6580 deletions
+2 -2
View File
@@ -22,7 +22,7 @@
#include "../common/ipc_mutex.h"
#include "../common/memory_mapped_file.h"
#include "../common/eqemu_exception.h"
#include "../common/item_base.h"
#include "../common/item_data.h"
void LoadItems(SharedDatabase *database, const std::string &prefix) {
EQEmu::IPCMutex mutex("items");
@@ -35,7 +35,7 @@ void LoadItems(SharedDatabase *database, const std::string &prefix) {
EQ_EXCEPT("Shared Memory", "Unable to get any items from the database.");
}
uint32 size = static_cast<uint32>(EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>::estimated_size(items, max_item));
uint32 size = static_cast<uint32>(EQEmu::FixedMemoryHashSet<EQEmu::ItemData>::estimated_size(items, max_item));
auto Config = EQEmuConfig::get();
std::string file_name = Config->SharedMemDir + prefix + std::string("items");
+38
View File
@@ -36,6 +36,39 @@
EQEmuLogSys Log;
#ifdef _WINDOWS
#include <direct.h>
#else
#include <unistd.h>
#endif
#include <sys/stat.h>
inline bool MakeDirectory(const std::string &directory_name)
{
#ifdef _WINDOWS
struct _stat st;
if (_stat(directory_name.c_str(), &st) == 0) {
return false;
}
else {
_mkdir(directory_name.c_str());
return true;
}
#else
struct stat st;
if (stat(directory_name.c_str(), &st) == 0) {
return false;
}
else {
mkdir(directory_name.c_str(), 0755);
return true;
}
#endif
return false;
}
int main(int argc, char **argv) {
RegisterExecutablePlatform(ExePlatformSharedMemory);
Log.LoadLogSettingsDefaults();
@@ -62,6 +95,11 @@ int main(int argc, char **argv) {
database.LoadLogSettings(Log.log_settings);
Log.StartFileLogs();
std::string shared_mem_directory = Config->SharedMemDir;
if (MakeDirectory(shared_mem_directory)) {
Log.Out(Logs::General, Logs::Status, "Shared Memory folder doesn't exist, so we created it... '%s'", shared_mem_directory.c_str());
}
database.LoadVariables();
/* If we're running shared memory and hotfix has no custom name, we probably want to start from scratch... */