 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
25 char *
buf, *cp, *next;
31 memset(&dummy_archetype, 0,
sizeof(
archetype));
42 if (!strncmp(cp,
"Allowed", 7)) {
48 cp = strchr(cp,
' ')+1;
49 while (*(cp+strlen(cp)-1) ==
' ')
50 cp[strlen(cp)-1] =
'\0';
52 if (!strcmp(cp,
"all"))
59 if ((next = strchr(cp,
',')) != NULL)
62 }
while ((cp = next) != NULL);
63 }
else if (sscanf(cp,
"chance %d", &value) && art)
64 art->
chance = (uint16_t)value;
65 else if (sscanf(cp,
"difficulty %d", &value) && art)
67 else if (!strncmp(cp,
"Object", 6) && art) {
68 art->
item = (
object *)calloc(1,
sizeof(
object));
69 if (art->
item == NULL) {
70 LOG(
llevError,
"init_artifacts: memory allocation failure.\n");
76 LOG(
llevError,
"Init_Artifacts: Could not load object.\n");
86 al->
items.push_back(art);
97 for (
auto art : al->
items) {
virtual bool willLoad(const std::string &filename) override
Whether this instance will process or not the specified file.
virtual void load(BufferReader *reader, const std::string &filename) override
Load assets from the specified reader.
long nrofartifacts
Only used in malloc_info().
size_t bufferreader_current_line(BufferReader *br)
Return the index of the last line returned by bufferreader_next_line().
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
struct archetype * arch
Pointer to archetype.
std::vector< artifact * > items
Artifacts for this type.
artifactlist * get_empty_artifactlist(void)
Allocate and return the pointer to an empty artifactlist structure.
object * item
Special values of the artifact.
void object_reset(object *op)
Totally resets the specified object, without freeing associated memory.
artifactlist * next
Next list of artifacts.
std::vector< sstring > allowed
List of archetypes the artifact can affect.
#define MAP_STYLE
Active objects shouldn't be put on active list.
long nrofallowedstr
Only used in malloc_info().
sstring add_string(const char *str)
This will add 'str' to the hash table.
virtual void assetDefined(const archetype *asset, const std::string &filename)
Function called when an asset is defined in a file.
uint8_t type
PLAYER, BULLET, etc.
This represents all archetypes for one particular object type.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
sstring name
The name of the object, obviously...
uint16_t chance
Chance of the artifact to happen.
uint16_t total_chance
Sum of chance for are artifacts on this list.
artifactlist * first_artifactlist
First artifact.
uint8_t difficulty
Minimum map difficulty for the artifact to happen.
This is one artifact, ie one special item.
artifact * get_empty_artifact(void)
Allocate and return the pointer to an empty artifact structure.
artifactlist * find_artifactlist(int type)
Finds the artifact list for a certain item type.
uint8_t type
Object type that this list represents.
static bool endsWith(const char *const str, const char *const with)
Checks if a string ends with another one.
@ llevDebug
Only for debugging purposes.
AssetsTracker * myTracker
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.
int load_object_from_reader(BufferReader *reader, object *op, int map_flags, bool arch_init, bool artifact_init)
Load an object from the specified reader, stopping when the object is complete.