Adonthell 0.4
|
00001 /* 00002 $Id: quest.cc,v 1.6 2001/08/12 20:23:49 ksterker Exp $ 00003 00004 Copyright (C) 2000 Kai Sterker <kaisterker@linuxgames.com> 00005 Part of the Adonthell Project http://adonthell.linuxgames.com 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License. 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY. 00011 00012 See the COPYING file for more details. 00013 */ 00014 00015 #include "quest.h" 00016 00017 dictionary <quest *> data::quests; 00018 00019 quest::quest () 00020 { 00021 } 00022 00023 quest::~quest () 00024 { 00025 } 00026 00027 // Save a quest object 00028 void quest::save (ogzstream& out) 00029 { 00030 storage::iterator i; 00031 u_int32 j; 00032 00033 // Save name 00034 name >> out; 00035 00036 // Save all variables and flags 00037 j = size (); 00038 j >> out; 00039 00040 for (i = begin (); i != end (); i++) 00041 { 00042 string s = (*i).first; 00043 s >> out; 00044 (*i).second >> out; 00045 } 00046 } 00047 00048 // Load a quest object and add it to the quest-arrays 00049 void quest::load (igzstream& in) 00050 { 00051 u_int32 i, size; 00052 s_int32 value; 00053 string key; 00054 00055 name << in; 00056 00057 size << in; 00058 for (i = 0; i < size; i++) 00059 { 00060 key << in; 00061 value << in; 00062 set_val (key.c_str (), value); 00063 } 00064 }