summaryrefslogtreecommitdiff
path: root/src/actormanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-03 20:41:57 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-03 20:41:57 +0300
commit329771bb20094d2c4587310f1c3c2b7342d837e6 (patch)
treea9bcf6cf296a9a7ca3fac16730d3cc76fb938a20 /src/actormanager.cpp
parent601a1969d813672d7cc65edc3bd873067c551e4d (diff)
downloadmv-329771bb20094d2c4587310f1c3c2b7342d837e6.tar.gz
mv-329771bb20094d2c4587310f1c3c2b7342d837e6.tar.bz2
mv-329771bb20094d2c4587310f1c3c2b7342d837e6.tar.xz
mv-329771bb20094d2c4587310f1c3c2b7342d837e6.zip
Update last seen also from online list.
It lack account id, but can update time.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r--src/actormanager.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index cc46ac34b..bfcc92e81 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1965,22 +1965,30 @@ void ActorManager::updateNameId(const std::string &name,
if (!mEnableIdCollecting)
return;
const int id = static_cast<int>(beingId);
- if (id < 2000000 || id >= 110000000)
+ if (id &&
+ id < 2000000 ||
+ id >= 110000000)
+ {
return;
+ }
if (mIdName.find(beingId) == mIdName.end() ||
mIdName[beingId].find(name) == mIdName[beingId].end())
{
mIdName[beingId].insert(name);
- std::string dir = settings.usersIdDir;
const std::string idStr = toString(id);
- dir.append(idStr);
- dir.append("/");
- dir.append(stringToHexPath(name));
const std::string dateStr = getDateTimeString();
- Files::saveTextFile(dir,
- "info.txt",
- (name + "\n").append(dateStr));
+ std::string dir;
+ if (beingId != BeingId_zero)
+ {
+ dir = settings.usersIdDir;
+ dir.append(idStr);
+ dir.append("/");
+ dir.append(stringToHexPath(name));
+ Files::saveTextFile(dir,
+ "info.txt",
+ (name + "\n").append(dateStr));
+ }
dir = settings.usersDir;
dir.append(stringToHexPath(name));
@@ -1990,6 +1998,20 @@ void ActorManager::updateNameId(const std::string &name,
}
}
+void ActorManager::updateSeenPlayers(const std::set<std::string>
+ &onlinePlayers)
+{
+ if (!mEnableIdCollecting)
+ return;
+
+ FOR_EACH (std::set<std::string>::const_iterator, it, onlinePlayers)
+ {
+ const std::string name = *it;
+ if (!findBeingByName(name, ActorType::Player))
+ updateNameId(name, BeingId_zero);
+ }
+}
+
#ifdef EATHENA_SUPPORT
void ActorManager::removeRoom(const int chatId)
{