Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/buffers.cc2
-rw-r--r--src/audio/pcm.cc13
-rw-r--r--src/audio/pcm.h5
-rw-r--r--src/core/cvar.cc8
-rw-r--r--src/core/cvar.h10
-rw-r--r--src/core/module.cc7
-rw-r--r--src/render/dust.cc20
7 files changed, 25 insertions, 40 deletions
diff --git a/src/audio/buffers.cc b/src/audio/buffers.cc
index dd83000..4e26c33 100644
--- a/src/audio/buffers.cc
+++ b/src/audio/buffers.cc
@@ -87,6 +87,8 @@ size_t Buffers::load(std::string name)
registry[name] = id;
index++;
+ delete pcm;
+
return id;
}
diff --git a/src/audio/pcm.cc b/src/audio/pcm.cc
index b485199..7a3f767 100644
--- a/src/audio/pcm.cc
+++ b/src/audio/pcm.cc
@@ -33,17 +33,4 @@ void PCM::clear()
memset(pcm_data, 0, pcm_size);
}
-void PCM::load(const char *name)
-{
- PCM *pcm = Wav::load(name);
- if (pcm) {
- delete pcm;
- }
-}
-
-void PCM::load(std::string const & name)
-{
- load(name.c_str());
-}
-
}
diff --git a/src/audio/pcm.h b/src/audio/pcm.h
index 740a23c..dc8eb16 100644
--- a/src/audio/pcm.h
+++ b/src/audio/pcm.h
@@ -38,11 +38,6 @@ public:
/// number of channels
inline unsigned int channels() const { return pcm_channels; }
- /// load PCM audio data from file
- static void load(std::string const & name);
-
- static void load(const char *name);
-
private:
unsigned char *pcm_data;
diff --git a/src/core/cvar.cc b/src/core/cvar.cc
index 45f04f3..50043f2 100644
--- a/src/core/cvar.cc
+++ b/src/core/cvar.cc
@@ -35,7 +35,7 @@ Cvar *Cvar::rconpassword = 0;
Cvar::Registry Cvar::cvar_registry;
-Cvar::Cvar(const char *name, unsigned int flags)
+Cvar::Cvar(const char *name, const unsigned int flags)
{
cvar_flags = flags;
@@ -76,7 +76,7 @@ Cvar & Cvar::operator=(float other)
return (*this);
}
-Cvar* Cvar::get(const char *name, const char *value, unsigned int flags)
+Cvar* Cvar::get(const char *name, const char *value, const unsigned int flags)
{
Cvar *c = find(name);
if (c) {
@@ -92,7 +92,7 @@ Cvar* Cvar::get(const char *name, const char *value, unsigned int flags)
return c;
}
-Cvar* Cvar::get(const char *name, float value, unsigned int flags)
+Cvar* Cvar::get(const char *name, float value, const unsigned int flags)
{
Cvar *c = find(name);
if (c) {
@@ -107,7 +107,7 @@ Cvar* Cvar::get(const char *name, float value, unsigned int flags)
return c;
}
-Cvar* Cvar::set(const char *name, const char *value, unsigned int flags)
+Cvar* Cvar::set(const char *name, const char *value, const unsigned int flags)
{
Cvar *c = find(name);
if (!c) {
diff --git a/src/core/cvar.h b/src/core/cvar.h
index b8e406c..d934872 100644
--- a/src/core/cvar.h
+++ b/src/core/cvar.h
@@ -27,7 +27,7 @@ public:
enum Flags {Archive=1, ReadOnly=2, Game=4, Info=8};
/// create a new variable
- Cvar(const char *name, unsigned int flags = 0);
+ Cvar(const char *name, const unsigned int flags = 0);
/*----- inspectors ------------------------------------------------ */
@@ -70,26 +70,26 @@ public:
* its value will not be changed. If the cvar does not exist,
* it will be created
*/
- static Cvar *get(const char *name, const char *value, unsigned int flags=0);
+ static Cvar *get(const char *name, const char *value, const unsigned int flags=0);
/// get a cvar value from the registry
/** If the a cvar with the given name already exists in the registry,
* its value will not be changed. If the cvar does not exist,
* it will be created
*/
- static Cvar *get(const char *name, float value, unsigned int flags=0);
+ static Cvar *get(const char *name, float value, const unsigned int flags=0);
/// set a cvar value
/** If the a cvar with the given name already exists in the registry,
* its value will be replaced
*/
- static Cvar *set(const char *name, const char *value, unsigned int flags=0);
+ static Cvar *set(const char *name, const char *value, const unsigned int flags=0);
/// set a cvar value
/** If the a cvar with the given name already exists in the registry,
* its value will be replaced
*/
- static Cvar *set(const char *name, float value, unsigned int flags=0);
+ static Cvar *set(const char *name, float value, const unsigned int flags=0);
/// delete a cvar from the registry
static void unset(const char *name);
diff --git a/src/core/module.cc b/src/core/module.cc
index 8eef50f..447e2b3 100644
--- a/src/core/module.cc
+++ b/src/core/module.cc
@@ -9,13 +9,12 @@
namespace core
{
-Module *Module::module_preload;
+Module *Module::module_preload = 0;
-Module::Module(const char *name)
+Module::Module(const char *name) :
+ module_name(name)
{
module_running = false;
- module_name.assign(name);
- module_preload = 0;
}
Module::~Module()
diff --git a/src/render/dust.cc b/src/render/dust.cc
index b0926dc..64969e3 100644
--- a/src/render/dust.cc
+++ b/src/render/dust.cc
@@ -23,8 +23,8 @@ const float TRAILLENGHT = 0.25f;
const float DUSTMAXALPHA = 0.8f;
const float DUSTDISTANCE = 8.0f;
-float *dust;
-size_t dustsize;
+float *dust = 0;
+size_t dustsize = 0;
void Dust::init()
{
@@ -41,7 +41,7 @@ void Dust::init()
void Dust::shutdown()
{
if (dust) {
- delete dust;
+ free(dust);
dust = 0;
dustsize = 0;
}
@@ -49,8 +49,10 @@ void Dust::shutdown()
void Dust::reset()
{
- delete dust;
- dust = 0;
+ if (dust) {
+ free(dust);
+ dust = 0;
+ }
}
void Dust::draw()
@@ -60,7 +62,7 @@ void Dust::draw()
if (!r_dust->value()) {
if (dust) {
- delete dust;
+ free(dust);
dust = 0;
}
return;
@@ -69,7 +71,7 @@ void Dust::draw()
if ((size_t) r_dustsize->value() != dustsize) {
con_debug << " changing dust size..." << std::endl;
if (dust) {
- delete dust;
+ free(dust);
dust = 0;
}
}
@@ -78,7 +80,7 @@ void Dust::draw()
if (!dustsize) {
if (dust) {
- delete dust;
+ free(dust);
dust = 0;
}
return;
@@ -93,7 +95,7 @@ void Dust::draw()
if (!dust) {
con_debug << " generating dust..." << std::endl;
- dust = new float[dustsize*3];
+ dust = (float *) malloc(sizeof(float) * dustsize* 3);
for (size_t i = 0; i < dustsize; i++) {
dust[i*3] = core::localcontrol()->location().x + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius());