diff options
| author | Alexander Gavrilov | 2012-01-08 20:02:12 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-01-08 20:02:12 +0400 |
| commit | ea790f1346a3dff8df6331dc84a16a7915bca4fd (patch) | |
| tree | 6b31f4f4df7061c75af9a2d7610d10105841382a /library/DataDefs.cpp | |
| parent | 64a9a49ec0393a903403b728fe41758ab774ebf8 (diff) | |
| download | dfhack-ea790f1346a3dff8df6331dc84a16a7915bca4fd.tar.gz dfhack-ea790f1346a3dff8df6331dc84a16a7915bca4fd.tar.bz2 dfhack-ea790f1346a3dff8df6331dc84a16a7915bca4fd.tar.xz | |
Move a few functions into the core, and add some more.
Diffstat (limited to 'library/DataDefs.cpp')
| -rw-r--r-- | library/DataDefs.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/library/DataDefs.cpp b/library/DataDefs.cpp index 6c40ec81..cd8a8ed7 100644 --- a/library/DataDefs.cpp +++ b/library/DataDefs.cpp @@ -197,6 +197,16 @@ std::string DFHack::bitfieldToString(const void *p, int size, const bitfield_ite return res; } +int DFHack::findBitfieldField(const std::string &name, int size, const bitfield_item_info *items) +{ + for (int i = 0; i < size*8; i++) { + if (items[i].name && items[i].name == name) + return i; + } + + return -1; +} + #define SIMPLE_GLOBAL(name,tname) \ tname *df::global::name = NULL; #define GLOBAL(name,tname) SIMPLE_GLOBAL(name,df::tname) |
