Steam Fort 0.5

src/parser.hpp

Go to the documentation of this file.
00001 /*********************************************************************
00002  * Copyright 2011 Bartek thindil Jasicki
00003  *
00004  *  This file is part of Steam Fort.
00005  *
00006  *  Steam Fort is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * Steam Fort is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with Steam Fort.  If not, see <http://www.gnu.org/licenses/>.
00018 *********************************************************************/
00019 #ifndef PARSER_HPP
00020 #define PARSER_HPP
00021 #include <string>
00022 
00023 struct ProtoItem
00024 {
00025   std::string name;
00026   TCODList<void *> types;
00027   char ch;
00028   TCODColor color;
00029   bool walkable;
00030   bool transparent;
00031   bool hidden;
00032   std::string description;
00033   int data;
00034   std::string damage;
00035   int range;
00036 };
00037 
00038 struct ProtoMob
00039 {
00040   std::string name;
00041   int type;
00042   char ch;
00043   TCODColor color;
00044   TCODList<void *> stats;
00045   std::string description;
00046   TCODList<void *> equip;
00047   TCODList<void *> ais;
00048   TCODList<void *> inv;
00049   int location;
00050   TCODList<void *>loot;
00051   bool flying;
00052   TCODList<void *>spells;
00053 };
00054 
00055 struct ProtoBuild
00056 {
00057   std::string name;
00058   int type;
00059   int width;
00060   int height;
00061   int enter[2];
00062   std::string mname;
00063   int material;
00064   int mamount;
00065   int buildtime;
00066   std::string workname;
00067   int data;
00068   TCODList<void *> chars;
00069   TCODList<void *> colors;
00070   TCODList<void *> neededitems;
00071   bool unique;
00072   std::string description;
00073 };
00074 
00075 struct ProtoOrder
00076 {
00077   std::string name;
00078   bool infinite;
00079   bool automatic;
00080   bool enabled;
00081   TCODList<void *> step1;
00082   TCODList<void *> step2;
00083   TCODList<void *> step3;
00084   TCODList<void *> step4;
00085   TCODList<void *> step5;
00086   bool playeronly;
00087   int type;
00088 };
00089 
00090 struct ProtoRecipe
00091 {
00092   std::string name;
00093   TCODList<void *> resource1;
00094   TCODList<void *> resource2;
00095   TCODList<void *> resource3;
00096   TCODList<void *> resource4;
00097   int fuel;
00098   int amount;
00099   int worktime;
00100   int building;
00101   bool known;
00102   int unlocktype[2];
00103   std::string unlockname;
00104   std::string materials;
00105 };
00106 
00107 struct ProtoMission
00108 {
00109   std::string name;
00110   int location;
00111   int difficult;
00112   int length;
00113   int targettype;
00114   std::string target;
00115   std::string description;
00116 };
00117 
00118 struct ProtoHelp
00119 {
00120   std::string name;
00121   std::string body;
00122   TCODList<void *> options;
00123   std::string parent;
00124 };
00125 
00126 struct ProtoSpell
00127 {
00128   std::string name;
00129   int type;
00130   int target;
00131   std::string dice;
00132   int effect;
00133   int cost;
00134   int memory;
00135   int range;
00136 };
00137 
00138 class Listener : public ITCODParserListener 
00139 {
00140   int type;
00141   ProtoItem item;
00142   ProtoMob mob;
00143   ProtoBuild build;
00144   ProtoOrder order;
00145   ProtoRecipe recipe;
00146   ProtoMission mission;
00147   ProtoHelp help2;
00148   ProtoSpell spell;
00149 
00150   bool parserNewStruct(TCODParser *parser, const TCODParserStruct *str, const char *name);
00151   bool parserFlag(TCODParser *parser, const char *name);
00152   bool parserProperty(TCODParser *parser, const char *name, TCOD_value_type_t type, TCOD_value_t value);
00153   bool parserEndStruct(TCODParser *parser, const TCODParserStruct *str, const char *name);
00154   void error(const char *msg);
00155 };
00156 
00157 void loadproto();
00158 void loadorders();
00159 
00160 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines