Crossfire Server, Trunk  R21219
CREWrapperFormulae.cpp
Go to the documentation of this file.
1 #include "CREWrapperFormulae.h"
2 
4 {
5  myFormulae = NULL;
6 }
7 
9 {
10  myFormulae = rec;
11 }
12 
13 QString CREWrapperFormulae::fullname() const
14 {
15  if (myFormulae->arch_names == 0)
16  {
17  return QString("%1 (no archetype?)").arg(myFormulae->title);
18  }
19 
20  const archetype* base = find_archetype(myFormulae->arch_name[0]);
21  if (!base)
22  {
23  return QString("%1 (no archetype?)").arg(myFormulae->title);
24  }
25  if (strcmp(myFormulae->title, "NONE") == 0)
26  {
27  return base->clone.name;
28  }
29 
30  return QString("%1 of %2").arg(base->clone.name, myFormulae->title);
31 }
32 
33 QString CREWrapperFormulae::title() const
34 {
35  return myFormulae->title;
36 }
37 
39 {
40  return myFormulae->chance;
41 }
42 
44 {
45  return myFormulae->diff;
46 }
47 
49 {
50  return myFormulae->exp;
51 }
52 
53 QStringList CREWrapperFormulae::archs() const
54 {
55  QStringList archs;
56  for (size_t i = 0; i < myFormulae->arch_names; i++)
57  {
58  archs.append(myFormulae->arch_name[i]);
59  }
60  return archs;
61 }
62 
63 QStringList CREWrapperFormulae::ingredients() const
64 {
65  QStringList ingredients;
66  for (linked_char* ing = myFormulae->ingred; ing; ing = ing->next)
67  {
68  ingredients.append(ing->name);
69  }
70  return ingredients;
71 }
archetype * find_archetype(const char *name)
Definition: arch.c:695
int diff
Definition: recipe.h:16
QString title() const
object clone
Definition: object.h:470
linked_char * ingred
Definition: recipe.h:22
Definition: object.h:465
int chance() const
int chance
Definition: recipe.h:14
sstring title
Definition: recipe.h:11
char ** arch_name
Definition: recipe.h:13
struct linked_char * next
Definition: global.h:88
const char * name
Definition: object.h:311
const recipe * myFormulae
QStringList archs() const
void setFormulae(const recipe *rec)
QStringList ingredients() const
int exp
Definition: recipe.h:17
size_t arch_names
Definition: recipe.h:12
int difficulty() const
QString fullname() const
int experience() const