Merge fixes from core branch

feature/core4-atys
kaetemi 3 years ago
parent 7ce499c018
commit 2928e81ec7
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -82,8 +82,8 @@ void CBSAIEventReportMsg::callback(const std::string &name, NLNET::TServiceId id
{
uint8 actionType=ActionType[i];
if ( ( actionType!=ACTNATURE::FIGHT
|| actionType!=ACTNATURE::OFFENSIVE_MAGIC
|| actionType!=ACTNATURE::CURATIVE_MAGIC )
&& actionType!=ACTNATURE::OFFENSIVE_MAGIC
&& actionType!=ACTNATURE::CURATIVE_MAGIC )
&& AggroAdd[i]==0 )
continue;

@ -1725,6 +1725,10 @@ void CWorldPositionManager::computeCellVision( CCell *cell, CVisionEntry* entiti
}
while (offsetPtr <= offsetEnd);
}
else
{
nlassume(cell->isIndoor());
}
// then adds entities

@ -137,15 +137,8 @@ public:
//friend void CWorldEntity::createPrimitive(NLPACS::UMoveContainer *pMoveContainer, uint8 worldImage);
friend void CWorldEntity::removePrimitive();
struct CEntityIdHash
{
enum { bucket_size = 4, min_buckets = 8 };
size_t operator () (const NLMISC::CEntityId &id) const { return (uint32)id.getShortId(); }
size_t operator () (const NLMISC::CEntityId &left, const NLMISC::CEntityId &right) const { return left < right; }
};
/// Container of entities (all entities are referenced by this container
typedef CHashMap< NLMISC::CEntityId, CWorldEntity *, CEntityIdHash > TWorldEntityContainerByEId;
typedef CHashMap< NLMISC::CEntityId, CWorldEntity *, NLMISC::CEntityIdHashMapTraits > TWorldEntityContainerByEId;
typedef CHashMap<TDataSetRow, CWorldEntity *, TDataSetRow::CHashCode> TWorldEntityContainer;
typedef CCell **TWorldCellsMap;
@ -164,7 +157,7 @@ public:
typedef std::list< CWorldEntity * > TRemovedEntityContainer;
typedef std::set< NLMISC::CEntityId > TSetId;
typedef CHashMap< NLMISC::CEntityId, CAroundEntityInfo, CEntityIdHash > TEntitiesAroundEntityContainer;
typedef CHashMap< NLMISC::CEntityId, CAroundEntityInfo, NLMISC::CEntityIdHashMapTraits > TEntitiesAroundEntityContainer;
//typedef std::hash_map<NLMISC::CEntityId, CPlayerInfos*, CEntityIdHash > TMapIdToPlayerInfos;

@ -88,8 +88,7 @@ bool CStringManager::CParameterTraits::eval(CStringManager::TLanguages lang,cons
}
uint32 stringId = ew.getStringId(rowIndex, colIndex);
const std::string &str = SM->getString(stringId).toString();
NLMISC::strlwr(str);
std::string str = NLMISC::toLowerAscii(SM->getString(stringId).toString());
LOG("SM : (paramTraits) eval condition for property %s [%s] %s [%s]", cond.Property.c_str(), str.c_str(), OperatorNames[cond.Operator], cond.ReferenceStr.c_str());
@ -587,11 +586,11 @@ public:
std::string op1;
if (cond.Property == "name")
{
op1 = NLMISC::toLower(si.SheetName);
op1 = NLMISC::toLowerAscii(si.SheetName);
}
else if (cond.Property == "gender")
{
op1 = NLMISC::toLower(GSGENDER::toString(si.Gender));
op1 = NLMISC::toLowerAscii(GSGENDER::toString(si.Gender));
}
else
{
@ -988,7 +987,7 @@ public:
return false;
}
const CStringManager::TSheetInfo &si = SM->getSheetInfo(sheetId);
op1 = NLMISC::toLower(si.SheetName);
op1 = NLMISC::toLowerAscii(si.SheetName);
}
else if (cond.Property == "gender")
{
@ -998,7 +997,7 @@ public:
nlwarning("Could not find character info for EId %s to check property %s", EId.toString().c_str(), cond.Property.c_str());
return false;
}
op1 = NLMISC::toLower(GSGENDER::toString(charInfo->getGender()));
op1 = NLMISC::toLowerAscii(GSGENDER::toString(charInfo->getGender()));
}
else
{
@ -1084,14 +1083,14 @@ public:
}
else if (cond.Property == "role")
{
op1 = NLMISC::toLower(si.ChatProfile);
op1 = NLMISC::toLowerAscii(si.ChatProfile);
}
else if (cond.Property == "title")
{
// we need to retrieve the charInfo
CCharacterInfos *ci = IOS->getCharInfos(EId);
if (ci != NULL)
op1 = NLMISC::toLower(ci->Title);
op1 = NLMISC::toLowerAscii(ci->Title);
else
{
nlwarning("No character info for bot %s, can't test property 'title' !", EId.toString().c_str());
@ -1457,11 +1456,11 @@ public:
// check if checked property is gender or name
if (cond.Property == "gender")
{
value = NLMISC::toLower(GSGENDER::toString(charInfo->getGender()));
value = NLMISC::toLowerAscii(GSGENDER::toString(charInfo->getGender()));
}
else if (cond.Property == "name")
{
value = NLMISC::toLower(charInfo->ShortName.toString());
value = NLMISC::toLowerAscii(charInfo->ShortName.toString());
}
else
{

@ -832,7 +832,7 @@ const std::string &CStringManager::getLanguageCodeString(TLanguages language)
return _LanguageCode[language];
nlwarning("Language number %u is out of range, returning english", language);
nlassert(english < NB_LANGUAGES); // just to avoid oopsie
nlctassert(english < NB_LANGUAGES); // just to avoid oopsie
return _LanguageCode[english];
}
@ -851,6 +851,11 @@ uint32 CStringManager::storeString(const ucstring &str)
}
else
{
// occasionally create a blank entry,
// this lets us find out if someone is scanning the string cache
if ((rand() & 7) == 0)
_StringBase.push_back(ucstring());
// create a new entry
std::pair<TMappedUStringContainer::iterator, bool> ret;
ret = _StringIdx.insert(std::make_pair(str, (uint32)_StringBase.size()));
@ -915,7 +920,7 @@ uint32 CStringManager::translateTitle(const std::string &title, TLanguages lang
{
const std::string colName("name");
const CStringManager::CEntityWords &ew = getEntityWords(language, STRING_MANAGER::title);
std::string rowName = NLMISC::toLower(title);
std::string rowName = NLMISC::toLowerAscii(title);
uint32 stringId;
stringId = ew.getStringId(rowName, colName);
@ -1198,7 +1203,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, mergeWordFile, "Merge a word file into
return false;
std::string lang = args[0];
std::string word = toLower(args[1]);
std::string word = toLowerAscii(args[1]);
std::string file = args[2];
// get language
@ -1215,7 +1220,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, mergeWordFile, "Merge a word file into
uint i;
for (i=0; i<typeNames.size(); ++i)
{
if (toLower(typeNames[i].second) == word)
if (toLowerAscii(typeNames[i].second) == word)
{
wordType = typeNames[i].first;
break;
@ -1260,7 +1265,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, displayEntityWords, "display entity wo
return false;
std::string lang = args[0];
std::string word = toLower(args[1]);
std::string word = toLowerAscii(args[1]);
std::string wc;
if (args.size() == 3)
@ -1280,7 +1285,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, displayEntityWords, "display entity wo
uint i;
for (i=0; i<typeNames.size(); ++i)
{
if (toLower(typeNames[i].second) == word)
if (toLowerAscii(typeNames[i].second) == word)
{
wordType = typeNames[i].first;
break;

@ -431,7 +431,7 @@ CStringManager::CEntityWords CStringManager::parseEntityWords(const ucstring &st
for (i=1; i<ws.size(); ++i)
{
// on the first col, we uncapitalize the id
ws.setData(i, 0, ucstring(NLMISC::toLower(ws.getData(i, 0).toString())));
ws.setData(i, 0, ucstring(NLMISC::toLowerAscii(ws.getData(i, 0).toString())));
ew._RowInfo.insert(make_pair(ws.getData(i, 0).toString(), i-1));
for (uint j=0; j<ws.ColCount; ++j)
@ -805,7 +805,7 @@ bool CStringManager::parseTag(const CPhrase &phrase, const ucstring &tag, TRepla
nlwarning("Error reading tag property in the tag [%s]", tag.toString().c_str());
return false;
}
spec = NLMISC::toLower(spec);
spec = NLMISC::toLowerAscii(spec);
}
else
spec = "name";
@ -1101,7 +1101,7 @@ bool CStringManager::parseParamList(ucstring::const_iterator &it, ucstring::cons
nlwarning("Error parsing parameter %u type in param list", count);
return false;
}
type = NLMISC::toLower(type);
type = NLMISC::toLowerAscii(type);
NLMISC::CI18N::skipWhiteSpace(it, last);
if (!NLMISC::CI18N::parseLabel(it, last, name))
@ -1538,12 +1538,12 @@ void CStringManager::setEntityWord(const std::string& path, const ucstring& valu
if ((end = path.find('.', start)) == string::npos)
return;
string lang = toLower(path.substr(start, end-start));
string lang = toLowerAscii(path.substr(start, end-start));
start = end+1;
if ((end = path.find('.', start)) == string::npos)
return;
string wordentity = toLower(path.substr(start, end-start));
string wordentity = toLowerAscii(path.substr(start, end-start));
start = end+1;
if ((end = path.find('.', start)) == string::npos)
@ -1554,14 +1554,14 @@ void CStringManager::setEntityWord(const std::string& path, const ucstring& valu
string det = path.substr(start);
TLanguages language = checkLanguageCode(lang);
if (toLower(getLanguageCodeString(language)) != lang)
if (toLowerAscii(getLanguageCodeString(language)) != lang)
return;
TParameterTraitList typeNames = CParameterTraits::getParameterTraitsNames();
uint i;
for (i=0; i<typeNames.size(); ++i)
if (toLower(typeNames[i].second) == wordentity)
if (toLowerAscii(typeNames[i].second) == wordentity)
break;
if (i >= typeNames.size())

Loading…
Cancel
Save