Skip to content

Commit

Permalink
Add function to identify briefing LFDs
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepandshepherd committed Sep 3, 2016
1 parent 8221f99 commit 4bebeaf
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions srcgob/archammer/arcgob.d
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,45 @@ class ArcGob : Savable
assert(writePos == size);
return raw.dup; /// FIXME: change the Savable API to allow for mallocated memory and @nogc
}

/// Returns whether this archive matches the spec for DFBRIEF.LFD
@property public
bool isDfbrief()
{
import std.algorithm.searching;
import std.uni : icmp;

bool ret = true;

/// files that must be present
static immutable string[4] matches =
[
"brf-jan.plt",
"cursor.dlt",
"guns.anm",
"items.anm"
];

bool[matches.length] found = false;

foreach(f; files[])
{
foreach(mi, m; matches[])
{
if(!found[mi] && icmp(m, f.name)==0) found[mi] = true;
}
}
foreach(bool f; found)
{
ret = ret && f;
}
/+foreach(m; matches[])
{
ret = ret && files[].canFind!(f => icmp(f.name, m)==0);
}+/

return ret;
}

private this()
{
Expand Down

0 comments on commit 4bebeaf

Please sign in to comment.