ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/loader.h
Revision: 1.9
Committed: Thu Feb 1 19:40:42 2007 UTC (17 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.8: +2 -0 lines
Log Message:
load regions from perl, reload on, well, reload

File Contents

# Content
1 /*
2 * CrossFire, A Multiplayer game for X-windows
3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (C) 1992 Frank Tore Johansen
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * The authors can be reached via e-mail to crossfire@schmorp.de
23 */
24
25
26 #define LL_IGNORED -1
27 #define LL_EOF 0
28 #define LL_MORE 1
29 #define LL_NORMAL 2
30
31 extern int nrofpixmaps;
32
33 // resource loader pure base class
34 struct loader_base
35 {
36 const char *filename;
37
38 virtual ~loader_base ();
39
40 virtual archetype *get_arch (const char *name);
41 virtual void put_arch (archetype *arch);
42
43 virtual object *get_object (const char *name);
44 virtual void put_object (object *op);
45
46 virtual player *get_player ();
47 virtual void put_player (player *pl);
48
49 virtual region *get_region (const char *name);
50 virtual void put_region (region *rgn);
51
52 virtual facetile *get_face (const char *name);
53 virtual void put_face (facetile *face);
54
55 virtual treasurelist *get_treasure (const char *name, bool one = false);
56 virtual void put_treasure (treasurelist *treasure);
57
58 virtual animation *get_animation (const char *name);
59 virtual void put_animation (animation *anim);
60
61 bool parse_arch (object_thawer &thawer, archetype *arch);
62 bool parse_object (object_thawer &thawer, object *op);
63 bool parse_player (object_thawer &thawer, player *pl);
64 bool parse_region (object_thawer &thawer, region *rgn);
65 bool parse_face (object_thawer &thawer, facetile *face);
66 bool parse_treasure (object_thawer &thawer, treasurelist *treasure);
67 bool parse_animation (object_thawer &thawer, animation *anim);
68
69 bool parse (object_thawer &thawer);
70
71 bool load (const char *filename);
72 };
73
74 // pure base class for default archetype loader
75 struct loader_arch : virtual loader_base {
76 archetype *get_arch (const char *name);
77 void put_arch (archetype *arch);
78 };
79
80 // pure base class for default object loader
81 struct loader_object : virtual loader_base {
82 object *get_object (const char *name);
83 void put_object (object *op);
84 };
85
86 // pure base class for default player loader
87 struct loader_player : virtual loader_base {
88 virtual player *get_player ();
89 virtual void put_player (player *pl);
90 };
91
92 // pure base class for default region loader
93 struct loader_region : virtual loader_base {
94 region *get_region (const char *name);
95 void put_region (region *rgn);
96 };
97
98 // pure base class for default face loader
99 struct loader_face : virtual loader_base {
100 facetile *get_face (const char *name);
101 void put_face (facetile *face);
102 };
103
104 // pure base class for default treasure loader
105 struct loader_treasure : virtual loader_base {
106 treasurelist *get_treasure (const char *name, bool one = false);
107 void put_treasure (treasurelist *treasure);
108 };
109
110 // pure base class for default animation loader
111 struct loader_animation : virtual loader_base {
112 animation *get_animation (const char *name);
113 void put_animation (animation *anim);
114 };
115
116 // future generic resource loader
117 // handles generic stuff valid in most files, such as
118 // animations, treasures, faces and so on
119 struct loader_generic
120 : virtual loader_base,
121 loader_object, loader_player,
122 loader_region, loader_face,
123 loader_treasure, loader_animation
124 {
125 };
126