Changed: #878 Fix typos in comments/code

This commit is contained in:
kervala 2011-05-31 22:16:17 +02:00
parent 37cfa5a9f2
commit 4aa2c68151
22 changed files with 101 additions and 49 deletions

View file

@ -99,6 +99,7 @@ struct BNPHeader
fclose(f);
return false;
}
for (uint32 i = 0; i < nNbFile; ++i)
{
uint8 nStringSize = (uint8)Files[i].Name.size();

View file

@ -3064,7 +3064,8 @@ void CEntityCL::updateVisiblePostPos(const NLMISC::TTime &/* currentTimeInMs */,
}
}
if (!_StateFX.empty()) {
if (!_StateFX.empty())
{
// Build a matrix for the fx
NLMISC::CMatrix mat;
mat.identity();
@ -3529,8 +3530,10 @@ CVector CEntityCL::dirToTarget() const
//----------------------------------------------------------------------
void CEntityCL::setStateFx(const std::string &fxName)
{
if (fxName != _StateFXName) {
if (!_StateFX.empty() && Scene) {
if (fxName != _StateFXName)
{
if (!_StateFX.empty() && Scene)
{
Scene->deleteInstance(_StateFX);
}
@ -3556,7 +3559,8 @@ void CEntityCL::setStateFx(const std::string &fxName)
//----------------------------------------------------------------------
void CEntityCL::removeStateFx()
{
if (!_StateFX.empty() && Scene) {
if (!_StateFX.empty() && Scene)
{
Scene->deleteInstance(_StateFX);
_StateFXName = "";
}

View file

@ -187,7 +187,8 @@ struct CStatThread : public NLMISC::IRunnable
{
std::string chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::string s;
for (int i = 0; i < 32; i++) {
for (int i = 0; i < 32; i++)
{
s += chars[uint(frand(float(chars.size())))];
}
return s;

View file

@ -1799,7 +1799,8 @@ void CActionPhraseFaber::updateItemResult()
}
/* Handle change of skill -> recompute success rate */
void CActionPhraseFaber::CSkillObserver::onSkillChange() {
void CActionPhraseFaber::CSkillObserver::onSkillChange()
{
if (ActionPhraseFaber == NULL) ActionPhraseFaber = new CActionPhraseFaber;
// Dont update if the plan has not yet been selected
if(ActionPhraseFaber->_ExecuteFromItemPlanBrick==NULL)

View file

@ -2277,7 +2277,8 @@ public:
CPeopleList::TSortOrder order = (CPeopleList::TSortOrder)(pIM->getDbProp("UI:SAVE:CONTACT_LIST:SORT_ORDER")->getValue32());
order = (CPeopleList::TSortOrder)(order + 1);
if (order == CPeopleList::END_SORT_ORDER) {
if (order == CPeopleList::END_SORT_ORDER)
{
order = CPeopleList::START_SORT_ORDER;
}
@ -2654,8 +2655,10 @@ class CHandlerChatTargetSelected : public IActionHandler
}
else
{
for (uint i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++) {
if (nlstricmp(sParams, "dyn"+toString("%d", i)) == 0) {
for (uint i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
{
if (nlstricmp(sParams, "dyn"+toString("%d", i)) == 0)
{
cf.setTargetGroup(CChatGroup::dyn_chat, i);
}
}

View file

@ -207,12 +207,14 @@ bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b)
ucstring name_b = toUpper(b.getName());
// We want order: online/alpha, offworld/alpha, offline/alpha
if (a.Online == b.Online) {
if (a.Online == b.Online)
{
return (name_a < name_b);
}
else {
// Compare online status
switch (a.Online) {
switch (a.Online)
{
case ccs_online:
// a is > if a is online
return true;
@ -244,7 +246,8 @@ void CPeopleList::sortEx(TSortOrder order)
_BaseContainer->detachContainer(_Peoples[k].Container);
}
switch (order) {
switch (order)
{
default:
case sort_index:
std::sort(_Peoples.begin(), _Peoples.end(), CPeopleList::sortExByContactId);

View file

@ -805,27 +805,35 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
else
{
ucstring::size_type index = finalString.find(ucstring("<BPFX>"));
if (index != ucstring::npos) {
if (index != ucstring::npos)
{
bubbleWanted = false;
finalString = finalString.substr(index+6,finalString.size());
ucstring::size_type index2 = finalString.find(ucstring(" "));
ucstring playerName;
if (index2 < (finalString.size()-3)) {
if (index2 < (finalString.size()-3))
{
playerName = finalString.substr(0,index2);
finalString = finalString.substr(index2+1,finalString.size());
}
if (!senderName.empty())
{
CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true);
if (senderEntity) {
if (senderEntity->Type != CEntityCL::Player) {
if (playerName.empty()) {
if (senderEntity)
{
if (senderEntity->Type != CEntityCL::Player)
{
if (playerName.empty())
{
senderEntity->removeStateFx();
senderEntity->setStateFx(finalString.toString());
nlinfo("empty");
} else {
}
else
{
CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true);
if (destEntity) {
if (destEntity)
{
destEntity->removeStateFx();
destEntity->setStateFx(finalString.toString());
nlinfo("no empty");

View file

@ -361,7 +361,8 @@ bool CUserEntity::build(const CEntitySheet *sheet) // virtual
CInterfaceManager *pIM = CInterfaceManager::getInstance();
{
CCDBNodeLeaf *node = pIM->getDbProp("SERVER:USER:IS_INVISIBLE", false);
if (node) {
if (node)
{
ICDBNode::CTextId textId;
node->addObserver(&_InvisibleObs, textId);
}

View file

@ -1288,7 +1288,8 @@ void CObjectTable::clear()
CHECK_TABLE_INTEGRITY
TContainer::iterator first(_Value.begin());
TContainer::iterator last(_Value.end());
for (; first != last ;++first) {
for (; first != last ;++first)
{
delete first->second;
}
_Value.clear();
@ -3044,7 +3045,8 @@ void CObjectSerializerImpl::serialImpl(NLMISC::IStream& stream, CObject*& data,
-- (serializer->Level);
}
uint endLength = stream.getPos();
if (serializer->Log) {
if (serializer->Log)
{
if (className.empty())
{
nldebug("R2NET: (%u) Table sent %u bytes",serializer->Level, endLength - initLength);

View file

@ -206,9 +206,8 @@ protected:
uint32 _Validation;
};
/*inline std::ostream& operator<<( std::ostream& os,
const CObject& c ) {
/*inline std::ostream& operator<<( std::ostream& os, const CObject& c )
{
c.serialize(os);
return os;
}*/

View file

@ -413,7 +413,8 @@ void CTargetable<T>::removeTargeter(TTargetType type, TPtr const& targeter)
}
NLMISC::CDbgPtr<T> current = _FirstTargeters[type];
while (!current.isNULL()) {
while (!current.isNULL())
{
NLMISC::CDbgPtr<T> next = current->_NextTargeter;
if (next == targeter)
{

View file

@ -37,7 +37,8 @@ extern float getDistBetWeen(CAIEntityPhysical& creat1, CAIEntityPhysical& creat2
template <class TVectorSrc, class TVectorDst>
float buildDecalage(TVectorSrc const& src, TVectorDst const& dst, CAIVector* decalage)
{
if (decalage!=NULL) {
if (decalage!=NULL)
{
CAIVector& vect = *decalage;
vect = dst;
vect -= src;
@ -52,7 +53,9 @@ float buildDecalage(TVectorSrc const& src, TVectorDst const& dst, CAIVector* dec
// End of hack
float normXYZ = (float)sqrt(normXY*normXY + normZ*normZ);
return normXYZ;
} else {
}
else
{
CAIVector vect;
return buildDecalage(src, dst, &vect);
}

View file

@ -261,13 +261,18 @@ static void s_calcRanges(
_RangeMax = CBotProfileFightHeal::fightDefaultMaxRange;
if (_UseFightConfig)
{
if (useFightMelee && (useFightRange || useFightNuke || useFightHeal)) {
if (useFightMelee && (useFightRange || useFightNuke || useFightHeal))
{
_RangeMin = CBotProfileFightHeal::fightMixedMinRange;
_RangeMax = CBotProfileFightHeal::fightMixedMaxRange;
} else if (useFightMelee) {
}
else if (useFightMelee)
{
_RangeMin = CBotProfileFightHeal::fightMeleeMinRange;
_RangeMax = CBotProfileFightHeal::fightMeleeMaxRange;
} else {
}
else
{
_RangeMin = CBotProfileFightHeal::fightRangeMinRange;
_RangeMax = CBotProfileFightHeal::fightRangeMaxRange;
}

View file

@ -874,7 +874,8 @@ void CGroupNpc::delNamedEntityListener(std::string const& name, std::string cons
last = _namedEntityListeners.upper_bound(std::make_pair(name, prop));
while (listener!=last)
{
if (listener->second==event) {
if (listener->second==event)
{
_namedEntityListeners.erase(listener);
CNamedEntityManager::getInstance()->get(name).delListenerGroup(prop, this);
break;
@ -896,7 +897,8 @@ void CGroupNpc::delNamedEntityListener(std::string const& name, std::string cons
last = _namedEntityListeners2.upper_bound(std::make_pair(name, prop));
while (listener!=last)
{
if (listener->second==functionName) {
if (listener->second==functionName)
{
_namedEntityListeners2.erase(listener);
CNamedEntityManager::getInstance()->get(name).delListenerGroup(prop, this);
break;
@ -920,7 +922,8 @@ void CGroupNpc::namedEntityListenerCb(std::string const& name, std::string const
std::queue<NLMISC::TStringId> listeners;
for (listener2=first2; listener2!=last2; ++listener2)
listeners.push(NLMISC::CStringMapper::map(listener2->second));
while(!listeners.empty()) {
while(!listeners.empty())
{
callScriptCallBack(this, listeners.front());
listeners.pop();
}

View file

@ -759,7 +759,8 @@ void loadFile_s_(CStateInstance* entity, CScriptStack& stack)
NLMISC::CIFile file(NLMISC::CPath::lookup(fileName));
vector<string> lines;
while (!file.eof()) {
while (!file.eof())
{
const size_t bufferSize = 4*1024;
char buffer[bufferSize];
file.getline(buffer, bufferSize);

View file

@ -240,7 +240,8 @@ private:
public:
static std::string toString(TFollowReason reason, RYAI_MAP_CRUNCH::CWorldMap::TFindInsideAStarPathReason fIASPReason = RYAI_MAP_CRUNCH::CWorldMap::FIASPR_NO_REASON)
{
switch (reason) {
switch (reason)
{
case FNP_NOT_INITIALIZED:
return "FOLLOW_NO_PATH::NOT_INITIALIZED";
case FNP_NO_INSIDE_ASTAR_PATH:

View file

@ -895,7 +895,8 @@ CCompiler::CCompiler()
const int bufferSize = 256;
char buffer[bufferSize];
while (!file.eof()) {
while (!file.eof())
{
file.getline(buffer, bufferSize);
if (buffer[0]=='#' || buffer[0]=='\0') // Skip lines begining with a # and empty lines
continue;
@ -905,12 +906,15 @@ CCompiler::CCompiler()
string part1, part2, part3;
string::size_type pos1 = line.find(sep1);
if (pos1!=string::npos) {
if (pos1!=string::npos)
{
pos1+=sep1.size();
string::size_type pos2 = line.find(sep2, pos1);
if (pos2!=string::npos) {
if (pos2!=string::npos)
{
pos2+=sep2.size();
if (pos1!=string::npos && pos2!=string::npos) {
if (pos1!=string::npos && pos2!=string::npos)
{
part1 = line.substr(0, pos1-sep1.size()); // begin to sep1
part2 = line.substr(pos1, pos2-pos1-sep2.size()); // sep1 to sep2
part3 = line.substr(pos2); // sep2 to end
@ -918,13 +922,19 @@ CCompiler::CCompiler()
}
}
if (part1.size()!=0 && part2.size()!=0 && part3.size()!=0) {
if (part1=="token") {
if (part1.size()!=0 && part2.size()!=0 && part3.size()!=0)
{
if (part1=="token")
{
addToken(part2, part3);
} else if (part1=="rule") {
}
else if (part1=="rule")
{
addRule(part2, part3);
}
} else {
}
else
{
nlwarning("Invalid script line: \"%s\"", line.c_str());
}
}

View file

@ -73,7 +73,8 @@ void CLibrary::addLib(std::string const& name, std::vector<std::string> const& c
void CLibrary::addLib(std::string const& name, NLMISC::CSmartPtr<CByteCode const> const& byteCode)
{
if (byteCode==NULL) {
if (byteCode==NULL)
{
nlwarning("Trying to register an empty library script.");
return;
}

View file

@ -3447,7 +3447,8 @@ static void parsePrimScript(const IPrimitive *prim, const std::string &mapName,
std::vector<std::string>::const_iterator it = pcode->begin(), itEnd = pcode->end();
code = *it;
++it;
for(; it!=itEnd; ++it) {
for(; it!=itEnd; ++it)
{
code += "\n";
code += *it;
}

View file

@ -4699,7 +4699,8 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_sheet", getSalt());
return false;
}
} else if (command_args[1] == "bot_name")
}
else if (command_args[1] == "bot_name")
{
if (target.getType() == RYZOMID::player)
{

View file

@ -105,7 +105,8 @@ void COutpostSquadDescriptor::init(NLMISC::CSheetId sheet, TAIAlias alias, const
_Alias = alias;
_Form = CSheets::getOutpostSquadForm(_Sheet);
nlassertex(_Form, ("Squad sheet %s not found", _Sheet.toString().c_str()));
// if (!(_Form)) {
// if (!(_Form))
// {
// NLMISC::createDebug ();
// NLMISC::AssertLog->setPosition (__LINE__, __FILE__, __FUNCTION__);
// NLMISC::AssertLog->displayRawNL ("Squad sheet %s not found", _Sheet.toString().c_str()); // BUG with unsetPosition() called twice

View file

@ -736,7 +736,8 @@ void cleanComment(const std::string & filename)
else
{
ucstring::size_type commentEnd = text.find(ucstring("\n"), commentBegin);
if (commentEnd != ucstring::npos) {
if (commentEnd != ucstring::npos)
{
commentEnd += 1;
ucstring comment = text.substr(commentBegin, commentEnd - commentBegin);
if (comment.find(ucstring("// HASH_VALUE")) != ucstring::npos