allow any CompoundPart to gain focus, if it canGainFocus()
[openc2e.git] / historyManager.h
blob39cd43f67bdba85b5126d23c9734fa968bcd2981
1 /*
2 * historyManager.h
3 * openc2e
5 * Created by Alyssa Milburn on Wed 26 Apr 2006.
6 * Copyright (c) 2006 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef _HISTORYMANAGER_H
21 #define _HISTORYMANAGER_H
23 #include "AgentRef.h"
24 #include "genome.h"
25 #include <vector>
26 #include <map>
27 #include <boost/weak_ptr.hpp>
29 using boost::shared_ptr;
30 using boost::weak_ptr;
32 struct historyevent {
33 unsigned int eventno;
34 lifestage stage;
35 std::string photo; // TODO: correct?
36 std::string monikers[2];
37 std::string networkid;
38 unsigned int timestamp;
39 int tage;
40 std::string usertext;
41 std::string worldname;
42 std::string worldmoniker;
43 unsigned int worldtick;
44 historyevent(unsigned int eno, class CreatureAgent * = 0);
47 enum monikerstatus { referenced = 1, creature = 2, borncreature = 3, exported = 4, dead = 5, deadandkilled = 6, unreferenced = 7 };
49 class monikerData {
50 private:
51 monikerstatus status;
52 std::string moniker;
54 public:
55 weak_ptr<genomeFile> genome;
56 AgentRef owner;
57 std::vector<historyevent> events;
58 int gender;
59 int variant;
60 std::string name;
61 unsigned char genus;
62 bool warpveteran;
63 unsigned int no_crossover_points, no_point_mutations;
65 void init(std::string, shared_ptr<genomeFile>);
66 historyevent &addEvent(unsigned int event, std::string moniker1 = "", std::string moniker2 = "");
67 void moveToAgent(AgentRef a);
68 void moveToCreature(AgentRef c);
69 void wasBorn();
70 void hasDied();
71 monikerstatus getStatus();
74 class historyManager {
75 private:
76 std::map<std::string, monikerData> monikers;
78 public:
79 std::string newMoniker(shared_ptr<genomeFile>);
80 bool hasMoniker(std::string);
81 monikerData &getMoniker(std::string);
82 std::string findMoniker(shared_ptr<genomeFile>);
83 std::string findMoniker(AgentRef);
84 void delMoniker(std::string);
87 #endif
88 /* vim: set noet: */