eris 1.4.0
A WorldForge client library.
ViewEntity.cpp
1#include "ViewEntity.h"
2
3#include "Connection.h"
4#include "EntityRouter.h"
5#include "View.h"
6#include "Avatar.h"
7#include "Task.h"
8
9#include <sigc++/bind.h>
10
11
12
13namespace Eris {
14ViewEntity::ViewEntity(std::string id, TypeInfo* ty, View& view) :
15 Entity(std::move(id), ty),
16 m_view(view) {
17}
18
19ViewEntity::~ViewEntity() = default;
20
21Entity* ViewEntity::getEntity(const std::string& id) {
22 auto child = m_view.getEntity(id);
23 if (!child || !child->m_visible) {
24 // we don't have the entity at all, so request it and skip
25 // processing it here; everything will come right when it
26 // arrives.
27 m_view.getEntityFromServer(id);
28 }
29 return child;
30}
31
32void ViewEntity::onTaskAdded(const std::string& id, Task* task)
33{
34 task->ProgressRateChanged.connect(sigc::bind(sigc::mem_fun(*this, &ViewEntity::task_ProgressRateChanged), task));
35 Entity::onTaskAdded(id, task);
37}
38
40{
42}
43
44
45}
Entity is a concrete (instantiable) class representing one game entity.
Definition: Entity.h:56
virtual void onTaskAdded(const std::string &id, Task *task)
Over-rideable hook for when tasks are added.
Definition: Entity.cpp:374
The representation of an Atlas type (i.e a class or operation definition). This class supports effice...
Definition: TypeInfo.h:33
Entity * getEntity(const std::string &id) override
Gets an entity with the supplied id from the system.
Definition: ViewEntity.cpp:21
void onTaskAdded(const std::string &id, Task *task) override
Over-rideable hook for when tasks are added.
Definition: ViewEntity.cpp:32
View & m_view
The View which owns this Entity.
Definition: ViewEntity.h:47
ViewEntity(std::string id, TypeInfo *ty, View &view)
Ctor.
Definition: ViewEntity.cpp:14
void task_ProgressRateChanged(Task *task)
Listen to task progress rates updates and send to the view.
Definition: ViewEntity.cpp:39
ViewEntity * getEntity(const std::string &eid) const
Definition: View.cpp:45
void taskRateChanged(Task *)
Definition: View.cpp:134
Definition: Account.cpp:33