From f0bac6d0d35a4beec36f99aabf5b72da738fc3d7 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 29 Dec 2015 16:39:37 +0100 Subject: [PATCH] Changed: Minor changes --- .../src/entities_game_service/admin.cpp | 40 ++++++++++--------- .../player_manager/character.cpp | 5 +++ .../gpm_service/world_position_manager.cpp | 1 - .../src/input_output_service/chat_manager.cpp | 6 ++- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/admin.cpp b/code/ryzom/server/src/entities_game_service/admin.cpp index 745f91a3e..e92657c3e 100644 --- a/code/ryzom/server/src/entities_game_service/admin.cpp +++ b/code/ryzom/server/src/entities_game_service/admin.cpp @@ -840,7 +840,7 @@ void __name##Class::pointer(CEntityId entity, bool get, std::string &value) #define ENTITY_GET_ENTITY \ TLogContext_Character_AdminCommand commandContext(entity); \ CEntityBase *e = CEntityBaseManager::getEntityBasePtr(entity); \ - if(e == 0) \ + if(e == NULL) \ { \ nlwarning ("Unknown entity '%s'", entity.toString().c_str()); \ if(get) value = "UnknownEntity"; \ @@ -856,7 +856,7 @@ void __name##Class::pointer(CEntityId entity, bool get, std::string &value) #define ENTITY_GET_CHARACTER \ TLogContext_Character_AdminCommand commandContext(entity); \ CCharacter *c = PlayerManager.getChar(entity); \ - if(c == 0) \ + if(c == NULL) \ { \ nlwarning ("Unknown player '%s'", entity.toString().c_str()); \ if(get) value = "UnknownPlayer"; \ @@ -1158,7 +1158,7 @@ ENTITY_VARIABLE (Priv, "User privilege") ENTITY_GET_CHARACTER CPlayer *p = PlayerManager.getPlayer(PlayerManager.getPlayerId(c->getId())); - if (p == 0) + if (p == NULL) { nlwarning ("Can't find player with UserId %d for checking privilege, assume no priv", PlayerManager.getPlayerId(c->getId())); return; @@ -1301,7 +1301,7 @@ ENTITY_VARIABLE(Position, "Position of a player (in meter) ,[, return; } CEntityBase *entityBase = PlayerManager.getCharacterByName (CShardNames::getInstance().makeFullNameFromRelative(c->getHomeMainlandSessionId(), value)); - if (entityBase == 0) + if (entityBase == NULL) { // try to find the bot name vector aliases; @@ -1326,7 +1326,7 @@ ENTITY_VARIABLE(Position, "Position of a player (in meter) ,[, } } - if (entityBase != 0) + if (entityBase != NULL) { x = entityBase->getState().X + sint32 (cos (entityBase->getState ().Heading) * 2000); y = entityBase->getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000); @@ -1489,7 +1489,7 @@ NLMISC_COMMAND (createItemInBag, "Create an item and put it in the player bag", } const CStaticItem *form = CSheets::getForm (sheet); - if (form == 0) + if (form == NULL) { log.displayNL ("sheetId '%s' is not found", sheetName.c_str()); return false; @@ -1573,7 +1573,7 @@ NLMISC_COMMAND (createItemInTmpInv, "Create an item and put it in the player tem } const CStaticItem *form = CSheets::getForm (sheet); - if (form == 0) + if (form == NULL) { log.displayNL ("sheetId '%s' is not found", sheetName.c_str()); return false; @@ -1640,7 +1640,7 @@ NLMISC_COMMAND (createItemInInv, "Create items and put them in the given invento } const CStaticItem *form = CSheets::getForm (sheet); - if (form == 0) + if (form == NULL) { log.displayNL ("sheetId '%s' is not found", sheetName.c_str()); return false; @@ -3079,7 +3079,7 @@ void cbClientAdmin (NLNET::CMessage& msgin, const std::string &serviceName, NLNE // find the character CCharacter *c = PlayerManager.getChar( eid ); - if (c == 0) + if (c == NULL) { nlwarning ("ADMIN: Unknown player %s", eid.toString().c_str()); chatToPlayer (eid, "Unknown player"); @@ -3225,7 +3225,7 @@ void cbClientAdminOffline (NLNET::CMessage& msgin, const std::string &serviceNam // find the character CCharacter *c = PlayerManager.getChar( eid ); - if (c == 0) + if (c == NULL) { nlwarning ("ADMIN: Unknown player %s", eid.toString().c_str()); chatToPlayer (eid, "Unknown player"); @@ -3698,7 +3698,7 @@ NLMISC_COMMAND( killMob, "kill a mob ( /a killMob )", "" ) TRY_GET_CHARACTER CCreature * creature = CreatureManager.getCreature( c->getTarget() ); - if( creature == 0 ) + if (creature == NULL) { nlwarning ("Unknown creature '%s'", c->getTarget().toString().c_str() ); return false; @@ -3730,7 +3730,7 @@ NLMISC_COMMAND( dssTarget, "target a mob and send information to dss( /b dssTarg TRY_GET_CHARACTER CCreature * creature = CreatureManager.getCreature( c->getTarget() ); - if( creature == 0 ) + if (creature == NULL) { nlwarning ("Unknown creature '%s'", c->getTarget().toString().c_str() ); return false; @@ -4782,7 +4782,9 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " getLastConnectedDate()) + index + command + c->getId().toString(); + string checksumRowId = web_app_url + toString(c->getLastConnectedDate()) + index + command + toString(c->getEntityRowId().getIndex()); + string realhmacEid = getHMacSHA1((uint8*)&checksumEid[0], checksumEid.size(), (uint8*)&salt[0], salt.size()).toString(); string realhmacRowId = getHMacSHA1((uint8*)&checksumRowId[0], checksumRowId.size(), (uint8*)&salt[0], salt.size()).toString(); if (realhmacEid != hmac && realhmacRowId != hmac && command != "is_valid_index") @@ -7013,7 +7015,7 @@ NLMISC_COMMAND(roomInvite, "send a room invite to a player character", " getHomeMainlandSessionId(), args[1])); - if(target == 0 || target->getEnterFlag() == false ) + if(target == NULL || target->getEnterFlag() == false ) { CCharacter::sendDynamicSystemMessage( user->getId(), "TEAM_INVITED_CHARACTER_MUST_BE_ONLINE" ); return true; @@ -7058,7 +7060,7 @@ NLMISC_COMMAND(roomKick, "kick player from room", " ") } CCharacter * target = PlayerManager.getCharacterByName(CShardNames::getInstance().makeFullNameFromRelative(user->getHomeMainlandSessionId(), args[1])); - if(target == 0 || target->getEnterFlag() == false ) + if(target == NULL || target->getEnterFlag() == false ) { CCharacter::sendDynamicSystemMessage( user->getId(), "TEAM_KICKED_CHARACTER_MUST_BE_ONLINE" ); return true; @@ -8616,7 +8618,7 @@ NLMISC_COMMAND(displayPositionStack, "Display the position stack of a character if (eid == CEntityId::Unknown) return true; CCharacter *c = PlayerManager.getChar(eid); - if(c == 0) + if (c == NULL) { log.displayNL( "Character not found" ); return true; @@ -8748,7 +8750,7 @@ NLMISC_COMMAND(farTPSubst, "Substitute a position in the stack (no immediate far if (eid == CEntityId::Unknown) return true; CCharacter *c = PlayerManager.getChar(eid); - if(c == 0) + if (c == NULL) { log.displayNL( "Character not found" ); return true; @@ -8818,7 +8820,7 @@ NLMISC_COMMAND(teamInvite, "send a team invite to a player character", " getHomeMainlandSessionId(), args[1])); - if(invitedCharacter == 0 || invitedCharacter->getEnterFlag() == false ) + if (invitedCharacter == NULL || invitedCharacter->getEnterFlag() == false ) { CCharacter::sendDynamicSystemMessage( user->getId(),"TEAM_INVITED_CHARACTER_MUST_BE_ONLINE" ); return true; @@ -8860,7 +8862,7 @@ NLMISC_COMMAND(leagueInvite, "send a League invite to a player character", "getHomeMainlandSessionId(), args[1])); - if(invitedCharacter == 0 || invitedCharacter->getEnterFlag() == false ) + if (invitedCharacter == NULL || invitedCharacter->getEnterFlag() == false ) { CCharacter::sendDynamicSystemMessage( user->getId(),"TEAM_INVITED_CHARACTER_MUST_BE_ONLINE" ); return true; @@ -8902,7 +8904,7 @@ NLMISC_COMMAND(leagueKick, "kick a player character from league", " getHomeMainlandSessionId(), args[1])); - if(invitedCharacter == 0 || invitedCharacter->getEnterFlag() == false ) + if (invitedCharacter == NULL || invitedCharacter->getEnterFlag() == false ) { CCharacter::sendDynamicSystemMessage( user->getId(),"TEAM_INVITED_CHARACTER_MUST_BE_ONLINE" ); return true; diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index a8bfe9f7f..5234407c8 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -146,6 +146,7 @@ #include "modules/client_command_forwarder.h" #include "server_share/log_character_gen.h" #include "server_share/log_item_gen.h" +#include "server_share/mongo_wrapper.h" /////////// // USING // @@ -19370,6 +19371,10 @@ bool CCharacter::setGuildId( uint32 guildId ) _GuildId = guildId; +#ifdef HAVE_MONGO + CMongo::update("users", toString("{'game.cid':%"NL_I64"u}", _Id.getShortId()), toString("{$set:{'game.guildId':%d}}", guildId)); +#endif + return true; } diff --git a/code/ryzom/server/src/gpm_service/world_position_manager.cpp b/code/ryzom/server/src/gpm_service/world_position_manager.cpp index e6cb5cecd..f17882cd5 100644 --- a/code/ryzom/server/src/gpm_service/world_position_manager.cpp +++ b/code/ryzom/server/src/gpm_service/world_position_manager.cpp @@ -1993,7 +1993,6 @@ void CWorldPositionManager::computePlayerDeltaVision( CPlayerInfos *infos, CVisi for (; iTempVisionState = false; - // *** Prevent from splitting vision of controller/controlled entity. // Ex: mounted mounts must not be visible if their rider is not visible. // It might waste some free slot space but this way we are sure the players won't have invisible riders. diff --git a/code/ryzom/server/src/input_output_service/chat_manager.cpp b/code/ryzom/server/src/input_output_service/chat_manager.cpp index aedfa063f..e6dc5c254 100644 --- a/code/ryzom/server/src/input_output_service/chat_manager.cpp +++ b/code/ryzom/server/src/input_output_service/chat_manager.cpp @@ -97,6 +97,8 @@ void CChatManager::onServiceDown(const std::string &serviceShortName) case CChatGroup::universe: case CChatGroup::say: case CChatGroup::shout: + case CChatGroup::player: + case CChatGroup::nbChatMode: continue; case CChatGroup::team: case CChatGroup::guild: @@ -130,7 +132,7 @@ void CChatManager::onServiceDown(const std::string &serviceShortName) /* * Reset ChatLog management */ -void CChatManager::resetChatLog() +void CChatManager::resetChatLog() { std::string logPath = (LogChatDirectory.get().empty() ? Bsi.getLocalPath() : LogChatDirectory.get()); _Displayer.setParam(CPath::standardizePath(logPath) + "chat.log"); @@ -181,7 +183,7 @@ void CChatManager::addClient( const TDataSetRow& id ) } else { - nlwarning("CChatManager::addClient : the client %s:%x is already in the manager !", + nlwarning("CChatManager::addClient : the client %s:%x is already in the manager !", TheDataset.getEntityId(id).toString().c_str(), id.getIndex()); }