Logo
~Sockets~
~Examples~
~Contact~

Portal.cpp

Go to the documentation of this file.
00001 // Portal.cpp
00002 // released 2006-09-25
00003 /*
00004 Copyright (C) 2006  Anders Hedstrom (grymse@alhem.net)
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program 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 this program; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 */
00020 #include <libfuture.h>
00021 
00022 #include "Portal.h"
00023 #include "Player.h"
00024 #include "InSocket.h"
00025 
00026 
00027 Portal::Portal(Database& db,Chunk& chunk) : Chunkinfo(db, chunk)
00028 {
00029 }
00030 
00031 
00032 Portal::Portal(Database& db,Chunk& chunk,int x,int y) : Chunkinfo(db, chunk, x, y, TYPE_PORTAL)
00033 {
00034 }
00035 
00036 
00037 Portal::~Portal()
00038 {
00039 }
00040 
00041 
00042 void Portal::SetToArea(int x)
00043 {
00044         m_chunkinfo -> to_area = x;
00045 }
00046 
00047 
00048 void Portal::SetToChunk(int x)
00049 {
00050         m_chunkinfo -> to_chunk = x;
00051 }
00052 
00053 
00054 void Portal::SetToX(int x)
00055 {
00056         m_chunkinfo -> to_x = x;
00057 }
00058 
00059 
00060 void Portal::SetToY(int x)
00061 {
00062         m_chunkinfo -> to_y = x;
00063 }
00064 
00065 
00066 int Portal::GetToArea()
00067 {
00068         return m_chunkinfo -> to_area;
00069 }
00070 
00071 
00072 int Portal::GetToChunk()
00073 {
00074         return m_chunkinfo -> to_chunk;
00075 }
00076 
00077 
00078 int Portal::GetToX()
00079 {
00080         return m_chunkinfo -> to_x;
00081 }
00082 
00083 
00084 int Portal::GetToY()
00085 {
00086         return m_chunkinfo -> to_y;
00087 }
00088 
00089 
00090 void Portal::Display(InSocket *from)
00091 {
00092         if (!Exists())
00093                 return;
00094         Player pl(from -> GetDatabase(),from -> GetAccountName());
00095         from -> Send("  You see a portal.\n");
00096         if (pl.IsWizard())
00097         {
00098                 from -> Sendf("  [&gToArea:&W%ld&n  &gToChunk:&W%ld&n  &gToX:&W%d&n  &gToY:&W%d&n]\n",
00099                         GetToArea(), GetToChunk(), GetToX(), GetToY());
00100         }
00101 }
00102 
00103 
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4