GumpNotifyProcess.cpp

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2003-2005  The Pentagram Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #include "pent_include.h"
00020 #include "GumpNotifyProcess.h"
00021 #include "Gump.h"
00022 #include "getObject.h"
00023 
00024 #include "IDataSource.h"
00025 #include "ODataSource.h"
00026 
00027 DEFINE_RUNTIME_CLASSTYPE_CODE(GumpNotifyProcess,Process);
00028 
00029 GumpNotifyProcess::GumpNotifyProcess()
00030         : Process()
00031 {
00032 
00033 }
00034 
00035 GumpNotifyProcess::GumpNotifyProcess(uint16 it) : Process(it), gump(0)
00036 {
00037         result = 0;
00038         type = 0x200; // CONSTANT!
00039 }
00040 
00041 GumpNotifyProcess::~GumpNotifyProcess(void)
00042 {
00043 }
00044 
00045 void GumpNotifyProcess::setGump(Gump *g)
00046 {
00047         gump = g->getObjId();
00048 }
00049 
00050 
00051 void GumpNotifyProcess::notifyClosing(int res)
00052 {
00053         gump = 0;
00054         result = res;
00055         if (!(flags & PROC_TERMINATED)) terminate();
00056 }
00057 
00058 void GumpNotifyProcess::terminate()
00059 {
00060         Process::terminate();
00061 
00062         if (gump) {
00063                 Gump* g = ::getGump(gump);
00064                 assert(g);
00065                 g->Close();
00066         }
00067 }
00068 
00069 bool GumpNotifyProcess::run(const uint32)
00070 {
00071         return false;
00072 }
00073 
00074 void GumpNotifyProcess::dumpInfo()
00075 {
00076         Process::dumpInfo();
00077         pout << " gump: " << gump << std::endl;
00078 }
00079 
00080 void GumpNotifyProcess::saveData(ODataSource* ods)
00081 {
00082         Process::saveData(ods);
00083 
00084         ods->write2(gump);
00085 }
00086 
00087 bool GumpNotifyProcess::loadData(IDataSource* ids, uint32 version)
00088 {
00089         if (!Process::loadData(ids, version)) return false;
00090 
00091         gump = ids->read2();
00092 
00093         return true;
00094 }
00095 
00096 // Colourless Protection

Generated on Fri Jul 27 22:27:17 2007 for pentagram by  doxygen 1.4.7