Crossfire Server, Trunk  1.75.0
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
Length of tool.
Definition: recipe.h:33
FormulaeWriter.h
recipe::arch_names
size_t arch_names
Size of the arch_name[] array.
Definition: recipe.h:12
stringbuffer_append_printf
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
Definition: stringbuffer.cpp:138
writeRecipe
static void writeRecipe(const recipe *recipe, StringBuffer *buf)
Definition: FormulaeWriter.cpp:18
recipe::arch_name
char ** arch_name
Possible archetypes of the final product made.
Definition: recipe.h:13
buf
StringBuffer * buf
Definition: readable.cpp:1565
recipelist
List of recipes with a certain number of ingredients.
Definition: recipe.h:37
Utils.h
FormulaeWriter::write
virtual void write(const recipelist *list, StringBuffer *buf)
Write the specified asset to the StringBuffer.
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)
Append a string to a string buffer instance.
Definition: stringbuffer.cpp:95
StringBuffer
A buffer that will be expanded as content is added to it.
Definition: stringbuffer.cpp:25
recipe
One alchemy recipe.
Definition: recipe.h:10
recipe::tool
char ** tool
Tool(s) for item transformation.
Definition: recipe.h:32
skill
skill
Definition: arch-handbook.txt:585
recipe::ingred
linked_char * ingred
List of ingredients.
Definition: recipe.h:22
recipe::next
recipe * next
Next recipe with the same number of ingredients.
Definition: recipe.h:24
chance
bool chance(int a, int b)
Return true with a probability of a/b.
Definition: treasure.cpp:866
list
How to Install a Crossfire Server on you must install a python script engine on your computer Python is the default script engine of Crossfire You can find the python engine you have only to install them The VisualC Crossfire settings are for but you habe then to change the pathes in the VC settings Go in Settings C and Settings Link and change the optional include and libs path to the new python installation path o except the maps ! You must download a map package and install them the share folder Its must look like doubleclick on crossfire32 dsw There are projects in your libcross lib and plugin_python You need to compile all Easiest way is to select the plugin_python ReleaseLog as active this will compile all others too Then in Visual C press< F7 > to compile If you don t have an appropriate compiler you can try to get the the VC copies the crossfire32 exe in the crossfire folder and the plugin_python dll in the crossfire share plugins folder we will remove it when we get time for it o Last showing lots of weird write to the Crossfire mailing list
Definition: INSTALL_WIN32.txt:50
Utils::writeStringArray
static void writeStringArray(char **items, size_t count, StringBuffer *buf)
Write a list of strings as ' a,b,c' (leading space).
Definition: Utils.cpp:36
Utils::writeLinkedChar
static void writeLinkedChar(const linked_char *list, StringBuffer *buf)
Write a list of strings as ' a,b,c' (leading space).
Definition: Utils.cpp:22
recipe::title
sstring title
Distinguishing name of product.
Definition: recipe.h:11