Crossfire Server, Trunk  R20513
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 (strcmp(myFormulae->title, "NONE") == 0)
22  {
23  return base->clone.name;
24  }
25 
26  return QString("%1 of %2").arg(base->clone.name, myFormulae->title);
27 }
28 
29 QString CREWrapperFormulae::title() const
30 {
31  return myFormulae->title;
32 }
33 
35 {
36  return myFormulae->chance;
37 }
38 
40 {
41  return myFormulae->diff;
42 }
43 
45 {
46  return myFormulae->exp;
47 }
48 
49 QStringList CREWrapperFormulae::archs() const
50 {
51  QStringList archs;
52  for (size_t i = 0; i < myFormulae->arch_names; i++)
53  {
54  archs.append(myFormulae->arch_name[i]);
55  }
56  return archs;
57 }
58 
59 QStringList CREWrapperFormulae::ingredients() const
60 {
61  QStringList ingredients;
62  for (linked_char* ing = myFormulae->ingred; ing; ing = ing->next)
63  {
64  ingredients.append(ing->name);
65  }
66  return ingredients;
67 }
archetype * find_archetype(const char *name)
Finds, using the hashtable, which archetype matches the given name.
Definition: arch.c:695
int diff
Alchemical dfficulty level.
Definition: recipe.h:16
int chance() const
object clone
An object from which to do object_copy()
Definition: object.h:470
linked_char * ingred
List of ingredients.
Definition: recipe.h:22
QString fullname() const
int experience() const
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
Definition: object.h:465
int chance
Chance that recipe for this item will appear in an alchemical grimore.
Definition: recipe.h:14
sstring title
Distinguishing name of product.
Definition: recipe.h:11
char ** arch_name
Possible archetypes of the final product made.
Definition: recipe.h:13
QString title() const
struct linked_char * next
Definition: global.h:88
const char * name
The name of the object, obviously...
Definition: object.h:311
const recipe * myFormulae
QStringList ingredients() const
void setFormulae(const recipe *rec)
int exp
How much exp to give for this formulae.
Definition: recipe.h:17
size_t arch_names
Size of the arch_name[] array.
Definition: recipe.h:12
QStringList archs() const
int difficulty() const
One alchemy recipe.
Definition: recipe.h:10