Commit c4ef54c7 by Matt Mascarenhas

cinera.c: Fix template validity checking

parent 9d0cdfb4
......@@ -17,7 +17,7 @@ typedef struct
version CINERA_APP_VERSION = {
.Major = 0,
.Minor = 6,
.Patch = 2
.Patch = 3
};
#include <stdarg.h> // NOTE(matt): varargs
......@@ -3935,7 +3935,7 @@ RecordTag:
return RC_INVALID_TEMPLATE;
}
if(FoundSearch)
if(!HaveErrors && FoundIncludes && FoundSearch)
{
Template->Metadata.Validity |= PAGE_SEARCH;
}
......@@ -3949,7 +3949,8 @@ RecordTag:
{
if(Type == TEMPLATE_SEARCH && !(Template->Metadata.Validity & PAGE_SEARCH))
{
CopyStringToBuffer(&Errors, "Search template %s must include one <!-- __CINERA_SEARCH__ --> tag\n", Template->File.Path);
if(!FoundIncludes) { CopyStringToBuffer(&Errors, "%sSearch template%s must include one <!-- __CINERA_INCLUDES__ --> tag\n", ColourStrings[CS_ERROR], ColourStrings[CS_END]); };
if(!FoundSearch) { CopyStringToBuffer(&Errors, "%sSearch template%s must include one <!-- __CINERA_SEARCH__ --> tag\n", ColourStrings[CS_ERROR], ColourStrings[CS_END]); };
fprintf(stderr, "%s", Errors.Location);
DeclaimBuffer(&Errors);
FreeTemplate(Template);
......@@ -3957,10 +3958,10 @@ RecordTag:
}
else if((Type == TEMPLATE_PLAYER || Type == TEMPLATE_BESPOKE) && !(Template->Metadata.Validity & PAGE_PLAYER))
{
if(!FoundIncludes){ CopyStringToBuffer(&Errors, "Player template %s must include one <!-- __CINERA_INCLUDES__ --> tag\n", Template->File.Path); };
if(!FoundMenus){ CopyStringToBuffer(&Errors, "Player template %s must include one <!-- __CINERA_MENUS__ --> tag\n", Template->File.Path); };
if(!FoundPlayer){ CopyStringToBuffer(&Errors, "Player template %s must include one <!-- __CINERA_PLAYER__ --> tag\n", Template->File.Path); };
if(!FoundScript){ CopyStringToBuffer(&Errors, "Player template %s must include one <!-- __CINERA_SCRIPT__ --> tag\n", Template->File.Path); };
if(!FoundIncludes){ CopyStringToBuffer(&Errors, "%s%slayer template%s must include one <!-- __CINERA_INCLUDES__ --> tag\n", ColourStrings[CS_ERROR], Type == TEMPLATE_BESPOKE ? "Bespoke p" : "P", ColourStrings[CS_END]); };
if(!FoundMenus){ CopyStringToBuffer(&Errors, "%s%slayer template%s must include one <!-- __CINERA_MENUS__ --> tag\n", ColourStrings[CS_ERROR], Type == TEMPLATE_BESPOKE ? "Bespoke p" : "P", ColourStrings[CS_END]); };
if(!FoundPlayer){ CopyStringToBuffer(&Errors, "%s%slayer template%s must include one <!-- __CINERA_PLAYER__ --> tag\n", ColourStrings[CS_ERROR], Type == TEMPLATE_BESPOKE ? "Bespoke p" : "P", ColourStrings[CS_END]); };
if(!FoundScript){ CopyStringToBuffer(&Errors, "%s%slayer template%s must include one <!-- __CINERA_SCRIPT__ --> tag\n", ColourStrings[CS_ERROR], Type == TEMPLATE_BESPOKE ? "Bespoke p" : "P", ColourStrings[CS_END]); };
fprintf(stderr, "%s", Errors.Location);
DeclaimBuffer(&Errors);
FreeTemplate(Template);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment