Crossfire Server, Trunk
FormulaeWriter.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2020 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include "FormulaeWriter.h"
14 #include "Utils.h"
15 
16 #define DO(v, s) { if (recipe->v) { stringbuffer_append_printf(buf, s "\n", recipe->v); } }
17 
18 static void writeRecipe(const recipe *recipe, StringBuffer *buf) {
19  if (!recipe) {
20  return;
21  }
22 
23  stringbuffer_append_printf(buf, "Object %s\n", recipe->title);
24  if (recipe->arch_names) {
28  }
29  DO(keycode, "keycode %s");
30  DO(transmute, "trans %d");
31  DO(yield, "yield %d");
32  DO(chance, "chance %d");
33  DO(exp, "exp %d");
34  DO(diff, "diff %d");
38  DO(skill, "skill %s");
39  DO(cauldron, "cauldron %s");
40  DO(failure_arch, "failure_arch %s");
41  DO(failure_message, "failure_message %s");
42  DO(min_level, "min_level %d");
43  DO(is_combination, "combination %d");
44  if (recipe->tool_size) {
48  }
50 }
51 
53  writeRecipe(list->items, buf);
54 }
recipe::tool_size
size_t tool_size
Definition: recipe.h:33
FormulaeWriter.h
recipe::arch_names
size_t arch_names
Definition: recipe.h:12
stringbuffer_append_printf
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Definition: stringbuffer.cpp:138
writeRecipe
static void writeRecipe(const recipe *recipe, StringBuffer *buf)
Definition: FormulaeWriter.cpp:18
guildoracle.list
list
Definition: guildoracle.py:87
recipe::arch_name
char ** arch_name
Definition: recipe.h:13
buf
StringBuffer * buf
Definition: readable.cpp:1565
recipelist
Definition: recipe.h:37
Utils.h
FormulaeWriter::write
virtual void write(const recipelist *list, StringBuffer *buf)
Definition: FormulaeWriter.cpp:52
DO
#define DO(v, s)
Definition: FormulaeWriter.cpp:16
stringbuffer_append_string
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Definition: stringbuffer.cpp:95
StringBuffer
Definition: stringbuffer.cpp:25
recipe
Definition: recipe.h:10
recipe::tool
char ** tool
Definition: recipe.h:32
recipe::ingred
linked_char * ingred
Definition: recipe.h:22
recipe::next
recipe * next
Definition: recipe.h:24
Utils::writeStringArray
static void writeStringArray(char **items, size_t count, StringBuffer *buf)
Definition: Utils.cpp:36
Utils::writeLinkedChar
static void writeLinkedChar(const linked_char *list, StringBuffer *buf)
Definition: Utils.cpp:22
recipe::title
sstring title
Definition: recipe.h:11