Skip to content

Commit

Permalink
Refactor|libcommon: Switched all remaining sources dealing with save …
Browse files Browse the repository at this point in the history
…state IO to C++
  • Loading branch information
danij-deng committed Feb 3, 2014
1 parent da2c782 commit 06b4c96
Show file tree
Hide file tree
Showing 10 changed files with 438 additions and 682 deletions.
12 changes: 7 additions & 5 deletions doomsday/client/src/dd_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ class ZipFileType : public de::NativeFileType
{
public:
ZipFileType() : NativeFileType("FT_ZIP", RC_PACKAGE)
{}
{
addKnownExtension(".pk3");
addKnownExtension(".zip");
}

de::File1 *interpret(de::FileHandle &hndl, String path, FileInfo const &info) const
{
Expand All @@ -122,7 +125,9 @@ class WadFileType : public de::NativeFileType
{
public:
WadFileType() : NativeFileType("FT_WAD", RC_PACKAGE)
{}
{
addKnownExtension(".wad");
}

de::File1 *interpret(de::FileHandle &hndl, String path, FileInfo const &info) const
{
Expand Down Expand Up @@ -186,13 +191,10 @@ static void registerResourceFileTypes()
ResourceClass& packageClass = App_ResourceClass("RC_PACKAGE");

ftype = new ZipFileType();
ftype->addKnownExtension(".pk3");
ftype->addKnownExtension(".zip");
packageClass.addFileType(*ftype);
fileTypeMap.insert(ftype->name().toLower(), ftype);

ftype = new WadFileType();
ftype->addKnownExtension(".wad");
packageClass.addFileType(*ftype);
fileTypeMap.insert(ftype->name().toLower(), ftype);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/world/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound)
*/
ListNode *newLink()
{
if(linkStoreCursor < LINKSTORE_SIZE)
if(linkStoreCursor < (unsigned)LINKSTORE_SIZE)
{
return &linkStore[linkStoreCursor++];
}
Expand Down
6 changes: 3 additions & 3 deletions doomsday/plugins/common/common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ SOURCES += \
$$common_src/p_plat.cpp \
$$common_src/p_player.c \
$$common_src/p_saveg.cpp \
$$common_src/p_saveio.c \
$$common_src/p_saveio.cpp \
$$common_src/p_scroll.cpp \
$$common_src/p_sound.cpp \
$$common_src/p_start.cpp \
Expand All @@ -116,11 +116,11 @@ SOURCES += \
$$common_src/p_tick.c \
$$common_src/p_user.c \
$$common_src/p_view.c \
$$common_src/p_xgfile.c \
$$common_src/p_xgfile.cpp \
$$common_src/p_xgline.c \
$$common_src/p_xgsave.cpp \
$$common_src/p_xgsec.c \
$$common_src/polyobjs.cpp \
$$common_src/r_common.c \
$$common_src/saveinfo.c \
$$common_src/saveinfo.cpp \
$$common_src/x_hair.c
43 changes: 8 additions & 35 deletions doomsday/plugins/common/include/p_saveio.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/**
* @file p_saveio.h
* Game save file IO.
/** @file p_saveio.h Game save file IO.
*
* @authors Copyright &copy; 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright &copy; 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -28,10 +26,6 @@
#include "lzss.h"
#include "p_savedef.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum savestatesegment_e {
ASEG_MAP_HEADER = 102, // Hexen only
ASEG_MAP_ELEMENTS,
Expand All @@ -54,6 +48,10 @@ enum {
SV_INVALIDFILENAME
};

#ifdef __cplusplus
extern "C" {
#endif

void SV_InitIO(void);
void SV_ShutdownIO(void);

Expand Down Expand Up @@ -107,36 +105,11 @@ void SV_ReadConsistencyBytes(void);
*/
void SV_Seek(uint offset);

#if 0
/*
* Writing and reading values
*/
void SV_Write(void const *data, int len);
void SV_WriteByte(byte val);
#if __JHEXEN__
void SV_WriteShort(unsigned short val);
#else
void SV_WriteShort(short val);
#endif
#if __JHEXEN__
void SV_WriteLong(unsigned int val);
#else
void SV_WriteLong(long val);
#endif
void SV_WriteFloat(float val);

void SV_Read(void *data, int len);
byte SV_ReadByte(void);
short SV_ReadShort(void);
long SV_ReadLong(void);
float SV_ReadFloat(void);
#endif

Writer *SV_NewWriter(void);
Reader *SV_NewReader(void);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* LIBCOMMON_SAVESTATE_INPUT_OUTPUT_H */
#endif // LIBCOMMON_SAVESTATE_INPUT_OUTPUT_H
7 changes: 5 additions & 2 deletions doomsday/plugins/common/include/p_xg.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @file p_xg.h Extended Generalised Line / Sector Types.
/** @file p_xg.h Extended generalised line / sector types.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand Down Expand Up @@ -46,6 +46,9 @@ void XG_Ticker(void);
// Updates XG state during engine reset.
void XG_Update(void);

/**
* See if any line or sector types are saved in a DDXGDATA lump.
*/
void XG_ReadTypes(void);

linetype_t *XG_GetLumpLine(int id);
Expand All @@ -55,4 +58,4 @@ sectortype_t *XG_GetLumpSector(int id);
} // extern "C"
#endif

#endif /* LIBCOMMON_PLAYSIM_XG_H */
#endif // LIBCOMMON_PLAYSIM_XG_H
10 changes: 5 additions & 5 deletions doomsday/plugins/common/include/saveinfo.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @file common/saveinfo.h Save state info.
/** @file saveinfo.h Save state info.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
Expand All @@ -24,10 +24,6 @@
#include "doomsday.h"
#include "common.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct saveheader_s {
int magic;
int version;
Expand Down Expand Up @@ -58,6 +54,10 @@ typedef struct saveinfo_s {
saveheader_t header;
} SaveInfo;

#ifdef __cplusplus
extern "C" {
#endif

SaveInfo *SaveInfo_New(void);
SaveInfo *SaveInfo_NewCopy(SaveInfo const *other);

Expand Down
Loading

0 comments on commit 06b4c96

Please sign in to comment.