Willkommen ~Gast!
Registrieren || Einloggen || Hilfe/FAQ || Staff
Probleme mit der Registrierung im Forum? Melde dich unter registerEin Bild.
Autor Beitrag
000
14.03.2002, 18:06
thinktank



void Draw_TestJob( void )
{
static bool AddedJobs;

if(!AddedJobs)
{
CParticleJob* p = new CParticleJob;
/*
BlaBla
*/
AddedJobs = true;
gParticleManager.AddJob(p);
return; // Fake-Breakpoint
}

/*
BlaBla
*/
}

void CParticleManager::AddJob(CParticleJob* job)
{
if (job)
{
int x = m_iParticleCount + job->m_iCount;
if (x >= MAX_PARTICLES_IN_WORLD)
{
gEngfuncs.Con_Printf("Too many Particles in world!\n");
}
else
{
job->next = m_pIndex;
m_pIndex = job; // HERE IS THE ERROR , WHY ?
m_iParticleCount += job->m_iCount;
}
}
}

Hier hab ich return nur eingesetzt, um einen Breakpoint zu "simulieren",
(warum ? -> http://www.thewall.de/ThWboard/showtopic.php3?threadid=24388). Durch meine Pseudo-Breakpoints hab ich herausgefunden, dass der Fehler an der markierten Zeile liegen muss, aber warum ? m_pIndex habe ich im Konstruktor von CParticleManager auf NULL gesetzt. Alle jobs werden im Destruktor deleted ... :\ ?

--


Dieser Beitrag wurde am 14.03.2002 um 18:07 von thinktank bearbeitet.
zum Seitenanfang zum Seitenende Profil || Suche
001
15.03.2002, 01:31
Rockefeller



hmm thats... weird :D

keine Ahnung, aber an der Zeile kann es eigentlich nicht liegen, das ist ja bloss ne simple Zuweisung.

Was ist denn das genau für ein Fehler, der da auftritt?

--

zum Seitenanfang zum Seitenende Profil || Suche
002
15.03.2002, 06:59
Tron



poste mal die deklarationen von job, m_pIndex und der klasse von job.
was genau laeuft eigentlich falsch?

--

'KEINE PANIK' - aus der Triologie in fuenf Baenden von Douglas Adams

'FÜR DEINN FERD' - aus 'Gevatter Tod' von Terry Pratchett

zum Seitenanfang zum Seitenende Profil || Suche
003
15.03.2002, 16:52
thinktank



class CParticleJob
{
public:

float color_end[4];
float color_start[4];
float size_end[2];
float size_start[2];

float life;
vec3_t vel; // start-value for velocity
vec3_t origin; // start-value for the origin

float gravity;

int flags;
int m_iParticleCount; // the number of particles in world
int m_iCount; // how many particles should be created
bool stop; // if true , draw until all particles are burnded out

float m_flFrametime;

int m_iSprite;
model_s* m_pSprite;

CParticleJob *next;

CParticleJob();
void CreateParticle();
void Clear();
void ClearFreed();
virtual void Draw( void );
private:
void CalcDeltas(particle_t *p);
particle_t* m_pIndex;
particle_t* m_pFreedIndex;
};

class CParticleManager
{
public:
void AddJob(CParticleJob *job);
void DeleteJob(CParticleJob *job,CParticleJob *nextjob, CParticleJob *prevjob);
void Update( void );
CParticleManager();
~CParticleManager();
private:
void Clear();
int m_iParticleCount; // the number of particles in world
CParticleJob* m_pIndex; // Hier ist der gesuchte m_pIndex
};

void CParticleManager::AddJob(CParticleJob* job)
{
if (job)
{
int x = m_iParticleCount + job->m_iCount;
if (x >= MAX_PARTICLES_IN_WORLD)
{
gEngfuncs.Con_Printf("Too many Particles in world\n");
}
else
{
job->next = m_pIndex;
m_pIndex = job;
m_iParticleCount += job->m_iCount;
}
}
}

CParticleManager::~CParticleManager()
{
Clear();
}

CParticleManager::CParticleManager()
{
m_pIndex = NULL;
m_iParticleCount = 0;
}

void CParticleManager::Clear()
{
CParticleJob *job;

while(m_pIndex)
{
job = m_pIndex;
m_pIndex = job->next;
delete job;
}
}

Das ganze ist hundertpro nicht fehlerfrei, aber die Stelle ist trotzdem seltsam.
Beim Debuggen kommt folgender Ausnahmefehler :

Unbehandelte Ausnahme bei 0x046d8f89 in hl.exe: 0xC0000005: Zugriffsverletzung-Leseposition 0x00000184.

ASM-Code : mov edx,dword ptr [ecx+184h]

Ich hoffe das hilft. Jaja das ganze ist dem Tut von TTT ziemlich ähnlich =).

--

zum Seitenanfang zum Seitenende Profil || Suche
004
16.03.2002, 17:49
thinktank



* hochpost :( *

--

zum Seitenanfang zum Seitenende Profil || Suche
005
17.03.2002, 01:14
Rockefeller



Ja an der Anweisung kanns nicht liegen, vermutlich greifst du irgentwann auf einen Pointer ins Leere zu. Aber ich hab keine Ahnung wo... :/

--

zum Seitenanfang zum Seitenende Profil || Suche
006
18.03.2002, 17:58
thinktank



hmm dann muss ichs wohl nochmal abgrasen :\

--

zum Seitenanfang zum Seitenende Profil || Suche