fixed visual studio project
[laserbrain_demo] / src / exman.cc
1 #include "exman.h"
2 #include "exhibit.h"
3 #include "blob_exhibit.h"
4 #include "treestore.h"
5
6 static Exhibit *create_exhibit(const char *type);
7
8 ExhibitManager::ExhibitManager()
9 {
10 }
11
12 ExhibitManager::~ExhibitManager()
13 {
14         int num = (int)items.size();
15         for(int i=0; i<num; i++) {
16                 delete items[i];
17         }
18         items.clear();
19 }
20
21 bool ExhibitManager::load(const MetaScene *mscn, const char *fname)
22 {
23         struct ts_node *root = ts_load(fname);
24         if(!root || strcmp(root->name, "exhibits") != 0) {
25                 ts_free_tree(root);
26                 error_log("failed to load exhibits\n");
27                 return false;
28         }
29
30         ts_free_tree(root);
31         return true;
32 }
33
34
35 static Exhibit *create_exhibit(const char *type)
36 {
37         if(strcmp(type, "static") == 0) {
38                 return new Exhibit;
39         } else if(strcmp(type, "blobs") == 0) {
40                 return new BlobExhibit;
41         }
42         return 0;
43 }