Adonthell  0.4
quest.cc
1 /*
2  $Id: quest.cc,v 1.6 2001/08/12 20:23:49 ksterker Exp $
3 
4  Copyright (C) 2000 Kai Sterker <kaisterker@linuxgames.com>
5  Part of the Adonthell Project http://adonthell.linuxgames.com
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #include "quest.h"
16 
17 dictionary <quest *> data::quests;
18 
19 quest::quest ()
20 {
21 }
22 
23 quest::~quest ()
24 {
25 }
26 
27 // Save a quest object
28 void quest::save (ogzstream& out)
29 {
31  u_int32 j;
32 
33  // Save name
34  name >> out;
35 
36  // Save all variables and flags
37  j = size ();
38  j >> out;
39 
40  for (i = begin (); i != end (); i++)
41  {
42  string s = (*i).first;
43  s >> out;
44  (*i).second >> out;
45  }
46 }
47 
48 // Load a quest object and add it to the quest-arrays
49 void quest::load (igzstream& in)
50 {
51  u_int32 i, size;
52  s_int32 value;
53  string key;
54 
55  name << in;
56 
57  size << in;
58  for (i = 0; i < size; i++)
59  {
60  key << in;
61  value << in;
62  set_val (key.c_str (), value);
63  }
64 }