GameScript: Move initialization out of constructor.
[gemrb.git] / gemrb / core / ProjectileServer.h
blobb3a3ef74819eba6dc0f9b40b47b7ea53d941f888
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"
25 #include "PluginMgr.h"
26 #include "Projectile.h"
28 //the number of resrefs in areapro.2da (before the flags field)
29 #define AP_RESCNT 5
31 //this represents a line of projectl.ids
32 class ProjectileEntry
34 public:
35 ProjectileEntry()
37 memset(this,0,sizeof(ProjectileEntry));
39 ~ProjectileEntry()
41 if (projectile)
42 delete projectile;
45 ieResRef resname;
46 Projectile *projectile;
49 class ExplosionEntry
51 public:
52 ExplosionEntry()
54 memset(this,0,sizeof(ExplosionEntry));
56 ieResRef resources[AP_RESCNT];
57 int flags;
60 //this singleton object serves the projectile objects
61 class GEM_EXPORT ProjectileServer
63 public:
64 ProjectileServer();
65 ~ProjectileServer();
67 Projectile *GetProjectileByIndex(unsigned int idx);
68 //it is highly unlikely we need this function
69 Projectile *GetProjectileByName(const ieResRef resname);
70 //returns the highest projectile id
71 unsigned int GetHighestProjectileNumber();
72 int InitExplosion();
73 int GetExplosionFlags(unsigned int idx);
74 ieResRef const *GetExplosion(unsigned int idx, int type);
75 //creates an empty projectile on the fly
76 Projectile *CreateDefaultProjectile(unsigned int idx);
77 private:
78 ProjectileEntry *projectiles; //this is the list of projectiles
79 int projectilecount;
80 ExplosionEntry *explosions; //this is the list of explosion resources
81 int explosioncount;
82 // internal function: what is max valid projectile id?
83 unsigned int PrepareSymbols(class SymbolMgr *projlist);
84 // internal function: read projectiles
85 void AddSymbols(class SymbolMgr *projlist);
86 //this method is used internally
87 Projectile *GetProjectile(unsigned int idx);
88 //creates a clone from the cached projectiles
89 Projectile *ReturnCopy(unsigned int idx);
90 //returns one of the resource names
93 #endif // PROJSERVER_H