CGeneralTextHandler.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #pragma once
  2. /*
  3. * CGeneralTextHandler.h, part of VCMI engine
  4. *
  5. * Authors: listed in file AUTHORS in main folder
  6. *
  7. * License: GNU General Public License v2.0 or later
  8. * Full text of license available in license.txt file, in main folder
  9. *
  10. */
  11. class CInputStream;
  12. /// Parser for any text files from H3
  13. class CLegacyConfigParser
  14. {
  15. std::unique_ptr<char[]> data;
  16. char * curr;
  17. char * end;
  18. void init(const std::unique_ptr<CInputStream> & input);
  19. /// extracts part of quoted string.
  20. std::string extractQuotedPart();
  21. /// extracts quoted string. Any end of lines are ignored, double-quote is considered as "escaping"
  22. std::string extractQuotedString();
  23. /// extracts non-quoted string
  24. std::string extractNormalString();
  25. public:
  26. /// read one entry from current line. Return ""/0 if end of line reached
  27. std::string readString();
  28. float readNumber();
  29. /// returns true if next entry is empty
  30. bool isNextEntryEmpty();
  31. /// end current line
  32. bool endLine();
  33. CLegacyConfigParser(std::string URI);
  34. CLegacyConfigParser(const std::unique_ptr<CInputStream> & input);
  35. };
  36. class DLL_LINKAGE CGeneralTextHandler //Handles general texts
  37. {
  38. public:
  39. class HeroTexts
  40. {
  41. public:
  42. std::string bonusName, shortBonus, longBonus; //for special abilities
  43. std::string biography; //biography, of course
  44. };
  45. std::vector<HeroTexts> hTxts;
  46. std::vector<std::string> allTexts;
  47. std::vector<std::string> arraytxt;
  48. std::vector<std::string> primarySkillNames;
  49. std::vector<std::string> jktexts;
  50. std::vector<std::string> heroscrn;
  51. std::vector<std::string> overview;//text for Kingdom Overview window
  52. std::vector<std::string> colors; //names of player colors ("red",...)
  53. std::vector<std::string> capColors; //names of player colors with first letter capitalized ("Red",...)
  54. std::vector<std::string> turnDurations; //turn durations for pregame (1 Minute ... Unlimited)
  55. //artifacts
  56. std::vector<std::string> artifEvents;
  57. std::vector<std::string> artifNames;
  58. std::vector<std::string> artifDescriptions;
  59. //towns
  60. std::vector<std::string> tcommands, hcommands, fcommands; //texts for town screen, town hall screen and fort screen
  61. std::vector<std::string> tavernInfo;
  62. std::vector<std::pair<std::string,std::string> > zelp;
  63. std::vector<std::string> lossCondtions;
  64. std::vector<std::string> victoryConditions;
  65. //objects
  66. std::vector<std::string> names; //vector of objects; i-th object in vector has subnumber i
  67. std::vector<std::string> creGens; //names of creatures' generators
  68. std::vector<std::string> creGens4; //names of multiple creatures' generators
  69. std::vector<std::string> advobtxt;
  70. std::vector<std::string> xtrainfo;
  71. std::vector<std::string> restypes; //names of resources
  72. std::vector<std::string> terrainNames;
  73. std::vector<std::string> randsign;
  74. std::vector<std::pair<std::string,std::string> > mines; //first - name; second - event description
  75. std::vector<std::string> seerEmpty;
  76. std::vector <std::vector <std::vector <std::string> > > quests; //[quest][type][index]
  77. //type: quest, progress, complete, rollover, log OR time limit //index: 0-2 seer hut, 3-5 border guard
  78. std::vector<std::string> seerNames;
  79. std::vector<std::string> tentColors;
  80. std::vector<std::string> threat; //power rating for neutral stacks
  81. //sec skills
  82. std::vector <std::string> skillName;
  83. std::vector <std::vector <std::string> > skillInfoTexts; //[id][level] : level 0 - basic; 2 - advanced
  84. std::vector<std::string> levels;
  85. std::vector<std::string> zcrexp; //more or less useful content of that file
  86. //campaigns
  87. std::vector <std::string> campaignMapNames;
  88. std::vector < std::vector <std::string> > campaignRegionNames;
  89. std::string getTitle(const std::string & text);
  90. std::string getDescr(const std::string & text);
  91. void load();
  92. CGeneralTextHandler();
  93. };