Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List

Slot.h

Go to the documentation of this file.
00001 /*
00002 Copyright 2003 - 2005 Elliott Kleinrock, Dan Neely, Kurt W. Over, Damon Domjan
00003 
00004 This file is part of FreeStars, a free clone of the Stars! game.
00005 
00006 FreeStars is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 FreeStars is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with FreeStars; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 The full GPL Copyright notice should be in the file COPYING.txt
00021 
00022 Contact:
00023 Email Elliott at 9jm0tjj02@sneakemail.com
00024 */
00025 
00030 #if !defined(Slot_h)
00031 #define Slot_h
00032 
00033 class TiXmlNode;
00034 #include "Component.h"
00035 
00042 class Slot {
00043 public:
00044         Slot(const Component * comp, long amount, long Pos, const Slot & hull) : Allowed(0), component(comp), count(amount), mPosition(Pos), mSlotLeft(hull.mSlotLeft), mSlotTop(hull.mSlotTop) {}
00045 //      Slot(long allowed, long maximum, long Pos) : Allowed(allowed), component(NULL), count(maximum), mPosition(Pos) {}
00046         Slot(const TiXmlNode * node, long Pos);
00047         Slot(const Slot & other) : Allowed(other.Allowed), component(other.component), count(other.count), mPosition(other.mPosition), mSlotLeft(other.mSlotLeft), mSlotTop(other.mSlotTop) {}
00048 
00049         const Component * GetComp() const       { return component; }
00050         bool IsAllowed(ComponentType type) const                { return type & Allowed ? true : false; }
00051         int GetCount() const                            { return count; }
00052         long GetPosition() const                        { return mPosition; }
00053 
00054         void SetComp(const Component * comp)    { component = comp; }
00055 
00056         friend bool operator==(const Slot & s1, const Slot & s2);
00057         friend bool operator!=(const Slot & s1, const Slot & s2)        { return !(s1 == s2); }
00058 
00059 private:
00060         ComponentType Allowed;  // what types are allowed in this slot
00061         const Component * component;    // what component is here (in a design)
00062         long count;     // max allowed, or current count
00063         long mPosition;         // where the slot is in the hull
00064         long mSlotLeft;
00065         long mSlotTop;
00066 };
00067 
00068 #endif // !defined(Slot_h)

Generated on Mon Aug 8 21:33:45 2005 for Freestars by  doxygen 1.4.2-20050421