moved almost all hardcoded constants to "define.dat"
[k8-i-v-a-n.git] / src / game / id.cpp
blobfaa4bd23748116be249be0bc381d346e5222ece6
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #include "id.h"
13 #include "game.h"
14 #include "god.h"
15 #include "festring.h"
18 void id::AddNameSingular (festring &String, truth Articled) const {
19 if (Articled) {
20 if (UsesLongArticle()) String << "an "; else String << "a ";
22 String << GetNameSingular();
26 void id::AddName (festring &Name, int Case) const {
27 truth Articled;
28 if ((Case & ARTICLE_BIT) && (GetArticleMode() == FORCE_THE || (!GetArticleMode() && !(Case & INDEFINE_BIT)))) {
29 Name << "the ";
30 Articled = false;
31 } else {
32 Articled = !(Case & PLURAL) && (Case & ARTICLE_BIT) && (Case & INDEFINE_BIT) && GetArticleMode() != NO_ARTICLE;
34 if (!(Case & STRIPPED)) {
35 if (AddRustLevelDescription(Name, Articled)) Articled = false;
36 if (AddStateDescription(Name, Articled)) Articled = false;
38 if (AddAdjective(Name, Articled)) Articled = false;
39 if (!(Case & STRIPPED) && ShowMaterial() && AddMaterialDescription(Name, Articled)) Articled = false;
40 if (Case & PLURAL) Name << GetNamePlural(); else AddNameSingular(Name, Articled);
41 AddPostFix(Name, Case);
45 festring id::GetName (int Case) const {
46 static festring Name;
47 Name.Empty();
48 AddName(Name, Case);
49 return Name;
53 void id::AddName (festring &Name, int Case, int Amount) const {
54 if (Amount == 1) {
55 AddName(Name, Case&~PLURAL);
56 } else {
57 if ((Case & ARTICLE_BIT) && (GetArticleMode() == FORCE_THE || (!GetArticleMode() && !(Case & INDEFINE_BIT)))) Name << "the ";
58 Name << Amount << ' ';
59 AddName(Name, (Case&~ARTICLE_BIT)|PLURAL); //k8: ???
64 festring id::GetName (int Case, int Amount) const {
65 static festring Name;
66 Name.Empty();
67 AddName(Name, Case, Amount);
68 return Name;
72 truth id::AddAdjective (festring &String, truth Articled) const {
73 if (GetAdjective().GetSize()) {
74 if (Articled) {
75 if (UsesLongAdjectiveArticle()) String << "an "; else String << "a ";
77 String << GetAdjective() << ' ';
78 return true;
80 return false;
84 void id::AddPostFix (festring &String, int) const {
85 if (GetPostFix().GetSize()) String << ' ' << GetPostFix();
89 truth id::AddActiveAdjective (festring &String, truth Articled) const {
90 String << (Articled ? "an active " : "active ");
91 return true;