Skip to content

Commit

Permalink
Fixed|Client: Clearing the DED database
Browse files Browse the repository at this point in the history
memset cannot be used because it contains a C++ member.
  • Loading branch information
skyjake committed May 15, 2013
1 parent 743b5d4 commit 94a9e4b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
38 changes: 36 additions & 2 deletions doomsday/client/include/def_data.h
Expand Up @@ -592,7 +592,7 @@ typedef struct ded_compositefont_s {
// index numbers are important. The Game DLL must be recompiled with the
// new constants if the order of the array items changes.

typedef struct ded_s {
struct ded_s {
int version; // DED version number.
ded_flags_t modelFlags; // Default values for models.
float modelScale;
Expand Down Expand Up @@ -695,7 +695,41 @@ typedef struct ded_s {

// Composite fonts.
ded_compositefont_t* compositeFonts;
} ded_t;

/// Constructor initializes everything to zero.
ded_s()
: version(DED_VERSION),
modelFlags(0),
modelScale(0),
modelOffset(0),
flags(0),
mobjs(0),
states(0),
sprites(0),
lights(0),
materials(0),
skies(0),
sounds(0),
music(0),
mapInfo(0),
text(0),
textureEnv(0),
values(0),
details(0),
ptcGens(0),
finales(0),
decorations(0),
reflections(0),
groups(0),
lineTypes(0),
sectorTypes(0),
compositeFonts(0)
{
de::zap(count);
}
};

typedef ded_s ded_t;

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 1 addition & 2 deletions doomsday/client/src/def_data.cpp
Expand Up @@ -93,8 +93,7 @@ void DED_ZCount(ded_count_t* c)

void DED_Init(ded_t* ded)
{
memset(ded, 0, sizeof(*ded));
ded->version = DED_VERSION;
*ded = ded_t();
}

void DED_Clear(ded_t* ded)
Expand Down

0 comments on commit 94a9e4b

Please sign in to comment.