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]; uint8 actionType=ActionType[i];
if ( ( actionType!=ACTNATURE::FIGHT if ( ( actionType!=ACTNATURE::FIGHT
|| actionType!=ACTNATURE::OFFENSIVE_MAGIC && actionType!=ACTNATURE::OFFENSIVE_MAGIC
|| actionType!=ACTNATURE::CURATIVE_MAGIC ) && actionType!=ACTNATURE::CURATIVE_MAGIC )
&& AggroAdd[i]==0 ) && AggroAdd[i]==0 )
continue; continue;

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

@ -137,15 +137,8 @@ public:
//friend void CWorldEntity::createPrimitive(NLPACS::UMoveContainer *pMoveContainer, uint8 worldImage); //friend void CWorldEntity::createPrimitive(NLPACS::UMoveContainer *pMoveContainer, uint8 worldImage);
friend void CWorldEntity::removePrimitive(); 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 /// 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 CHashMap<TDataSetRow, CWorldEntity *, TDataSetRow::CHashCode> TWorldEntityContainer;
typedef CCell **TWorldCellsMap; typedef CCell **TWorldCellsMap;
@ -164,7 +157,7 @@ public:
typedef std::list< CWorldEntity * > TRemovedEntityContainer; typedef std::list< CWorldEntity * > TRemovedEntityContainer;
typedef std::set< NLMISC::CEntityId > TSetId; 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; //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); uint32 stringId = ew.getStringId(rowIndex, colIndex);
const std::string &str = SM->getString(stringId).toString(); std::string str = NLMISC::toLowerAscii(SM->getString(stringId).toString());
NLMISC::strlwr(str);
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()); 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; std::string op1;
if (cond.Property == "name") if (cond.Property == "name")
{ {
op1 = NLMISC::toLower(si.SheetName); op1 = NLMISC::toLowerAscii(si.SheetName);
} }
else if (cond.Property == "gender") else if (cond.Property == "gender")
{ {
op1 = NLMISC::toLower(GSGENDER::toString(si.Gender)); op1 = NLMISC::toLowerAscii(GSGENDER::toString(si.Gender));
} }
else else
{ {
@ -988,7 +987,7 @@ public:
return false; return false;
} }
const CStringManager::TSheetInfo &si = SM->getSheetInfo(sheetId); const CStringManager::TSheetInfo &si = SM->getSheetInfo(sheetId);
op1 = NLMISC::toLower(si.SheetName); op1 = NLMISC::toLowerAscii(si.SheetName);
} }
else if (cond.Property == "gender") 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()); nlwarning("Could not find character info for EId %s to check property %s", EId.toString().c_str(), cond.Property.c_str());
return false; return false;
} }
op1 = NLMISC::toLower(GSGENDER::toString(charInfo->getGender())); op1 = NLMISC::toLowerAscii(GSGENDER::toString(charInfo->getGender()));
} }
else else
{ {
@ -1084,14 +1083,14 @@ public:
} }
else if (cond.Property == "role") else if (cond.Property == "role")
{ {
op1 = NLMISC::toLower(si.ChatProfile); op1 = NLMISC::toLowerAscii(si.ChatProfile);
} }
else if (cond.Property == "title") else if (cond.Property == "title")
{ {
// we need to retrieve the charInfo // we need to retrieve the charInfo
CCharacterInfos *ci = IOS->getCharInfos(EId); CCharacterInfos *ci = IOS->getCharInfos(EId);
if (ci != NULL) if (ci != NULL)
op1 = NLMISC::toLower(ci->Title); op1 = NLMISC::toLowerAscii(ci->Title);
else else
{ {
nlwarning("No character info for bot %s, can't test property 'title' !", EId.toString().c_str()); 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 // check if checked property is gender or name
if (cond.Property == "gender") if (cond.Property == "gender")
{ {
value = NLMISC::toLower(GSGENDER::toString(charInfo->getGender())); value = NLMISC::toLowerAscii(GSGENDER::toString(charInfo->getGender()));
} }
else if (cond.Property == "name") else if (cond.Property == "name")
{ {
value = NLMISC::toLower(charInfo->ShortName.toString()); value = NLMISC::toLowerAscii(charInfo->ShortName.toString());
} }
else else
{ {

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

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

Loading…
Cancel
Save