Changed: #1433 Merge changes from patch 1.13
This commit is contained in:
parent
7523a91fe1
commit
dbb327deb0
7 changed files with 52 additions and 2 deletions
|
@ -342,6 +342,8 @@ std::string secondsToHumanReadable (uint32 time);
|
|||
/// Get a bytes or time in string format and convert it in seconds or bytes
|
||||
uint32 fromHumanReadable (const std::string &str);
|
||||
|
||||
/// Add digit grouping seperator to if value >= 10 000. Assumes input is numerical string.
|
||||
std::string formatThousands(const std::string& s);
|
||||
|
||||
/// This function executes a program in the background and returns instantly (used for example to launch services in AES).
|
||||
/// The program will be launched in the current directory
|
||||
|
|
|
@ -146,6 +146,8 @@ public:
|
|||
|
||||
TAdditionalInfoCb EntityInfoCallback;
|
||||
|
||||
static void removeShardFromName(ucstring& name);
|
||||
|
||||
private:
|
||||
// get all eid for a user using the user name or the user id
|
||||
void getByUser (uint32 uid, std::vector<NLMISC::CEntityId> &res);
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
enum TProp {
|
||||
PropUInt8, PropUInt16, PropUInt32, PropUInt64,
|
||||
PropSInt8, PropSInt16, PropSInt32, PropSInt64,
|
||||
PropBool, PropFloat, PropDouble, PropString, PropDataSetRow, PropSheetId, PropUKN };
|
||||
PropBool, PropFloat, PropDouble, PropString, PropDataSetRow, PropSheetId, PropUCString, PropUKN };
|
||||
// PropBool, PropFloat, PropDouble, PropString, PropDataSetRow, PropEntityId, PropSheetId, PropUKN };
|
||||
|
||||
|
||||
|
@ -160,6 +160,7 @@ public:
|
|||
case PropString: nlassert(sizeof(T) == sizeof (std::string)); break;
|
||||
// case PropEntityId: nlassert(sizeof(T) == sizeof (NLMISC::CEntityId)); break;
|
||||
case PropSheetId: nlassert(sizeof(T) == sizeof (NLMISC::CSheetId)); break;
|
||||
case PropUCString: nlassert(sizeof(T) == sizeof (ucstring)); break;
|
||||
default: nlerror ("property %s have unknown type %d", name.c_str(), type);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "nel/misc/command.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/i18n.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -526,6 +527,31 @@ void toUpper(char *str)
|
|||
}
|
||||
}
|
||||
|
||||
std::string formatThousands(const std::string& s)
|
||||
{
|
||||
int i, k;
|
||||
int remaining = s.length() - 1;
|
||||
static std::string separator = NLMISC::CI18N::get("uiThousandsSeparator").toUtf8();
|
||||
|
||||
// Don't add separator if the number is < 10k
|
||||
if (remaining < 4) return s;
|
||||
|
||||
std::string ns;
|
||||
|
||||
do
|
||||
{
|
||||
for (i = remaining, k = 0; i >= 0 && k < 3; --i, ++k )
|
||||
{
|
||||
ns = s[i] + ns; // New char is added to front of ns
|
||||
if ( i > 0 && k == 2) ns = separator + ns; // j > 0 means still more digits
|
||||
}
|
||||
|
||||
remaining -= 3;
|
||||
}
|
||||
while (remaining >= 0);
|
||||
|
||||
return ns;
|
||||
}
|
||||
|
||||
//
|
||||
// Exceptions
|
||||
|
|
|
@ -417,6 +417,17 @@ void CEntityIdTranslator::checkEntity (const CEntityId &eid, const ucstring &ent
|
|||
}
|
||||
}
|
||||
|
||||
void CEntityIdTranslator::removeShardFromName(ucstring& name)
|
||||
{
|
||||
// The string must contain a '(' and a ')'
|
||||
ucstring::size_type p0= name.find('(');
|
||||
ucstring::size_type p1= name.find(')');
|
||||
if (p0 == ucstring::npos || p1 == ucstring::npos || p1 <= p0)
|
||||
return;
|
||||
|
||||
name = name.substr(0, p0) + name.substr(p1 + 1);
|
||||
}
|
||||
|
||||
// this callback is call when the file is changed
|
||||
void cbInvalidEntityNamesFilename(const std::string &invalidEntityNamesFilename)
|
||||
{
|
||||
|
|
|
@ -153,6 +153,13 @@ bool CWinEventEmitter::processMessage (HWND hWnd, uint32 msg, WPARAM wParam, LPA
|
|||
if ((int)wParam==VK_SHIFT)
|
||||
_ShiftButton=false;
|
||||
|
||||
// As Print Screen button does not trigger a WM_KEYDOWN msg, simulate it here
|
||||
if ((int)wParam==VK_SNAPSHOT)
|
||||
{
|
||||
if (wParam < KeyCount)
|
||||
server->postEvent (new CEventKeyDown ((NLMISC::TKey)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), true, this));
|
||||
}
|
||||
|
||||
// Post the message
|
||||
if (wParam < KeyCount)
|
||||
server->postEvent (new CEventKeyUp ((NLMISC::TKey)wParam, getKeyButton(_AltButton, _ShiftButton, _CtrlButton), this));
|
||||
|
|
|
@ -77,7 +77,7 @@ string typeToString (CTransportClass::TProp type)
|
|||
string conv[] = {
|
||||
"PropUInt8", "PropUInt16", "PropUInt32", "PropUInt64",
|
||||
"PropSInt8", "PropSInt16", "PropSInt32", "PropSInt64",
|
||||
"PropBool", "PropFloat", "PropDouble", "PropString", "PropDataSetRow", "PropSheetId", "PropUKN" };
|
||||
"PropBool", "PropFloat", "PropDouble", "PropString", "PropDataSetRow", "PropSheetId", "PropUCString", "PropUKN" };
|
||||
// "PropBool", "PropFloat", "PropDouble", "PropString", "PropDataSetRow", "PropEntityId", "PropSheetId", "PropUKN" };
|
||||
|
||||
if (type > CTransportClass::PropUKN)
|
||||
|
@ -352,6 +352,7 @@ void CTransportClass::init ()
|
|||
// nlassert (PropDataSetRow < PropUKN); DummyProp[PropDataSetRow] = new CTransportClass::CRegisteredProp<TDataSetRow>;
|
||||
// nlassert (PropEntityId < PropUKN); DummyProp[PropEntityId] = new CTransportClass::CRegisteredProp<CEntityId>;
|
||||
nlassert (PropSheetId < PropUKN); DummyProp[PropSheetId] = new CTransportClass::CRegisteredProp<CSheetId>;
|
||||
nlassert (PropUCString < PropUKN); DummyProp[PropUCString] = new CTransportClass::CRegisteredProp<ucstring>;
|
||||
|
||||
// we have to know when a service comes, so add callback (put the callback before all other one because we have to send this message first)
|
||||
CUnifiedNetwork::getInstance()->setServiceUpCallback("*", cbTCUpService, NULL, false);
|
||||
|
|
Loading…
Reference in a new issue