File: agent.h

package info (click to toggle)
eris 1.3.14-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,016 kB
  • ctags: 1,819
  • sloc: cpp: 13,153; sh: 9,106; perl: 287; makefile: 201; ansic: 165
file content (51 lines) | stat: -rw-r--r-- 1,400 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef ERIS_TEST_AGENT_H
#define ERIS_TEST_AGENT_CPP

#include <Atlas/Objects/ObjectsFwd.h>
#include <Atlas/Objects/Root.h>
#include <set>
#include <map>

class StubServer;
class ClientConnection;

class Agent
{
public:
    Agent(ClientConnection* con, const std::string& charId);
    ~Agent();
    
    void processOp(const Atlas::Objects::Operation::RootOperation& op);

    void setEntityVisible(const std::string& eid, bool vis);

    static void setEntityVisibleForFutureAgent(const std::string& eid, const std::string& agentId);

    static void broadcastSight(const Atlas::Objects::Operation::RootOperation& op);
    static void broadcastSound(const Atlas::Objects::Operation::RootOperation& op);
    
private:
    void processLook(const Atlas::Objects::Operation::Look& op);
    void processWield(const Atlas::Objects::Operation::RootOperation& op);

    bool isVisible(const std::string& eid) const;

    std::string randomVisibleEntity() const;
    std::string randomInvisibleEntity() const;
    
    const std::string m_character;
    ClientConnection* m_con;
    StubServer* m_server;
    
    typedef std::set<std::string> EntityIdSet;
    
    EntityIdSet m_visible;
    
    typedef std::multimap<std::string, std::string> StringStringMmap;
    static StringStringMmap static_futureVisible;
    
    typedef std::set<Agent*> AgentSet;
    static AgentSet static_allAgents;
};

#endif