Batch of fixes for server

ryzomclassic-develop
kaetemi 5 years ago committed by Jan Boon
parent 6cdee90e4e
commit 5a543239bb

@ -785,9 +785,9 @@ retry_pending_command:
if (buffer.FrameStart == buffer.FrameEnd) if (buffer.FrameStart == buffer.FrameEnd)
{ {
// the buffer is empty // the buffer is empty
ret.push_back(0); ret.push_back(std::string());
ret.push_back(0); ret.push_back(std::string());
ret.push_back(0); ret.push_back(std::string());
} }
else else
{ {

@ -243,7 +243,7 @@ void CSpawnBotNpc::updateChat(CAIState const* state)
// update chat information if any // update chat information if any
CNpcChatProfileImp const* const chatProfile = botNpc.getChat(); CNpcChatProfileImp const* const chatProfile = botNpc.getChat();
if (!chatProfile) if (chatProfile)
{ {
_CurrentChatProfile = CNpcChatProfileImp::combineChatProfile(*chatProfile, itChat->getChat()); _CurrentChatProfile = CNpcChatProfileImp::combineChatProfile(*chatProfile, itChat->getChat());
// the chat profile has been combined, send it to EGS // the chat profile has been combined, send it to EGS

@ -636,7 +636,7 @@ static CAIVector randomPos(double dispersionRadius)
{ {
return CAIVector(0., 0.); return CAIVector(0., 0.);
} }
const uint32 maxLimit = std::numeric_limits<uint32>::max() >> 1; static const uint32 maxLimit = std::numeric_limits<uint32>::max() >> 1;
double rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[ double rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[
double r = dispersionRadius*sqrt(rval); double r = dispersionRadius*sqrt(rval);
rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[ rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[

@ -1153,7 +1153,7 @@ NLMISC_COMMAND(displayOutposts, "list the available outpost", "")
if (args.size() > 0) if (args.size() > 0)
return false; return false;
uint32 instanceNumber = std::numeric_limits<uint32>::max(); static const uint32 instanceNumber = std::numeric_limits<uint32>::max();
for (uint i=0; i<CAIS::instance().AIList().size(); ++i) for (uint i=0; i<CAIS::instance().AIList().size(); ++i)
{ {
CAIInstance *const aii = CAIS::instance().AIList()[i]; CAIInstance *const aii = CAIS::instance().AIList()[i];

@ -79,8 +79,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;

@ -695,7 +695,7 @@ static CAIVector randomPos(double dispersionRadius)
{ {
return CAIVector(0., 0.); return CAIVector(0., 0.);
} }
uint32 const maxLimit=(std::numeric_limits<uint32>::max())>>1; static const uint32 maxLimit = std::numeric_limits<uint32>::max() >> 1;
double rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[ double rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[
double r = dispersionRadius*sqrt(rval); double r = dispersionRadius*sqrt(rval);
rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[ rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[

@ -2067,7 +2067,7 @@ public:
CGrpFauna *grpFauna = safe_cast<CGrpFauna*>(group); CGrpFauna *grpFauna = safe_cast<CGrpFauna*>(group);
CGrpFauna::TPlaces place; CGrpFauna::TPlaces place;
_Activity == fa_rest ? place = CGrpFauna::REST_PLACE : CGrpFauna::EAT_PLACE; place = (_Activity == fa_rest ? CGrpFauna::REST_PLACE : CGrpFauna::EAT_PLACE);
// change the state of the fauna group if needed // change the state of the fauna group if needed
// lookup for the cycle we want // lookup for the cycle we want
uint32 i; uint32 i;

@ -397,8 +397,9 @@ CKnapsackSolver::CKnapsackSolver(IKnapsackContext* context, bool* _take)
{ {
if (_take==NULL && size()!=0) if (_take==NULL && size()!=0)
{ {
_Take = new bool[size()]; size_t sz = size();
for (size_t i=0; i<size(); ++i) _Take = new bool[sz];
for (size_t i = 0; i < sz; ++i)
_Take[i] = false; _Take[i] = false;
} }
else else

@ -230,7 +230,7 @@ void CMirrors::processMirrorUpdates()
DataSet->getNextChangedValue( entityIndex, propIndex ); DataSet->getNextChangedValue( entityIndex, propIndex );
while (entityIndex != LAST_CHANGED) while (entityIndex != LAST_CHANGED)
{ {
if (propIndex == DSPropertyPOSX || propIndex == DSPropertyPOSX ) if (propIndex == DSPropertyPOSX || propIndex == DSPropertyPOSY )
{ {
const CEntityId &entityId=DataSet->getEntityId(entityIndex); const CEntityId &entityId=DataSet->getEntityId(entityIndex);
if (entityId.getType() == RYZOMID::player) if (entityId.getType() == RYZOMID::player)

@ -265,6 +265,7 @@ void CDirectionMap::serial(NLMISC::IStream& f)
{ {
if (f.isReading()) if (f.isReading())
Layers[i] = new CDirectionLayer(); Layers[i] = new CDirectionLayer();
nlassert(Layers[i]);
f.serial(*Layers[i]); f.serial(*Layers[i]);
} }
} }
@ -430,6 +431,7 @@ void CMultiLayerCell::serial(NLMISC::IStream& f)
} }
else else
{ {
nlassert(_Layers[slot]);
I16x16Layer::save(f, _Layers[slot]->_HeightMap); I16x16Layer::save(f, _Layers[slot]->_HeightMap);
} }
@ -657,6 +659,7 @@ void CWorldMap::serial(NLMISC::IStream &f)
if (present) if (present)
{ {
//nldebug("Save SuperCell %d/%d", i, j); //nldebug("Save SuperCell %d/%d", i, j);
nlassert(_GridFastAccess[i]);
f.serial(*(_GridFastAccess[i])); f.serial(*(_GridFastAccess[i]));
} }

@ -1673,6 +1673,7 @@ void CTopology::serial(NLMISC::IStream& f)
if (f.isReading()) if (f.isReading())
DirectionMap = new CDirectionMap(); DirectionMap = new CDirectionMap();
nlassert(DirectionMap);
f.serial(*DirectionMap); f.serial(*DirectionMap);
} }

@ -430,6 +430,7 @@ bool CExitDestination::isUserAllowed(CCharacter * user, uint16 ownerIdx)
if (user && user->isDead()) if (user && user->isDead())
return false; return false;
nlassert(user);
CMirrorPropValueRO<TYPE_CELL> mirrorCell( TheDataset, user->getEntityRowId(), DSPropertyCELL ); CMirrorPropValueRO<TYPE_CELL> mirrorCell( TheDataset, user->getEntityRowId(), DSPropertyCELL );
sint32 cell = mirrorCell; sint32 cell = mirrorCell;
const IRoomInstance * room = CBuildingManager::getInstance()->getRoomInstanceFromCell( cell ); const IRoomInstance * room = CBuildingManager::getInstance()->getRoomInstanceFromCell( cell );

@ -986,6 +986,10 @@ void CPlayerService::egsAddMonkeyPlayer()
} }
idx++; idx++;
} }
else
{
return;
}
} }
if( PlayerManager.getPlayer( userId ) != 0 ) if( PlayerManager.getPlayer( userId ) != 0 )

@ -140,7 +140,7 @@ public:
_ExceptionString = std::string("<CEntityBase> : Invalid stat name ") + var; _ExceptionString = std::string("<CEntityBase> : Invalid stat name ") + var;
return _ExceptionString.c_str(); return _ExceptionString.c_str();
} }
virtual ~EInvalidStat() throw() {} virtual ~EInvalidStat() NL_OVERRIDE {}
private: private:
mutable std::string _ExceptionString; mutable std::string _ExceptionString;
}; };

@ -81,10 +81,8 @@ void CForageProgress::reportXP( CCharacter *extractor, const CHarvestSource *sou
{ {
H_AUTO(CForageProgress_reportXP); H_AUTO(CForageProgress_reportXP);
#if !FINAL_VERSION
nlassert(extractor); nlassert(extractor);
nlassert(source); nlassert(source);
#endif
// Don't earn any XP for anyone if the quantity is 0 // Don't earn any XP for anyone if the quantity is 0
if ( amount() == 0 ) if ( amount() == 0 )

@ -599,6 +599,7 @@ class CMissionActionRecvItem : public IMissionAction
instance->getEntities(entities); instance->getEntities(entities);
if ( entities.empty() ) if ( entities.empty() )
return; return;
nlassert(instance);
if ( dynamic_cast<CMissionSolo*>(instance) ) if ( dynamic_cast<CMissionSolo*>(instance) )
{ {
if ( _Group ) if ( _Group )
@ -957,6 +958,7 @@ class CMissionActionRecvNamedItem : public IMissionAction
instance->getEntities(entities); instance->getEntities(entities);
if ( entities.empty() ) if ( entities.empty() )
return; return;
nlassert(instance);
if ( dynamic_cast<CMissionSolo*>(instance) ) if ( dynamic_cast<CMissionSolo*>(instance) )
{ {
if ( _Group ) if ( _Group )
@ -1624,6 +1626,7 @@ class CMissionActionLearnBrick : public IMissionAction
instance->getEntities(entities); instance->getEntities(entities);
if ( entities.empty() ) if ( entities.empty() )
return; return;
nlassert(instance);
if ( dynamic_cast<CMissionSolo*>(instance) ) if ( dynamic_cast<CMissionSolo*>(instance) )
{ {
if ( _Group ) if ( _Group )
@ -1768,6 +1771,7 @@ class CMissionActionUnlearnBrick : public IMissionAction
instance->getEntities(entities); instance->getEntities(entities);
if ( entities.empty() ) if ( entities.empty() )
return; return;
nlassert(instance);
if ( dynamic_cast<CMissionSolo*>(instance) ) if ( dynamic_cast<CMissionSolo*>(instance) )
{ {
if ( _Group ) if ( _Group )
@ -4356,7 +4360,7 @@ class CMissionActionSetRespawnPoints : public IMissionAction
CMissionParser::tokenizeString(script[2], ";", args); CMissionParser::tokenizeString(script[2], ";", args);
// check that the given respawn points exist and are all in the same continent // check that the given respawn points exist and are all in the same continent
CONTINENT::TContinent lastContinent; CONTINENT::TContinent lastContinent = CONTINENT::UNKNOWN;
for (uint i = 0; i < args.size(); i++) for (uint i = 0; i < args.size(); i++)
{ {
string respawnPointName = CMissionParser::getNoBlankString(args[i]); string respawnPointName = CMissionParser::getNoBlankString(args[i]);

@ -650,6 +650,7 @@ CMissionEvent::TResult CMissionBaseBehaviour::processEvent( const TDataSetRow &
{ {
MISDBG("%s ok, step %u done -> mission completed", sDebugPrefix.c_str(), currentStep->getIndexInTemplate() ); MISDBG("%s ok, step %u done -> mission completed", sDebugPrefix.c_str(), currentStep->getIndexInTemplate() );
templ->AlreadyDone = true; templ->AlreadyDone = true;
nlassert(user);
if(!user->isShopingListInProgress()) if(!user->isShopingListInProgress())
user->endBotChat(); user->endBotChat();
return CMissionEvent::MissionEnds; return CMissionEvent::MissionEnds;
@ -660,6 +661,7 @@ CMissionEvent::TResult CMissionBaseBehaviour::processEvent( const TDataSetRow &
MISDBG("%s ok, step %u done -> mission failed", sDebugPrefix.c_str(), currentStep->getIndexInTemplate() ); MISDBG("%s ok, step %u done -> mission failed", sDebugPrefix.c_str(), currentStep->getIndexInTemplate() );
_ProcessingState = Normal; _ProcessingState = Normal;
onFailure( true ); onFailure( true );
nlassert(user);
if(!user->isShopingListInProgress()) if(!user->isShopingListInProgress())
user->endBotChat(); user->endBotChat();
return CMissionEvent::MissionFailed; return CMissionEvent::MissionFailed;

@ -414,28 +414,31 @@ public:
} }
CRingRewardPoints &rrp = ic->getRingRewardPoints(); CRingRewardPoints &rrp = ic->getRingRewardPoints();
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal); if (scenario)
CRingRewardPoints::TGenerateRewardResult result = rrp.generateReward(scenario->getSessionLevel());
switch(result)
{ {
case CRingRewardPoints::grr_ok: SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal = rewardText; CRingRewardPoints::TGenerateRewardResult result = rrp.generateReward(scenario->getSessionLevel());
break; switch (result)
case CRingRewardPoints::grr_ok_rare: {
params[0].Literal = rareRewardText; case CRingRewardPoints::grr_ok:
break; params[0].Literal = rewardText;
case CRingRewardPoints::grr_no_place: break;
params[0].Literal = inventoryFullText; case CRingRewardPoints::grr_ok_rare:
break; params[0].Literal = rareRewardText;
case CRingRewardPoints::grr_no_points: break;
params[0].Literal = notEnoughPointsText; case CRingRewardPoints::grr_no_place:
break; params[0].Literal = inventoryFullText;
case CRingRewardPoints::grr_invalid: break;
default: case CRingRewardPoints::grr_no_points:
params[0].Literal = ""; params[0].Literal = notEnoughPointsText;
break;
case CRingRewardPoints::grr_invalid:
default:
params[0].Literal = ucstring();
}
if (!params[0].Literal.empty())
PHRASE_UTILITIES::sendDynamicSystemMessage( creatureRowId, "LITERAL", params );
} }
if (!params[0].Literal.empty())
PHRASE_UTILITIES::sendDynamicSystemMessage( creatureRowId, "LITERAL", params );
} }
/* /*

@ -97,7 +97,7 @@ private:
}; };
uint32 _GetEasterNextId() { return _EasterEggNextId++; } uint32 _GetEasterNextId() { return _EasterEggNextId++; }
void _SpawnEasterEgg(uint32 easterEggId, NLMISC::CSheetId sheet, uint32 aiInstanceId, sint32 x, sint32 y, sint32 z, float heading, const std::string&name="", const std::string& look="") const; void _SpawnEasterEgg(uint32 easterEggId, NLMISC::CSheetId sheet, uint32 aiInstanceId, sint32 x, sint32 y, sint32 z, float heading, const std::string &name = std::string(), const std::string &look = std::string()) const;
void _UnspawnEasterEgg(uint32 easterEggId, uint32 aiInstanceId); void _UnspawnEasterEgg(uint32 easterEggId, uint32 aiInstanceId);
void _AddEntityEasterAssociation(const NLMISC::CEntityId &entityId, uint32 easterEggId); void _AddEntityEasterAssociation(const NLMISC::CEntityId &entityId, uint32 easterEggId);
void _RemoveEntityEasterAssociation(const NLMISC::CEntityId &entityId, uint32 easterEggId); void _RemoveEntityEasterAssociation(const NLMISC::CEntityId &entityId, uint32 easterEggId);

@ -1668,7 +1668,7 @@ void CCombatPhrase::execute()
if (entity) if (entity)
entity->cancelStaticEffects(); entity->cancelStaticEffects();
if (entity->getId().getType() == RYZOMID::player) if (entity && entity->getId().getType() == RYZOMID::player)
{ {
CCharacter* player = dynamic_cast<CCharacter*> (entity); CCharacter* player = dynamic_cast<CCharacter*> (entity);
if (player) if (player)

@ -756,8 +756,8 @@ uint CFgProspectionPhrase::generateSources( CCharacter *player )
for ( uint iSource=0; iSource!=nbOfSources; ++iSource ) for ( uint iSource=0; iSource!=nbOfSources; ++iSource )
{ {
TNothingFoundReason reason; TNothingFoundReason reason;
const CStaticDepositRawMaterial *rawMaterial; const CStaticDepositRawMaterial *rawMaterial = NULL;
CDeposit *deposit, *depositForK; CDeposit *deposit = NULL, *depositForK;
// Make several attempts to find a pos that matches the filters // Make several attempts to find a pos that matches the filters
for ( uint iAttempt=0; iAttempt!=(uint)_NbAttempts; ++iAttempt ) for ( uint iAttempt=0; iAttempt!=(uint)_NbAttempts; ++iAttempt )
@ -782,7 +782,7 @@ uint CFgProspectionPhrase::generateSources( CCharacter *player )
break; // stop attempts if RM found (rawMaterial) or impossible to find one (!deposit) break; // stop attempts if RM found (rawMaterial) or impossible to find one (!deposit)
} }
if ( rawMaterial ) if ( rawMaterial && deposit )
{ {
// Find or open a forage site //nlassert( deposit && depositForK && forageSite ); // Find or open a forage site //nlassert( deposit && depositForK && forageSite );
CRecentForageSite *forageSite = deposit->findOrCreateForageSite( pos ); CRecentForageSite *forageSite = deposit->findOrCreateForageSite( pos );
@ -1003,6 +1003,7 @@ void CFgProspectionPhrase::startLocateDeposit( CCharacter *player )
else else
{ {
// Retain the first found matching deposit in which we are, or the nearest matching deposit // Retain the first found matching deposit in which we are, or the nearest matching deposit
nlassert(matchingDeposits.size());
TDepositLoc *retainedLoc = NULL; TDepositLoc *retainedLoc = NULL;
float minDist = _ForageRange; float minDist = _ForageRange;
for ( vector<CDeposit*>::iterator itd=matchingDeposits.begin(); itd!=matchingEnd; ++itd ) for ( vector<CDeposit*>::iterator itd=matchingDeposits.begin(); itd!=matchingEnd; ++itd )
@ -1024,6 +1025,7 @@ void CFgProspectionPhrase::startLocateDeposit( CCharacter *player )
} }
// Start the effect // Start the effect
nlassert(retainedLoc);
CVector2f locatedPoint( retainedLoc->NearestPos ); CVector2f locatedPoint( retainedLoc->NearestPos );
TReportAction report; TReportAction report;
sint32 effectFocusCostByUpdate = _FocusCost / ForageFocusRatioOfLocateDeposit.get(); sint32 effectFocusCostByUpdate = _FocusCost / ForageFocusRatioOfLocateDeposit.get();

@ -74,6 +74,7 @@ void CSpecialPowerModDefense::apply()
effectFamily = EFFECT_FAMILIES::PowerModDefenseSkill; effectFamily = EFFECT_FAMILIES::PowerModDefenseSkill;
break; break;
default: default:
effectFamily = EFFECT_FAMILIES::Unknown;
break; break;
} }

@ -1510,7 +1510,7 @@ public:
uint8 interfaceCounter() const; uint8 interfaceCounter() const;
/// Register character name in IOS /// Register character name in IOS
void registerName(const ucstring &newName = std::string("")); void registerName(const ucstring &newName = std::string());
/// Mount a mount /// Mount a mount
void mount( TDataSetRow PetRowId ); void mount( TDataSetRow PetRowId );

@ -968,6 +968,11 @@ NLMISC_COMMAND(buildSpire, "build a spire","<Eid> <region>")
x = 11105.0f; x = 11105.0f;
y = -4400.0f; y = -4400.0f;
} }
else
{
log.displayNL( "buildSpire : Invalid region '%s'", args[1].c_str() );
return;
}
NLMISC::CVector vec( x, y, 0.0f ); NLMISC::CVector vec( x, y, 0.0f );
@ -1032,6 +1037,11 @@ NLMISC_COMMAND(destroySpire, "destroy a spire","<region>")
x = 11105.0f; x = 11105.0f;
y = -4400.0f; y = -4400.0f;
} }
else
{
log.displayNL( "destroySpire : Invalid region '%s'", args[1].c_str() );
return;
}
NLMISC::CVector vec( x, y, 0.0f ); NLMISC::CVector vec( x, y, 0.0f );

@ -194,8 +194,11 @@ bool CCharacterShoppingList::passThruFilter(TItemTradePtr itemTrade, bool dynnam
{ {
const CStaticItem * form = CSheets::getForm( itemTrade->getSheetId() ); const CStaticItem * form = CSheets::getForm( itemTrade->getSheetId() );
if (!_Character)
return false;
// No filter on Faction trade // No filter on Faction trade
if(_Character && _Character->getBotChatType() == BOTCHATTYPE::TradeFactionFlag) if(_Character->getBotChatType() == BOTCHATTYPE::TradeFactionFlag)
return true; return true;
if( form != 0 ) if( form != 0 )

@ -1043,7 +1043,7 @@ void CShopTypeManager::addTpShopBase( uint32 shopCategoryNumber, uint32 ecosyste
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CShopTypeManager::addShopBase( uint32 shopCategoryNumber, CMerchant& merchant, std::vector< uint32 >& rmSelector, std::vector< uint32 >& originSelector, std::vector< uint32 >& qualitySelector, std::vector< uint32 >& levelSelector, std::vector< uint32 >& shopTypeSelector ) void CShopTypeManager::addShopBase( uint32 shopCategoryNumber, CMerchant& merchant, std::vector< uint32 >& rmSelector, std::vector< uint32 >& originSelector, std::vector< uint32 >& qualitySelector, std::vector< uint32 >& levelSelector, std::vector< uint32 >& shopTypeSelector )
{ {
TShopTypeSelected shopTypeSelected; TShopTypeSelected shopTypeSelected = InvalidShopSelected;
if( shopTypeSelector.size() == 0 ) if( shopTypeSelector.size() == 0 )
{ {
shopTypeSelected = AllShopSelected; shopTypeSelected = AllShopSelected;
@ -1052,15 +1052,15 @@ void CShopTypeManager::addShopBase( uint32 shopCategoryNumber, CMerchant& mercha
{ {
for( uint32 i = 0; i < shopTypeSelector.size(); ++i ) for( uint32 i = 0; i < shopTypeSelector.size(); ++i )
{ {
if( _CategoryName[ shopTypeSelector[ i ] ] == string("STATIC_SHOP") ) if( _CategoryName[ shopTypeSelector[ i ] ] == "STATIC_SHOP" )
{ {
shopTypeSelected = StaticShopSelected; shopTypeSelected = StaticShopSelected;
} }
else if( _CategoryName[ shopTypeSelector[ i ] ] == string("DYNAMIC_SHOP") ) else if( _CategoryName[ shopTypeSelector[ i ] ] == "DYNAMIC_SHOP" )
{ {
shopTypeSelected = DynamicShopSelected; shopTypeSelected = DynamicShopSelected;
} }
else if( _CategoryName[ shopTypeSelector[ i ] ] == string("STATIC_DYNAMIC_SHOP") ) else if( _CategoryName[ shopTypeSelector[ i ] ] == "STATIC_DYNAMIC_SHOP" )
{ {
shopTypeSelected = AllShopSelected; shopTypeSelected = AllShopSelected;
} }

@ -51,7 +51,7 @@ class CShopTypeManager : public NLMISC::CEvalNumExpr
{ {
public: public:
enum TShopTypeSelected { StaticShopSelected = 0, DynamicShopSelected, AllShopSelected }; enum TShopTypeSelected { StaticShopSelected = 0, DynamicShopSelected, AllShopSelected, InvalidShopSelected };
/// init / release class /// init / release class
static void initShopBase(); static void initShopBase();

@ -242,8 +242,8 @@ namespace GUSNET
void CHubModule::registerRemoteModule(TRemoteModuleOnHubPtr module) void CHubModule::registerRemoteModule(TRemoteModuleOnHubPtr module)
{ {
// make sure the module isn't already registered // make sure the module isn't already registered
for (TRemoteModules::iterator it=_RemoteModules.begin();it!=_RemoteModules.end();++it) for (TRemoteModules::iterator it = _RemoteModules.begin(); it != _RemoteModules.end(); ++it)
BOMB_IF((*it).second==module,"Attempt to add the same module to a hub more than once",return) BOMB_IF((*it).second == module, "Attempt to add the same module to a hub more than once", return);
// add the module to the _RemoteModules map // add the module to the _RemoteModules map
_RemoteModules[module->getUniqueId()]=module; _RemoteModules[module->getUniqueId()]=module;

@ -63,8 +63,8 @@ namespace GUSNET
void CGusNetImplementation::addHubModule(THubModulePtr hub) void CGusNetImplementation::addHubModule(THubModulePtr hub)
{ {
// make sure the hub wasn't already registered // make sure the hub wasn't already registered
for (uint32 i=0;i<_Hubs.size();++i) for (uint32 i = 0; i < _Hubs.size(); ++i)
BOMB_IF(_Hubs[i]==hub,"Attempt to add the same hub to the CGusNetImplementation singleton more than once",return) BOMB_IF(_Hubs[i] == hub, "Attempt to add the same hub to the CGusNetImplementation singleton more than once", return);
// add the new hub // add the new hub
nldebug("GUSNET: Registering new hub: %d",hub->getPort()); nldebug("GUSNET: Registering new hub: %d",hub->getPort());
@ -74,8 +74,8 @@ namespace GUSNET
void CGusNetImplementation::addConnectionModule(TConnectionModulePtr connection) void CGusNetImplementation::addConnectionModule(TConnectionModulePtr connection)
{ {
// make sure the connection wasn't already registered // make sure the connection wasn't already registered
for (uint32 i=0;i<_Connections.size();++i) for (uint32 i = 0; i < _Connections.size(); ++i)
BOMB_IF(_Connections[i]==connection,"Attempt to add the same connection to the CGusNetImplementation singleton more than once",return) BOMB_IF(_Connections[i] == connection, "Attempt to add the same connection to the CGusNetImplementation singleton more than once", return);
// add the new connection // add the new connection
nldebug("GUSNET: Registering new connection: %s",connection->getConnectionAddress().c_str()); nldebug("GUSNET: Registering new connection: %s",connection->getConnectionAddress().c_str());

@ -94,7 +94,7 @@ namespace SAVES
{ {
for (uint32 i=_Callbacks.size();i--;) for (uint32 i=_Callbacks.size();i--;)
{ {
BOMB_IF(_Callbacks[i]==cb,"BUG: Attempting to add the same callback to an RS module more than once",return) BOMB_IF(_Callbacks[i] == cb, "BUG: Attempting to add the same callback to an RS module more than once", return);
} }
_Callbacks.push_back(cb); _Callbacks.push_back(cb);
if (isReady()) if (isReady())

@ -514,7 +514,7 @@ namespace SAVES
// run through the buffer performing a very simple shift and xor checksum (good enough for our purposes) // run through the buffer performing a very simple shift and xor checksum (good enough for our purposes)
// note that we could have used an MD5 but his is much much much faster (less strain on the CPU) // note that we could have used an MD5 but his is much much much faster (less strain on the CPU)
uint64 checksum; uint64 checksum = 0;
for (uint32 i=fileBody.size()/8;i--;) for (uint32 i=fileBody.size()/8;i--;)
{ {
checksum= ((checksum<<1)|(checksum>>63))^((uint64*)&fileBody[0])[i]; checksum= ((checksum<<1)|(checksum>>63))^((uint64*)&fileBody[0])[i];

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

@ -2154,8 +2154,7 @@ void CChatManager::displayChatClients(NLMISC::CLog &log)
} }
else else
{ {
log.displayNL("*no name* %s:%x %s mode '%s'", log.displayNL("*no name* *no id*:%x %s mode '%s'",
ci->EntityId.toString().c_str(),
im->first.getIndex(), im->first.getIndex(),
im->second->isMuted()?"(muted)":"", im->second->isMuted()?"(muted)":"",
CChatGroup::groupTypeToString(im->second->getChatMode()).c_str() ); CChatGroup::groupTypeToString(im->second->getChatMode()).c_str() );

@ -415,7 +415,7 @@ public:
* \param sender is the id of the sender * \param sender is the id of the sender
* \param customTxt is a custom text which can be added immediately after the chat message, on the same line * \param customTxt is a custom text which can be added immediately after the chat message, on the same line
*/ */
void sendChat2Ex( CChatGroup::TGroupType senderChatMode, const TDataSetRow &receiver, uint32 phraseId, const TDataSetRow &sender = TDataSetRow(), ucstring customTxt = ucstring("")); void sendChat2Ex( CChatGroup::TGroupType senderChatMode, const TDataSetRow &receiver, uint32 phraseId, const TDataSetRow &sender = TDataSetRow(), ucstring customTxt = ucstring());
/** /**
* Send a custom emote chat message * Send a custom emote chat message

@ -150,6 +150,7 @@ NLMISC_COMMAND(smTest, "Send a test dyn string to a client (look at first phrase
else else
{ {
log.displayNL("Unknown player name '%s'", args[2].c_str()); log.displayNL("Unknown player name '%s'", args[2].c_str());
return true;
} }
} }
else if (args[1] == "TEST_ENTITY") else if (args[1] == "TEST_ENTITY")
@ -173,6 +174,7 @@ NLMISC_COMMAND(smTest, "Send a test dyn string to a client (look at first phrase
else else
{ {
log.displayNL("Can't make entity ID from '%s'", args[2].c_str()); log.displayNL("Can't make entity ID from '%s'", args[2].c_str());
return true;
} }
} }
else if (args[1] == "TEST_SBRICK") else if (args[1] == "TEST_SBRICK")

@ -85,8 +85,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::toLower(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());

@ -214,7 +214,7 @@ void CMirrors::processMirrorUpdates()
//nlassert(entityIndex.getIndex() < client.Entites.size()); //nlassert(entityIndex.getIndex() < client.Entites.size());
bool wasPresent = (entityIndex.getIndex() < client.Entites.size() && (client.Entites[entityIndex.getIndex()].Flags & CMonitorClient::CEntityEntry::Present) != 0); bool wasPresent = (entityIndex.getIndex() < client.Entites.size() && (client.Entites[entityIndex.getIndex()].Flags & CMonitorClient::CEntityEntry::Present) != 0);
// See if position changed // See if position changed
if (propIndex == DSPropertyPOSX || propIndex == DSPropertyPOSX) if (propIndex == DSPropertyPOSX || propIndex == DSPropertyPOSY)
{ {
if (pos.x > topleft.x && pos.x < bottomright.x && pos.y > topleft.y && pos.y < bottomright.y) if (pos.x > topleft.x && pos.x < bottomright.x && pos.y > topleft.y && pos.y < bottomright.y)
{ {

@ -65,7 +65,7 @@ bool CDBDescriptionParser::loadDescriptionFile(const string& filename)
bool success = loadDescription(buffer); bool success = loadDescription(buffer);
delete buffer; delete[] buffer;
return success; return success;
} }

@ -343,12 +343,14 @@ bool CDBReferenceFile::update(uint32 index, const uint8* rowdata)
if (!writeBuffer(tempRowBuffer, _Header.FullRowSize)) if (!writeBuffer(tempRowBuffer, _Header.FullRowSize))
{ {
nlwarning("CDBReferenceFile::update(): failed, can't increase file '%s' size", filepath.c_str()); nlwarning("CDBReferenceFile::update(): failed, can't increase file '%s' size", filepath.c_str());
delete tempRowBuffer; delete[] tempRowBuffer;
return false; return false;
} }
++_Header.EndIndex; ++_Header.EndIndex;
} }
delete[] tempRowBuffer;
} }
// seek to row in file // seek to row in file

@ -996,12 +996,12 @@ restartLoop:
if (authorCharId != 0) if (authorCharId != 0)
{ {
author = CCharacter::load(_RingDb, authorCharId, __FILE__, __LINE__); author = CCharacter::load(_RingDb, authorCharId, __FILE__, __LINE__);
BOMB_IF(author == NULL, "Failed to load the scenario author character "<<authorCharId, return;) BOMB_IF(author == NULL, "Failed to load the scenario author character " << authorCharId, return;);
} }
// load the animator // load the animator
CCharacterPtr animator = CCharacter::load(_RingDb, session->getOwnerId(), __FILE__, __LINE__); CCharacterPtr animator = CCharacter::load(_RingDb, session->getOwnerId(), __FILE__, __LINE__);
BOMB_IF(animator == NULL, "Failed to load the scenario animator character "<<session->getOwnerId(), return;) BOMB_IF(animator == NULL, "Failed to load the scenario animator character " << session->getOwnerId(), return;);
// try to load an existing scenario record // try to load an existing scenario record
CScenarioPtr scenario; CScenarioPtr scenario;
@ -1127,12 +1127,12 @@ restartLoop:
if (authorCharId != 0) if (authorCharId != 0)
{ {
author = CCharacter::load(_RingDb, authorCharId, __FILE__, __LINE__); author = CCharacter::load(_RingDb, authorCharId, __FILE__, __LINE__);
BOMB_IF(author == NULL, "Failed to load the scenario author character "<<authorCharId, return;) BOMB_IF(author == NULL, "Failed to load the scenario author character " << authorCharId, return;);
} }
// load the animator // load the animator
CCharacterPtr animator = CCharacter::load(_RingDb, session->getOwnerId(), __FILE__, __LINE__); CCharacterPtr animator = CCharacter::load(_RingDb, session->getOwnerId(), __FILE__, __LINE__);
BOMB_IF(animator == NULL, "Failed to load the scenario animator character "<<session->getOwnerId(), return;) BOMB_IF(animator == NULL, "Failed to load the scenario animator character " << session->getOwnerId(), return;);
// try to load an existing scenario record // try to load an existing scenario record
CScenarioPtr scenario; CScenarioPtr scenario;
@ -3115,7 +3115,7 @@ endOfWelcomeUserResult:
for (uint i=0; i<session->getSessionParticipants().size(); ++i) for (uint i=0; i<session->getSessionParticipants().size(); ++i)
{ {
const CSessionParticipantPtr &part = session->getSessionParticipantsByIndex(i); const CSessionParticipantPtr &part = session->getSessionParticipantsByIndex(i);
BOMB_IF(part == NULL, "RSM:on_unsubsribeSession : error accessing participants at index "<<i<<", part is NULL", invokeResult(from, charId>>4, 4, "failed to accesss participants record"); return) BOMB_IF(part == NULL, "RSM:on_unsubsribeSession : error accessing participants at index " << i << ", part is NULL", invokeResult(from, charId >> 4, 4, "failed to accesss participants record"); return);
if (part->getCharId() == charId if (part->getCharId() == charId
&& part->getStatus() == TSessionPartStatus::sps_play_subscribed) && part->getStatus() == TSessionPartStatus::sps_play_subscribed)

Loading…
Cancel
Save