summaryrefslogtreecommitdiffstats
path: root/sigencore/Containment.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-01-27 22:07:08 -0500
committerBen Boeckel <MathStuf@gmail.com>2009-01-27 22:07:08 -0500
commite04c4922a13ed10e9d6b086eacc299f0c5a05984 (patch)
tree907e109278adbea9ae100feb61e020174033a3e5 /sigencore/Containment.cpp
parentd111ea6a931a7120631f6e88e9414cbdb851e0e8 (diff)
downloadsigen-e04c4922a13ed10e9d6b086eacc299f0c5a05984.tar.gz
sigen-e04c4922a13ed10e9d6b086eacc299f0c5a05984.tar.xz
sigen-e04c4922a13ed10e9d6b086eacc299f0c5a05984.zip
Begin migration of core classes to libsigencore
Diffstat (limited to 'sigencore/Containment.cpp')
-rw-r--r--sigencore/Containment.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/sigencore/Containment.cpp b/sigencore/Containment.cpp
new file mode 100644
index 00000000..12d778aa
--- /dev/null
+++ b/sigencore/Containment.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Ben Boeckel <MathStuf@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// Header include
+#include "Containment.h"
+
+// Sigbattle includes
+#include "TeamMember.h"
+
+// Sigscript includes
+#include "../sigscript/RulesWrapper.h"
+#include "../sigscript/SigmodWrapper.h"
+
+Sigbattle::Containment::Containment(Sigscript::SigmodWrapper* sigmod, Sigscript::Config* parent) :
+ Sigscript::Config(parent),
+ m_sigmod(sigmod)
+{
+}
+
+QList<Sigbattle::TeamMember*> Sigbattle::Containment::members() const
+{
+ return m_members;
+}
+
+bool Sigbattle::Containment::addMember(TeamMember* member)
+{
+ if (m_members.size() < sigmod()->rules()->maxParty())
+ {
+ m_members.append(member);
+// member->reparent(this);
+ return true;
+ }
+ return false;
+}
+
+Sigbattle::TeamMember* Sigbattle::Containment::findMember(const QUuid& id) const
+{
+ foreach (TeamMember* member, m_members)
+ {
+ if (member->id() == id)
+ return member;
+ }
+ return NULL;
+}
+
+Sigscript::SigmodWrapper* Sigbattle::Containment::sigmod() const
+{
+ return m_sigmod;
+}