source: golgotha/src/golg/saver.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.3 KB
RevLine 
[80]1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef G1_SAVER_HH
10#define G1_SAVER_HH
11
12#include "file/file.hh"
13#include "memory/growarry.hh"
14#include "path.hh"
15#include "reference.hh"
16#include "loaders/dir_load.hh"
17#include "loaders/dir_save.hh"
18#include "lisp/li_types.hh"
19#include "global_id.hh"
20
21class g1_path_saver_class;
22class g1_object_class;
23
24
25struct g1_saver_section_type
26{
27  w16 section_id;
28  w32 section_offset;
29  g1_saver_section_type(w16 section_id, w32 section_offset)
30    : section_offset(section_offset), section_id(section_id) {}
31};
32
33
34class g1_saver_class : public i4_saver_class
35{
36  g1_object_class **ref_list;
37  w32 t_refs;
38  g1_global_id_manager_class::remapper *remap;
39
40public:
41  g1_saver_class(i4_file_class *out, i4_bool close_on_delete=i4_T);
42  ~g1_saver_class();
43
44  void set_helpers(g1_object_class **reference_list, w32 total_references);
45  virtual i4_bool write_reference(const g1_reference_class &ref);
46  i4_bool write_global_id(w32 id);
47};
48
49class g1_loader_class : public i4_loader_class
50{
51  g1_object_class **ref_list;
52  w32 t_refs;
53  g1_reference_class *first_ref;
54  w32 *id_remap;
55
56public:
57  li_type_number *li_remap;    // used to load lisp objects
58
59  i4_bool references_were_loaded() { return first_ref!=0; }
60
61  g1_loader_class(i4_file_class *in, i4_bool close_on_delete=i4_T);
62
63  void set_remap(w32 total_refs);
64  void end_remap();
65
66  void set_helpers(g1_object_class **reference_list, w32 total_references);
67
68  void read_reference(g1_reference_class &ref);
69  w32 read_global_id();
70
71  // called by level loader after all objects have been loaded
72  void convert_references();
73
74  ~g1_loader_class();
75};
76
77// returns NULL if file is corrupted
78g1_loader_class *g1_open_save_file(i4_file_class *in,
79                                   i4_bool close_on_delete_or_fail=i4_T);
80
81#endif
82
83
84
Note: See TracBrowser for help on using the repository browser.