factored out the EFFv2 saving into EFFImporter
[gemrb.git] / gemrb / core / ProjectileServer.h
blobd53f99c1246f7d1ae88821d518b45f4bb7ab1ead
1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2006 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef PROJSERVER_H
22 #define PROJSERVER_H
24 #include "exports.h"
26 #include "PluginMgr.h"
27 #include "Projectile.h"
29 class SymbolMgr;
31 //the number of resrefs in areapro.2da (before the flags field)
32 #define AP_RESCNT 5
34 //this represents a line of projectl.ids
35 class ProjectileEntry
37 public:
38 ProjectileEntry()
40 memset(this,0,sizeof(ProjectileEntry));
42 ~ProjectileEntry()
44 if (projectile)
45 delete projectile;
48 ieResRef resname;
49 Projectile *projectile;
52 class ExplosionEntry
54 public:
55 ExplosionEntry()
57 memset(this,0,sizeof(ExplosionEntry));
59 ieResRef resources[AP_RESCNT];
60 int flags;
63 //this singleton object serves the projectile objects
64 class GEM_EXPORT ProjectileServer
66 public:
67 ProjectileServer();
68 ~ProjectileServer();
70 Projectile *GetProjectileByIndex(unsigned int idx);
71 //it is highly unlikely we need this function
72 Projectile *GetProjectileByName(const ieResRef resname);
73 //returns the highest projectile id
74 unsigned int GetHighestProjectileNumber();
75 int InitExplosion();
76 int GetExplosionFlags(unsigned int idx);
77 ieResRef const *GetExplosion(unsigned int idx, int type);
78 //creates an empty projectile on the fly
79 Projectile *CreateDefaultProjectile(unsigned int idx);
80 private:
81 ProjectileEntry *projectiles; //this is the list of projectiles
82 int projectilecount;
83 ExplosionEntry *explosions; //this is the list of explosion resources
84 int explosioncount;
85 // internal function: what is max valid projectile id?
86 unsigned int PrepareSymbols(Holder<SymbolMgr> projlist);
87 // internal function: read projectiles
88 void AddSymbols(Holder<SymbolMgr> projlist);
89 //this method is used internally
90 Projectile *GetProjectile(unsigned int idx);
91 //creates a clone from the cached projectiles
92 Projectile *ReturnCopy(unsigned int idx);
93 //returns one of the resource names
96 #endif // PROJSERVER_H