X-Git-Url: https://git.jsancho.org/?p=dungeon-master.git;a=blobdiff_plain;f=src%2Fgenerators.cpp;fp=src%2Fgenerators.cpp;h=b82377b823a972efb8a7358e3e0fa4ecb5b9dc25;hp=0000000000000000000000000000000000000000;hb=4fce641cc077d18f972e250d2fe3be5067618127;hpb=feed3accdc0482b11535c72119ea73f627f633ed diff --git a/src/generators.cpp b/src/generators.cpp new file mode 100644 index 0000000..b82377b --- /dev/null +++ b/src/generators.cpp @@ -0,0 +1,48 @@ +/* Dungeon Master --- RPG Adventure Generator + Copyright © 2019 Javier Sancho + + Dungeon Master is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Dungeon Master is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Dungeon Master. If not, see . +*/ + +#include +#include +#include +#include "generators.h" + +struct compare_strings +{ + bool operator() (const char* a, const char* b) const + { + return strcmp (a, b) < 0; + } +}; + +std::map, + compare_strings> registered_generators; + +SceneGenerator* +register_generator (char* name, + char* type, + SCM proc) +{ + SceneGenerator* generator = (SceneGenerator*) malloc (sizeof (SceneGenerator)); + generator->name = name; + generator->type = type; + generator->proc = proc; + + registered_generators[type].push_back (generator); + + return generator; +}