Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
ef29c2b5ef
8 changed files with 378 additions and 221 deletions
|
@ -375,6 +375,10 @@ IF(WITH_QT5)
|
|||
ENDIF()
|
||||
ELSE()
|
||||
SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core)
|
||||
|
||||
IF(WIN32)
|
||||
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::WinExtras)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(WARNING "Unable to find Qt 5")
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "nel/misc/config_file.h"
|
||||
#include "nel/misc/file.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/bitmap.h"
|
||||
#include "nel/misc/block_memory.h"
|
||||
#include "nel/misc/i_xml.h"
|
||||
|
@ -35,15 +36,6 @@
|
|||
|
||||
#include "nel/3d/scene_group.h"
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <dirent.h> /* for directories functions */
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h> /* getcwd, chdir -- replacement for getCurDiretory & setCurDirectory on windows */
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
using namespace std;
|
||||
|
@ -132,75 +124,6 @@ struct CZoneLimits
|
|||
sint32 _ZoneMaxY;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifdef NL_OS_WINDOWS // win32 code
|
||||
void dir (const string &sFilter, vector<string> &sAllFiles, bool bFullPath)
|
||||
{
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE hFind;
|
||||
char sCurDir[MAX_PATH];
|
||||
sAllFiles.clear ();
|
||||
GetCurrentDirectory (MAX_PATH, sCurDir);
|
||||
hFind = FindFirstFile (("*"+sFilter).c_str(), &findData);
|
||||
while (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD res = GetFileAttributes(findData.cFileName);
|
||||
if (res != INVALID_FILE_ATTRIBUTES && !(res&FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
if (bFullPath)
|
||||
sAllFiles.push_back(string(sCurDir) + "\\" + findData.cFileName);
|
||||
else
|
||||
sAllFiles.push_back(findData.cFileName);
|
||||
}
|
||||
if (FindNextFile (hFind, &findData) == 0)
|
||||
break;
|
||||
}
|
||||
FindClose (hFind);
|
||||
}
|
||||
|
||||
void getcwd (char *dir, int length)
|
||||
{
|
||||
GetCurrentDirectoryA (length, dir);
|
||||
}
|
||||
|
||||
void chdir(const char *path)
|
||||
{
|
||||
SetCurrentDirectoryA (path);
|
||||
}
|
||||
|
||||
#else // posix version of the void dir(...) function.
|
||||
void dir (const string &sFilter, vector<string> &sAllFiles, bool bFullPath)
|
||||
{
|
||||
char sCurDir[MAX_PATH];
|
||||
DIR* dp = NULL;
|
||||
struct dirent *dirp= NULL;
|
||||
|
||||
getcwd ( sCurDir, MAX_PATH ) ;
|
||||
sAllFiles.clear ();
|
||||
if ( (dp = opendir( sCurDir )) == NULL)
|
||||
{
|
||||
string sTmp = string("ERROR : Can't open the dir : \"")+string(sCurDir)+string("\"") ;
|
||||
outString ( sTmp ) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
while ( (dirp = readdir(dp)) != NULL)
|
||||
{
|
||||
std:string sFileName = std::string(dirp->d_name) ;
|
||||
if (sFileName.substr((sFileName.length()-sFilter.length()),sFilter.length()).find(sFilter)!= std::string::npos )
|
||||
{
|
||||
if (bFullPath)
|
||||
sAllFiles.push_back(string(sCurDir) + "/" + sFileName);
|
||||
else
|
||||
sAllFiles.push_back(sFileName);
|
||||
}
|
||||
|
||||
}
|
||||
closedir(dp);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
CZoneRegion *loadLand (const string &filename)
|
||||
{
|
||||
|
@ -219,21 +142,19 @@ CZoneRegion *loadLand (const string &filename)
|
|||
}
|
||||
else
|
||||
{
|
||||
string sTmp = string("Can't open the land file : ") + filename;
|
||||
outString (sTmp);
|
||||
outString (toString("Can't open the land files: %s", filename.c_str()));
|
||||
}
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
string sTmp = string("Error in land file : ") + e.what();
|
||||
outString (sTmp);
|
||||
outString(toString("Error in land file: %s", e.what()));
|
||||
}
|
||||
return ZoneRegion;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
CInstanceGroup* LoadInstanceGroup (const char* sFilename)
|
||||
CInstanceGroup* LoadInstanceGroup (const std::string &sFilename)
|
||||
{
|
||||
CIFile file;
|
||||
CInstanceGroup *newIG = new CInstanceGroup;
|
||||
|
@ -260,7 +181,7 @@ CInstanceGroup* LoadInstanceGroup (const char* sFilename)
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void SaveInstanceGroup (const char* sFilename, CInstanceGroup *pIG)
|
||||
void SaveInstanceGroup (const std::string &sFilename, CInstanceGroup *pIG)
|
||||
{
|
||||
COFile file;
|
||||
|
||||
|
@ -272,14 +193,12 @@ void SaveInstanceGroup (const char* sFilename, CInstanceGroup *pIG)
|
|||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
string stTmp = string(e.what()) ;
|
||||
outString( stTmp );
|
||||
outString(e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string stTemp = string("Couldn't create ") + string(sFilename) ;
|
||||
outString( stTemp );
|
||||
outString(toString("Couldn't create %s", sFilename.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,8 +244,7 @@ int main(int nNbArg, char**ppArgs)
|
|||
new CApplicationContext();
|
||||
|
||||
NL3D_BlockMemoryAssertOnPurge = false;
|
||||
char sCurDir[MAX_PATH];
|
||||
getcwd (sCurDir, MAX_PATH);
|
||||
std::string sCurDir = CPath::getCurrentPath();
|
||||
|
||||
if (nNbArg != 2)
|
||||
{
|
||||
|
@ -386,17 +304,14 @@ int main(int nNbArg, char**ppArgs)
|
|||
}
|
||||
else
|
||||
{
|
||||
string sTmp = string("Couldn't not open ")+string(options.HeightMapFile1)
|
||||
+string(" : heightmap 1 map ignored");
|
||||
outString(sTmp);
|
||||
outString(toString("Couldn't not open %s: heightmap 1 map ignored", options.HeightMapFile1.c_str()));
|
||||
delete HeightMap1;
|
||||
HeightMap1 = NULL;
|
||||
}
|
||||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
string sTmp = string("Cant load height map : ") + options.HeightMapFile1 + " : " + e.what();
|
||||
outString (sTmp);
|
||||
outString(toString("Cant load height map : %s : %s", options.HeightMapFile1.c_str(), e.what()));
|
||||
delete HeightMap1;
|
||||
HeightMap1 = NULL;
|
||||
}
|
||||
|
@ -414,33 +329,37 @@ int main(int nNbArg, char**ppArgs)
|
|||
}
|
||||
else
|
||||
{
|
||||
string sTmp = string("Couldn't not open ")+string(options.HeightMapFile2)
|
||||
+string(" : heightmap 2 map ignored\n");
|
||||
outString(sTmp);
|
||||
outString(toString("Couldn't not open %s: heightmap 2 map ignored", options.HeightMapFile2.c_str()));
|
||||
delete HeightMap2;
|
||||
HeightMap2 = NULL;
|
||||
}
|
||||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
string sTmp = string("Cant load height map : ") + options.HeightMapFile2 + " : " + e.what() + "\n";
|
||||
outString (sTmp);
|
||||
outString (string("Cant load height map : ") + options.HeightMapFile2 + " : " + e.what() + "\n");
|
||||
delete HeightMap2;
|
||||
HeightMap1 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Get all files
|
||||
// get all files
|
||||
vector<string> vAllFilesUnfiltered;
|
||||
CPath::getPathContent(options.InputIGDir, false, false, true, vAllFilesUnfiltered);
|
||||
|
||||
// keep only .ig files
|
||||
vector<string> vAllFiles;
|
||||
chdir (options.InputIGDir.c_str());
|
||||
dir (".ig", vAllFiles, false);
|
||||
chdir (sCurDir);
|
||||
for(uint i = 0, len = (uint)vAllFilesUnfiltered.size(); i < len; ++i)
|
||||
{
|
||||
if (toLower(CFile::getExtension(vAllFilesUnfiltered[i])) == "ig")
|
||||
{
|
||||
vAllFiles.push_back(vAllFilesUnfiltered[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < vAllFiles.size(); ++i)
|
||||
{
|
||||
chdir (options.InputIGDir.c_str());
|
||||
CInstanceGroup *pIG = LoadInstanceGroup (vAllFiles[i].c_str());
|
||||
chdir (sCurDir);
|
||||
CInstanceGroup *pIG = LoadInstanceGroup (CPath::standardizePath(options.InputIGDir) + vAllFiles[i]);
|
||||
|
||||
if (pIG != NULL)
|
||||
{
|
||||
bool realTimeSunContribution = pIG->getRealTimeSunContribution();
|
||||
|
@ -511,10 +430,8 @@ int main(int nNbArg, char**ppArgs)
|
|||
pIGout->build (vGlobalPos, IA, Clusters, Portals, PLN);
|
||||
pIGout->enableRealTimeSunContribution(realTimeSunContribution);
|
||||
|
||||
SaveInstanceGroup (CPath::standardizePath(options.OutputIGDir) + vAllFiles[i], pIGout);
|
||||
|
||||
chdir (options.OutputIGDir.c_str());
|
||||
SaveInstanceGroup (vAllFiles[i].c_str(), pIGout);
|
||||
chdir (sCurDir);
|
||||
delete pIG;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,12 @@ struct CUTMiscStringCommon : public Test::Suite
|
|||
TEST_ADD(CUTMiscStringCommon::fromStringUint16);
|
||||
TEST_ADD(CUTMiscStringCommon::fromStringSint32);
|
||||
TEST_ADD(CUTMiscStringCommon::fromStringUint32);
|
||||
TEST_ADD(CUTMiscStringCommon::fromStringSint64);
|
||||
TEST_ADD(CUTMiscStringCommon::fromStringUint64);
|
||||
TEST_ADD(CUTMiscStringCommon::fromStringFloat);
|
||||
TEST_ADD(CUTMiscStringCommon::fromStringDouble);
|
||||
TEST_ADD(CUTMiscStringCommon::fromStringBool);
|
||||
|
||||
// Add a line here when adding a new test METHOD
|
||||
}
|
||||
|
||||
|
@ -403,6 +409,322 @@ struct CUTMiscStringCommon : public Test::Suite
|
|||
ret = NLMISC::fromString("+1", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
}
|
||||
|
||||
void fromStringSint64()
|
||||
{
|
||||
bool ret;
|
||||
|
||||
// tests for sint64
|
||||
sint64 val;
|
||||
|
||||
// positive value
|
||||
ret = NLMISC::fromString("1", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// negative value
|
||||
ret = NLMISC::fromString("-1", val);
|
||||
TEST_ASSERT(ret && val == -1);
|
||||
|
||||
// bad character
|
||||
ret = NLMISC::fromString("a", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// right character and bad character
|
||||
ret = NLMISC::fromString("1a", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// min limit
|
||||
ret = NLMISC::fromString("-9223372036854775808", val);
|
||||
TEST_ASSERT(ret && val == LLONG_MIN);
|
||||
|
||||
// max limit
|
||||
ret = NLMISC::fromString("9223372036854775807", val);
|
||||
TEST_ASSERT(ret && val == LLONG_MAX);
|
||||
|
||||
// min limit -1
|
||||
ret = NLMISC::fromString("-9223372036854775809", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// max limit +1
|
||||
ret = NLMISC::fromString("9223372036854775808", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// with period
|
||||
ret = NLMISC::fromString("1.2", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with coma
|
||||
ret = NLMISC::fromString("1,2", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with spaces before
|
||||
ret = NLMISC::fromString(" 10", val);
|
||||
TEST_ASSERT(ret && val == 10);
|
||||
|
||||
// with spaces after
|
||||
ret = NLMISC::fromString("10 ", val);
|
||||
TEST_ASSERT(ret && val == 10);
|
||||
|
||||
// with 0s before
|
||||
ret = NLMISC::fromString("001", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with + before
|
||||
ret = NLMISC::fromString("+1", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
}
|
||||
|
||||
void fromStringUint64()
|
||||
{
|
||||
bool ret;
|
||||
|
||||
// tests for uint64
|
||||
uint64 val;
|
||||
|
||||
// positive value
|
||||
ret = NLMISC::fromString("1", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// bad character
|
||||
ret = NLMISC::fromString("a", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// right character and bad character
|
||||
ret = NLMISC::fromString("1a", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// min limit
|
||||
ret = NLMISC::fromString("0", val);
|
||||
TEST_ASSERT(ret && val == 0);
|
||||
|
||||
// max limit
|
||||
ret = NLMISC::fromString("4294967295", val);
|
||||
TEST_ASSERT(ret && val == 4294967295);
|
||||
|
||||
// min limit -1
|
||||
ret = NLMISC::fromString("-1", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// max limit +1
|
||||
ret = NLMISC::fromString("4294967296", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// with period
|
||||
ret = NLMISC::fromString("1.2", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with coma
|
||||
ret = NLMISC::fromString("1,2", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with spaces before
|
||||
ret = NLMISC::fromString(" 10", val);
|
||||
TEST_ASSERT(ret && val == 10);
|
||||
|
||||
// with spaces after
|
||||
ret = NLMISC::fromString("10 ", val);
|
||||
TEST_ASSERT(ret && val == 10);
|
||||
|
||||
// with 0s before
|
||||
ret = NLMISC::fromString("001", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with + before
|
||||
ret = NLMISC::fromString("+1", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
}
|
||||
|
||||
void fromStringFloat()
|
||||
{
|
||||
bool ret;
|
||||
|
||||
// tests for float
|
||||
float val;
|
||||
|
||||
// positive value
|
||||
ret = NLMISC::fromString("1", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// negative value
|
||||
ret = NLMISC::fromString("-1", val);
|
||||
TEST_ASSERT(ret && val == -1);
|
||||
|
||||
// bad character
|
||||
ret = NLMISC::fromString("a", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// right character and bad character
|
||||
ret = NLMISC::fromString("1a", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// min limit
|
||||
ret = NLMISC::fromString("-2147483648", val);
|
||||
TEST_ASSERT(ret && val == INT_MIN);
|
||||
|
||||
// max limit
|
||||
ret = NLMISC::fromString("2147483647", val);
|
||||
TEST_ASSERT(ret && val == INT_MAX);
|
||||
|
||||
// min limit -1
|
||||
ret = NLMISC::fromString("-2147483649", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// max limit +1
|
||||
ret = NLMISC::fromString("2147483648", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// with period
|
||||
ret = NLMISC::fromString("1.2", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with coma
|
||||
ret = NLMISC::fromString("1,2", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with spaces before
|
||||
ret = NLMISC::fromString(" 10", val);
|
||||
TEST_ASSERT(ret && val == 10);
|
||||
|
||||
// with spaces after
|
||||
ret = NLMISC::fromString("10 ", val);
|
||||
TEST_ASSERT(ret && val == 10);
|
||||
|
||||
// with 0s before
|
||||
ret = NLMISC::fromString("001", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
|
||||
// with + before
|
||||
ret = NLMISC::fromString("+1", val);
|
||||
TEST_ASSERT(ret && val == 1);
|
||||
}
|
||||
|
||||
void fromStringDouble()
|
||||
{
|
||||
bool ret;
|
||||
|
||||
// tests for double
|
||||
double val;
|
||||
|
||||
// positive value
|
||||
ret = NLMISC::fromString("1", val);
|
||||
TEST_ASSERT(ret && val == 1.0);
|
||||
|
||||
// negative value
|
||||
ret = NLMISC::fromString("-1", val);
|
||||
TEST_ASSERT(ret && val == -1.0);
|
||||
|
||||
// bad character
|
||||
ret = NLMISC::fromString("a", val);
|
||||
TEST_ASSERT(!ret && val == 0);
|
||||
|
||||
// right character and bad character
|
||||
ret = NLMISC::fromString("1a", val);
|
||||
TEST_ASSERT(ret && val == 1.0);
|
||||
|
||||
// min limit
|
||||
ret = NLMISC::fromString("2.2250738585072014e-308", val);
|
||||
TEST_ASSERT(ret && val == DBL_MIN);
|
||||
|
||||
// max limit
|
||||
ret = NLMISC::fromString("1.7976931348623158e+308", val);
|
||||
TEST_ASSERT(ret && val == DBL_MAX);
|
||||
|
||||
// min limit -1
|
||||
ret = NLMISC::fromString("3e-408", val);
|
||||
TEST_ASSERT(!ret && val == 0.0);
|
||||
|
||||
// max limit +1
|
||||
ret = NLMISC::fromString("2e+308", val);
|
||||
TEST_ASSERT(!ret && val == 0.0);
|
||||
|
||||
// with period
|
||||
ret = NLMISC::fromString("1.2", val);
|
||||
TEST_ASSERT(ret && val == 1.2);
|
||||
|
||||
// with coma
|
||||
ret = NLMISC::fromString("1,2", val);
|
||||
TEST_ASSERT(ret && val == 1.0);
|
||||
|
||||
// with spaces before
|
||||
ret = NLMISC::fromString(" 10", val);
|
||||
TEST_ASSERT(ret && val == 10.0);
|
||||
|
||||
// with spaces after
|
||||
ret = NLMISC::fromString("10 ", val);
|
||||
TEST_ASSERT(ret && val == 10.0);
|
||||
|
||||
// with 0s before
|
||||
ret = NLMISC::fromString("001", val);
|
||||
TEST_ASSERT(ret && val == 1.0);
|
||||
|
||||
// with + before
|
||||
ret = NLMISC::fromString("+1", val);
|
||||
TEST_ASSERT(ret && val == 1.0);
|
||||
}
|
||||
|
||||
void fromStringBool()
|
||||
{
|
||||
bool ret;
|
||||
|
||||
// tests for bool
|
||||
bool val;
|
||||
|
||||
// true value
|
||||
ret = NLMISC::fromString("1", val);
|
||||
TEST_ASSERT(ret && val);
|
||||
|
||||
// false value
|
||||
ret = NLMISC::fromString("0", val);
|
||||
TEST_ASSERT(ret && !val);
|
||||
|
||||
// bad character
|
||||
ret = NLMISC::fromString("a", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// right character and bad character
|
||||
ret = NLMISC::fromString("1a", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// min limit
|
||||
ret = NLMISC::fromString("-2147483648", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// max limit
|
||||
ret = NLMISC::fromString("2147483647", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// min limit -1
|
||||
ret = NLMISC::fromString("-2147483649", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// max limit +1
|
||||
ret = NLMISC::fromString("2147483648", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// with period
|
||||
ret = NLMISC::fromString("1.2", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// with coma
|
||||
ret = NLMISC::fromString("1,2", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// with spaces before
|
||||
ret = NLMISC::fromString(" 10", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// with spaces after
|
||||
ret = NLMISC::fromString("10 ", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// with 0s before
|
||||
ret = NLMISC::fromString("001", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
|
||||
// with + before
|
||||
ret = NLMISC::fromString("+1", val);
|
||||
TEST_ASSERT(!ret && val);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1068,7 +1068,7 @@ NLMISC_COMMAND(accessPowo, "give access to the powo", "<uid> player_name number"
|
|||
sint32 cell;
|
||||
buildingPlayer->addUser(c, 0, ownerId, cell);
|
||||
// c->setPowoCell(cell);
|
||||
CBuildingManager::getInstance()->setRoomLifeTime(cell, TGameCycle(NLMISC::TGameTime(4*60*60) / CTickEventHandler::getGameTimeStep()));
|
||||
// CBuildingManager::getInstance()->setRoomLifeTime(cell, TGameCycle(NLMISC::TGameTime(4*60*60) / CTickEventHandler::getGameTimeStep()));
|
||||
log.displayNL("%d", cell);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -146,7 +146,6 @@
|
|||
#include "modules/client_command_forwarder.h"
|
||||
#include "server_share/log_character_gen.h"
|
||||
#include "server_share/log_item_gen.h"
|
||||
#include "server_share/mongo_wrapper.h"
|
||||
|
||||
///////////
|
||||
// USING //
|
||||
|
|
|
@ -137,7 +137,7 @@ void CFeReceiveSub::init( uint16 firstAcceptableFrontendPort, uint16 lastAccepta
|
|||
_CurrentInMsg = new TReceivedMessage();
|
||||
|
||||
_History = history;
|
||||
|
||||
|
||||
_ClientIdCont = clientidcont;
|
||||
_ClientIdCont->resize( MaxNbClients+1 ); // because the client ids start at 1
|
||||
TClientIdCont::iterator iclient;
|
||||
|
@ -326,7 +326,7 @@ void CFeReceiveSub::handleIncomingMsg()
|
|||
|
||||
//nldebug( "FERECV: Handling incoming message" );
|
||||
|
||||
// Retrieve client info or add one
|
||||
// Retrieve client info or add one
|
||||
THostMap::iterator ihm = _ClientMap.find( _CurrentInMsg->AddrFrom );
|
||||
if ( ihm == _ClientMap.end() )
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ void CFeReceiveSub::handleIncomingMsg()
|
|||
{
|
||||
// Remove client
|
||||
nlinfo( "FERECV: Disc event for client %u", GETCLIENTA(ihm)->clientId() );
|
||||
removeFromRemoveList(GETCLIENTA(ihm)->clientId() );
|
||||
removeFromRemoveList(GETCLIENTA(ihm)->clientId() );
|
||||
removeClientById( GETCLIENTA(ihm)->clientId() );
|
||||
|
||||
// Do not call handleReceivedMsg()
|
||||
|
@ -398,7 +398,7 @@ CClientHost *CFeReceiveSub::addClient( const NLNET::CInetAddress& addrfrom, TUid
|
|||
}
|
||||
|
||||
CClientHost *clienthost;
|
||||
|
||||
|
||||
// Create client object and add it into the client map
|
||||
TClientId clientid = _ClientIdPool.getNewClientId();
|
||||
if ( clientid == InvalidClientId )
|
||||
|
@ -425,7 +425,7 @@ CClientHost *CFeReceiveSub::addClient( const NLNET::CInetAddress& addrfrom, TUid
|
|||
{
|
||||
nlwarning( "Problem: Inserted twice the same address in the client map" );
|
||||
|
||||
|
||||
|
||||
}
|
||||
MEM_DELTA_MULTI2_MID(Client,AfterInsertClient); // 24
|
||||
CFrontEndService::instance()->PrioSub.VisionProvider.DistanceSpreader.notifyClientAddition( cmPreviousEnd );
|
||||
|
@ -491,7 +491,7 @@ CClientHost *CFeReceiveSub::addClient( const NLNET::CInetAddress& addrfrom, TUid
|
|||
// The client object will be removed when the client exits
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
MEM_DELTA_MULTI2_MID(Client,AfterSendCLConnect);
|
||||
TClientId mon = CFrontEndService::instance()->MonitoredClient;
|
||||
if ( mon != 0 && clientid == mon )
|
||||
|
@ -654,7 +654,7 @@ void CFeReceiveSub::doRemoveClient( CClientHost *client, bool crashed )
|
|||
//if( ! findInReconnectList( client->Uid ) )
|
||||
//nldebug( "disconnecting client %d from login service", client->clientId() );
|
||||
CLoginServer::clientDisconnected( client->Uid );
|
||||
|
||||
|
||||
}
|
||||
|
||||
CFrontEndService::instance()->sendSub()->disableSendBuffer( client->clientId() );
|
||||
|
@ -732,7 +732,7 @@ void CFeReceiveSub::freeIdsOfRemovedClients()
|
|||
{
|
||||
MEM_DELTA_MULTI2(RemClient,FreeIdsOfRemovedClients);
|
||||
CClientHost *clienthost = *ic;
|
||||
|
||||
|
||||
// Display info
|
||||
nlinfo( "FE: Freeing client %u (%s)", clienthost->clientId(), clienthost->address().asString().c_str() );
|
||||
clienthost->displayClientProperties( false );
|
||||
|
@ -740,7 +740,7 @@ void CFeReceiveSub::freeIdsOfRemovedClients()
|
|||
// Reset vision and links in tables
|
||||
clienthost->resetClientVision();
|
||||
removeClientLinks( clienthost );
|
||||
|
||||
|
||||
// Remove all about the client and delete object
|
||||
deleteClient( clienthost );
|
||||
|
||||
|
@ -778,7 +778,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
//nlinfo( "currentsize: %u", currentsize );
|
||||
|
||||
memcpy( Msgin.bufferToFill( currentsize ), _CurrentInMsg->userDataR(), currentsize );
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
uint32 receivednumber;
|
||||
|
@ -842,9 +842,9 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
{
|
||||
// The client has neither been authenticated nor provided a user id, but is allowed to connect (dev mode)
|
||||
nlinfo ("%s using AutoAllocUserid", _CurrentInMsg->AddrFrom.asString().c_str() );
|
||||
string filename = CPath::standardizePath( SaveShardRoot.get() ) + CPath::standardizePath( IService::getInstance()->SaveFilesDirectory.get() ) + "auto_uid_map.bin";
|
||||
string filename = CPath::standardizePath( SaveShardRootGameShare.get() ) + CPath::standardizePath( IService::getInstance()->SaveFilesDirectory.get() ) + "auto_uid_map.bin";
|
||||
|
||||
// Get previously allocated user ids
|
||||
// Get previously allocated user ids
|
||||
if ( _AutoUidMap.empty() )
|
||||
{
|
||||
// Load from file
|
||||
|
@ -858,7 +858,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
{
|
||||
nlinfo( "No AutoAllocUserid data found yet" );
|
||||
}
|
||||
|
||||
|
||||
// Init CurrentAutoAllocUserid
|
||||
TUid maxUid = 0;
|
||||
for ( TAutoUidMap::const_iterator itaum=_AutoUidMap.begin(); itaum!=_AutoUidMap.end(); ++itaum )
|
||||
|
@ -868,7 +868,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
}
|
||||
CurrentAutoAllocUserid = std::max( BaseAutoAllocUserid, maxUid + 1 );
|
||||
}
|
||||
|
||||
|
||||
// Look up the address
|
||||
TAutoUidMap::iterator itaum = _AutoUidMap.find( _CurrentInMsg->AddrFrom.internalIPAddress() );
|
||||
if ( itaum != _AutoUidMap.end() )
|
||||
|
@ -888,7 +888,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
do { uid = CurrentAutoAllocUserid++; }
|
||||
while ( findClientHostByUid( uid ) != NULL );
|
||||
_AutoUidMap.insert( std::make_pair( _CurrentInMsg->AddrFrom.internalIPAddress(), uid ) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Save the allocated user ids
|
||||
|
@ -946,7 +946,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
computeStats( clienthost, receivednumber, currentsize, false );
|
||||
|
||||
nlinfo( "FERECV: Client %u is disconnecting", clienthost->clientId() );
|
||||
removeFromRemoveList( clienthost->clientId() );
|
||||
removeFromRemoveList( clienthost->clientId() );
|
||||
// false because the client, in this case, didn't crashed
|
||||
removeClientById( clienthost->clientId(), false );
|
||||
// actions are automatically removed when deleting blocks
|
||||
|
@ -955,7 +955,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
|
||||
if (code == SYSTEM_QUIT_CODE)
|
||||
{
|
||||
H_AUTO(SystemQuitCode);
|
||||
H_AUTO(SystemQuitCode);
|
||||
uint32 quitId;
|
||||
|
||||
Msgin.serialAndLog1(quitId);
|
||||
|
@ -1027,7 +1027,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
// }
|
||||
// }
|
||||
|
||||
H_AUTO(SwitchConnectionState);
|
||||
H_AUTO(SwitchConnectionState);
|
||||
switch (clienthost->ConnectionState)
|
||||
{
|
||||
case CClientHost::Synchronize:
|
||||
|
@ -1198,7 +1198,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
{
|
||||
// actions are automatically removed when deleting blocks
|
||||
nlinfo( "FERECV: Client %u is disconnecting", clienthost->clientId() );
|
||||
removeFromRemoveList( clienthost->clientId() );
|
||||
removeFromRemoveList( clienthost->clientId() );
|
||||
removeClientById( clienthost->clientId() );
|
||||
// Make stats and set client's receive number
|
||||
// only acknowledge packet number for good normal messages
|
||||
|
@ -1417,7 +1417,7 @@ void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
|||
|
||||
//nlinfo("FERECV: received packet %d from client %d (%d actions decoded): %s", receivednumber, clienthost->clientId(), numActions, debugcat);
|
||||
|
||||
// warning: actions in CActionBlock are automatically removed when deleting block
|
||||
// warning: actions in CActionBlock are automatically removed when deleting block
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,9 +45,6 @@ extern CGenericXmlMsgHeaderManager GenericXmlMsgHeaderMngr;
|
|||
|
||||
extern CVariable<bool> VerboseChatManagement;
|
||||
|
||||
typedef NLMISC::CTwinMap<TChanID, string> TChanTwinMap;
|
||||
extern TChanTwinMap _ChanNames;
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// cbImpulsionReadyString :
|
||||
|
@ -1587,26 +1584,15 @@ void cbDynChatAddChan(CMessage& msgin, const string &serviceName, TServiceId ser
|
|||
bool noBroadcast;
|
||||
bool forwardInput;
|
||||
bool unify;
|
||||
string name;
|
||||
|
||||
msgin.serial(chanID);
|
||||
msgin.serial(noBroadcast);
|
||||
msgin.serial(forwardInput);
|
||||
msgin.serial(unify);
|
||||
msgin.serial(name);
|
||||
|
||||
nlinfo("cbDynChatAddChan: add channel : %s", name.c_str());
|
||||
nlinfo("cbDynChatAddChan: add channel");
|
||||
bool res = IOS->getChatManager().getDynChat().addChan(chanID, noBroadcast, forwardInput, unify);
|
||||
if (!res)
|
||||
nlwarning("Couldn't add chan %s", chanID.toString().c_str());
|
||||
else
|
||||
{
|
||||
if (_ChanNames.getA(name) == NULL && _ChanNames.getB(chanID) == NULL)
|
||||
_ChanNames.add(chanID, name);
|
||||
else
|
||||
nlwarning("Couldn't add chan %s. already added! %p %p", chanID.toString().c_str(), _ChanNames.getA(name), _ChanNames.getB(chanID));
|
||||
nlinfo("cbDynChatAddChan: add channel %s",chanID.toString().c_str());
|
||||
}
|
||||
if (!res) nlwarning("Couldn't add chan %s", chanID.toString().c_str());
|
||||
else nlinfo("cbDynChatAddChan: add channel %s",chanID.toString().c_str());
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
|
@ -1816,23 +1802,7 @@ void cbDynChatSetHideBubble(CMessage& msgin, const string &serviceName, TService
|
|||
chan->HideBubble = hideBubble;
|
||||
}
|
||||
|
||||
void cbDynChatSetUniversalChannel(CMessage& msgin, const string &serviceName, TServiceId serviceId)
|
||||
{
|
||||
TChanID chanID;
|
||||
bool universalChannel;
|
||||
|
||||
msgin.serial(chanID);
|
||||
msgin.serial(universalChannel);
|
||||
|
||||
CChatManager &cm = IOS->getChatManager();
|
||||
CDynChatChan *chan = cm.getDynChat().getChan(chanID);
|
||||
if (!chan)
|
||||
{
|
||||
nlwarning("Unknown chan");
|
||||
return;
|
||||
}
|
||||
chan->UniversalChannel = universalChannel;
|
||||
}
|
||||
|
||||
|
||||
void cbDynChatServiceChat(CMessage& msgin, const string &serviceName, TServiceId serviceId)
|
||||
{
|
||||
|
@ -2102,7 +2072,6 @@ TUnifiedCallbackItem CbIOSArray[]=
|
|||
{ "DYN_CHAT:SERVICE_CHAT", cbDynChatServiceChat }, // a service send a chat message in the channel without sender id
|
||||
{ "DYN_CHAT:SERVICE_TELL", cbDynChatServiceTell }, // a service send a chat message to a specific client in the channel without sender id
|
||||
{ "DYN_CHAT:SET_HIDE_BUBBLE", cbDynChatSetHideBubble }, // a service send a chat message to a specific client in the channel without sender id
|
||||
{ "DYN_CHAT:SET_UNIVERSAL_CHANNEL", cbDynChatSetUniversalChannel },
|
||||
//received from DSS
|
||||
{ "REQUEST_DSR", cbRequestDsr},
|
||||
// { "ADD_DM", cbAddDM }, // A character enter a ring session that he own
|
||||
|
|
|
@ -246,60 +246,6 @@ void CStringManager::clearCache(NLMISC::CLog *log)
|
|||
|
||||
|
||||
|
||||
// load the values using the george sheet
|
||||
void CStringManager::TSheetInfo::readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId)
|
||||
{
|
||||
if (form)
|
||||
{
|
||||
SheetName = sheetId.toString();
|
||||
|
||||
std::string ext = NLMISC::CSheetId::fileExtensionFromType(sheetId.getSheetType());
|
||||
|
||||
SheetName = SheetName.substr(0, SheetName.find(ext));
|
||||
// remove ending '.'
|
||||
if (!SheetName.empty() && *SheetName.rbegin() == '.')
|
||||
SheetName.resize(SheetName.size()-1);
|
||||
|
||||
std::string gender;
|
||||
|
||||
if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("creature"))
|
||||
{
|
||||
form->getRootNode ().getValueByName (gender, "Basics.Gender");
|
||||
sint genderId;
|
||||
NLMISC::fromString(gender, genderId);
|
||||
Gender = GSGENDER::EGender(genderId);
|
||||
|
||||
form->getRootNode ().getValueByName (Race, "Basics.Race");
|
||||
|
||||
// form->getRootNode ().getValueByName (DisplayName, "Basics.First Name");
|
||||
// std::string s;
|
||||
// form->getRootNode ().getValueByName (s, "Basics.CharacterName");
|
||||
// if (!DisplayName.empty())
|
||||
// DisplayName+=' ';
|
||||
// DisplayName+=s;
|
||||
|
||||
form->getRootNode ().getValueByName (Profile, "Basics.Profile");
|
||||
form->getRootNode ().getValueByName (ChatProfile, "Basics.ChatProfile");
|
||||
}
|
||||
else if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("race_stats"))
|
||||
{
|
||||
form->getRootNode ().getValueByName (Race, "Race");
|
||||
}
|
||||
/* else if (sheetId.getType() == NLMISC::CSheetId::typeFromFileExtension("sitem"))
|
||||
{
|
||||
// read any item specific data
|
||||
}
|
||||
*/ else
|
||||
{
|
||||
nlwarning("CStringManager::TEntityInfo : Do not know the type of the sheet '%s'.", sheetId.toString().c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const CStringManager::CEntityWords &CStringManager::getEntityWords(TLanguages lang, STRING_MANAGER::TParamType type) const
|
||||
{
|
||||
nlassert(lang < NB_LANGUAGES);
|
||||
|
|
Loading…
Reference in a new issue