author | ecalot
<ecalot> 2006-02-17 17:07:42 UTC |
committer | ecalot
<ecalot> 2006-02-17 17:07:42 UTC |
parent | 00ddc25a412812fa27535a19dfa9648e2cff145d |
PR/src/include/common.h | +1 | -0 |
PR/src/lib/actions/export.c | +3 | -3 |
PR/src/lib/object/object.c | +6 | -0 |
diff --git a/PR/src/include/common.h b/PR/src/include/common.h index 09107f7..7c1c859 100644 --- a/PR/src/include/common.h +++ b/PR/src/include/common.h @@ -84,6 +84,7 @@ common.h: Princed Resources : Defines and prototypes common to all PR code #define RES_FILE_TYPES {"autodetect","level","image","wave","midi","binary","palette","pcspeaker","text"} typedef enum { + eResTypeNone=-1, eResTypeRaw=0, eResTypeLevel=1, eResTypeImage=2, diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c index 6c1af00..b86c3ec 100644 --- a/PR/src/lib/actions/export.c +++ b/PR/src/lib/actions/export.c @@ -84,12 +84,12 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti /* Initialize abstract variables to read this new DAT file */ if ((ok=mReadBeginDatFile(&numberOfItems,vFiledat))) return ok; - ok=1; /* initialize palette buffer */ paletteBuffer=paletteListCreate(); /* initialize the default palette */ - /*currentPalette=objCreatePalette(); * TODO: add the default palette ad 0,"",0 */ + currentPalette=getObject(NULL,&ok); /* The null object will be used until a palette is set */ + ok=1; /* main loop */ for (indexNumber=0;ok&&(indexNumber<numberOfItems);indexNumber++) { @@ -119,7 +119,7 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti } break; case eResTypeImage: /* save image */ /* Palette handling */ - if (resourceListCompareId(res.paletteId,bufferedPalette)) { /* The palette isn't in the buffer */ + if (resourceListCompareId(res.paletteId,bufferedPalette) /*TODO: add &&!paletteCheckCompatibility(currentPalette,image) */) { /* The palette isn't in the buffer */ tResource otherPalette; otherPalette.id=res.paletteId; /* Read the palette and load it into memory */ diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c index 00775d7..cf75ae6 100644 --- a/PR/src/lib/object/object.c +++ b/PR/src/lib/object/object.c @@ -32,6 +32,7 @@ main.c: Princed Resources : Main item class implementation #include "object.h" #include "reslist.h" +#include "common.h" #include "other.h" #include "image.h" @@ -39,6 +40,11 @@ main.c: Princed Resources : Main item class implementation tObject getObject(tResource* r, int* error) { tObject o; + if (!r) { + *error=PR_RESULT_SUCCESS; + o.type=eResTypeNone; + o.obj=NULL; + } o.type=r->type; switch (o.type) {