OSKILL.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Seven Kingdoms: Ancient Adversaries
  3. *
  4. * Copyright 1997,1998 Enlight Software Ltd.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. //Filename : OSKILL.CPP
  21. //Description : Skill class
  22. #include <OSTR.h>
  23. #include <OFIRMID.h>
  24. #include <OSITE.h>
  25. #include <OSKILL.h>
  26. //----------- define static vars -----------//
  27. char* Skill::skill_str_array[MAX_SKILL] =
  28. {
  29. "Construction",
  30. "Leadership",
  31. "Mining",
  32. "Manufacture",
  33. "Research",
  34. "Spying",
  35. "Praying",
  36. };
  37. char* Skill::skill_code_array[MAX_SKILL] =
  38. {
  39. "CONS",
  40. "LEAD",
  41. "MINE",
  42. "MANU",
  43. "RESE",
  44. "SPY",
  45. "PRAY",
  46. };
  47. char Skill::skilled_race_id_array[MAX_SKILL]; // the id. of the race that specialized in this skill.
  48. //-------- Begin of function Skill::Skill -------//
  49. Skill::Skill()
  50. {
  51. memset( this, 0, sizeof(Skill) );
  52. }
  53. //-------- End of function Skill::Skill -------//
  54. //-------- Begin of function Skill::skill_des -------//
  55. //
  56. // [int] shortWord - use short word (default:0)
  57. //
  58. char* Skill::skill_des(int shortWord)
  59. {
  60. if( skill_id==0 )
  61. return "";
  62. else
  63. return skill_str_array[skill_id-1];
  64. }
  65. //-------- End of function Skill::skill_des -------//
  66. //-------- Begin of function Skill::get_skill -------//
  67. //
  68. // Check if the this Skill structure has the
  69. // specific skill.
  70. //
  71. // <int> skillId - skill id.
  72. //
  73. int Skill::get_skill(int skillId)
  74. {
  75. if( skill_id==skillId )
  76. return skill_level;
  77. else
  78. return 0;
  79. }
  80. //-------- End of function Skill::get_skill -------//