ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/loader.h
(Generate patch)

Comparing deliantra/server/include/loader.h (file contents):
Revision 1.4 by root, Fri Dec 15 20:07:02 2006 UTC vs.
Revision 1.9 by root, Thu Feb 1 19:40:42 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 * CrossFire, A Multiplayer game for X-windows
3 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
6 7 *
7 This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 11 * (at your option) any later version.
11 12 *
12 This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 16 * GNU General Public License for more details.
16 17 *
17 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 21 *
21 The authors can be reached via e-mail to crossfire.de 22 * The authors can be reached via e-mail to crossfire@schmorp.de
22*/ 23 */
23 24
24 25
25#define LL_IGNORED -1 26#define LL_IGNORED -1
26#define LL_EOF 0 27#define LL_EOF 0
27#define LL_MORE 1 28#define LL_MORE 1
28#define LL_NORMAL 2 29#define LL_NORMAL 2
29 30
30extern int nrofpixmaps; 31extern int nrofpixmaps;
32
33// resource loader pure base class
34struct 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
75struct 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
81struct 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
87struct 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
93struct 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
99struct 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
105struct 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
111struct 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
119struct loader_generic
120: virtual loader_base,
121 loader_object, loader_player,
122 loader_region, loader_face,
123 loader_treasure, loader_animation
124{
125};
126

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines