 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
186 #include <sys/stat.h>
187 #include <sys/types.h>
339 for (test = 0; test <
list->count; test++) {
340 if (
list->races[test] == race)
345 if (
list->allocated ==
list->count) {
346 list->allocated += 50;
362 static int sizes[] = {32, 16, 8, 4, 2};
364 #define size_large sizes[0]
365 #define size_small sizes[1]
439 #define S_CONTAINER 2
536 [&] (
const auto *e) { return !sort_equipment(e, item) && !sort_equipment(item, e); });
610 if (add->
diff == NULL || strcmp(add->
diff,
"") == 0) {
715 const char *roads[] = {
721 const char *partial[] = {
725 for (test = 0; partial[test] != NULL; test++) {
726 if (strstr(item->
arch->
name, partial[test]) != NULL)
733 for (test = 0; roads[test] != NULL; test++) {
734 if (strcmp(item->
arch->
name, roads[test]) == 0)
765 else if (elevation == 0)
766 return gdImageColorResolve(elevationmap, 0, 0, 0);
768 return gdImageColorResolve(elevationmap, 0, 0, 200-200*elevation/
elevation_min);
783 if (sscanf(map->
path,
"/world/world_%d_%d", &x, &y) != 2)
789 for (tx = 0; tx <
MAP_WIDTH(map); tx++) {
796 int elevation = item->elevation;
797 if (elevation != 0) {
842 fslash = strchr(from+1,
'/');
844 strcpy(result,
to+1);
848 rslash = strchr(
to+1,
'/');
849 while (fslash && rslash && (fslash-from == rslash-
to) && strncmp(from,
to, fslash-from+1) == 0) {
852 fslash = strchr(fslash+1,
'/');
853 rslash = strchr(rslash+1,
'/');
857 strcat(result,
"../");
858 fslash = strchr(fslash+1,
'/');
860 if (strlen(result) && result[strlen(result)-1] ==
'/' && *
to ==
'/')
861 result[strlen(result)-1] =
'\0';
958 if (
list->count ==
list->allocated) {
959 list->allocated += 10;
1086 printf(
"warning, multiple quest definition for %s, found in %s and %s.\n", quest->
name, quest->
mainmap ? quest->
mainmap->
path :
"(unknown map)", mainmap->
path);
1102 char *start, *end, *next;
1106 start = strstr(map->
lore,
"@def");
1110 end = strstr(start,
"\n");
1112 strncpy(
name, start+5, end-start-5);
1113 name[end-start-5] =
'\0';
1115 end = strstr(next,
"@end");
1120 memmove(start, end+4, strlen(map->
lore)-(end-start+3));
1129 strcpy(
name, start);
1135 start = end ? strstr(end,
"@def") : NULL;
1138 start = strstr(map->
lore,
"@quest");
1142 end = strstr(start,
"\n");
1144 strncpy(
name, start+7, end-start-7);
1145 name[end-start-7] =
'\0';
1147 end = strstr(next,
"@end");
1152 memmove(start, end+4, strlen(map->
lore)-(end-start+3));
1161 strcpy(
name, start);
1167 start = end ? strstr(end,
"@quest") : NULL;
1189 info->
name = strdup(npc->
name ? npc->
name :
"(null name)");
1223 for (map = 0; map <
list->count; map++)
1224 if (
list->maps[map] == info)
1227 if (
list->count ==
list->allocated) {
1228 list->allocated += 50;
1300 printf(
"tiled_map not in tiled_map_list!");
1323 add->
path = strdup(path);
1324 tmp = strrchr((
char *)path,
'/');
1342 if (strcmp(path, *map) == 0) {
1348 printf(
"Map processed but not found in directory reading? %s\n", path);
1366 if (
regions[test]->reg == reg)
1379 if (sscanf(map->
path,
"/world/world_%d_%d", &x, &y) == 2) {
1397 gdImagePng(pic, file);
1452 add->
slaying = strdup(slaying);
1453 for (
size_t l = 0; l <
S_MAX; l++)
1529 FILE *out = fopen(picpath,
"wb+");
1533 for (
size_t i = 1; i <
num_sizes; i++) {
1535 gdImagePtr small = gdImageCreateTrueColor(width*
sizes[i], height*
sizes[i]);
1537 out = fopen(picpath,
"wb+");
1540 gdImageDestroy(small);
1555 gdImagePtr pic =
nullptr;
1557 struct stat statspic;
1558 char exit_path[500];
1568 printf(
" processing map %s\n", info->
path);
1572 printf(
"couldn't load map %s\n", info->
path);
1581 info->
level =
m->difficulty;
1583 info->
lore = strdup(
m->maplore);
1586 if (
m->reset_group) {
1591 isworld = (sscanf(info->
path,
"/world/world_%d_%d", &x, &y) == 2);
1594 info->
name = strdup(
m->name);
1609 stat(tmppath, &
stats);
1610 if (stat(picpath[0], &statspic) || (statspic.st_mtime <
stats.st_mtime))
1623 for (x = 0; x < 4; x++)
1624 if (
m->tile_path[x] != NULL) {
1627 if (stat(tmppath, &
stats)) {
1628 printf(
" map %s doesn't exist in map %s, for tile %d.\n", exit_path, info->
path, x);
1639 if (link && link !=
m) {
1650 info->
tiles[x] = link;
1684 if (!item->slaying) {
1687 printf(
" exit without any path at %d, %d on %s\n", item->x, item->y, info->
path);
1690 if (strcmp(item->slaying,
"/!"))
1694 printf(
" random map without message in %s at %d, %d\n", info->
path, item->x, item->y);
1697 start = strstr(item->msg,
"\nfinal_map ");
1698 if (!start && strncmp(item->msg,
"final_map", strlen(
"final_map")) == 0)
1702 char *end = strchr((
char *)start+1,
'\n');
1704 start += strlen(
"final_map")+2;
1705 strncpy(ep, start, end-start);
1713 if (stat(tmppath, &
stats)) {
1714 printf(
" map %s doesn't exist in map %s, at %d, %d.\n", ep, info->
path, item->x, item->y);
1723 if (link && link !=
m) {
1749 }
else if ((item->type ==
SIGN || item->type ==
BOOK) && (item->msg != item->arch->clone.msg) && (item->msg != NULL)) {
1753 if (item->invisible)
1759 if (
gdfaces.size() <= item->face->number)
1760 gdfaces.resize(item->face->number + 1,
nullptr);
1762 if (
gdfaces[item->face->number] == NULL) {
1768 if (item->head || item->more) {
1774 if (
gdfaces[item->face->number] != NULL && ((!item->head && !item->more) || (item->arch->clone.x+hx == 0 && item->arch->clone.y+hy == 0))) {
1783 gdImageDestroy(pic);
1801 char mapleft[10], maptop[10], mapright[10], mapbottom[10], mappath[5000];
1811 printf(
"Generating world map in world.html...");
1814 pic = gdImageCreateTrueColor(
SIZE*30,
SIZE*30);
1817 strcat(file,
"/world.html");
1822 for (y = 0; y < 30; y++) {
1823 for (x = 0; x < 30; x++) {
1824 snprintf(
name,
sizeof(
name),
"world_%d_%d", wx, wy);
1825 snprintf(mapleft,
sizeof(mapleft),
"%d",
SIZE*x);
1826 snprintf(maptop,
sizeof(maptop),
"%d",
SIZE*y);
1827 snprintf(mapright,
sizeof(mapright),
"%d",
SIZE*(x+1)-1);
1828 snprintf(mapbottom,
sizeof(mapbottom),
"%d",
SIZE*(y+1)-1);
1832 out = fopen(mappath,
"rb");
1834 printf(
"\n warning: large pic not found for world_%d_%d", wx, wy);
1839 small = gdImageCreateFromPng(out);
1841 small = gdImageCreateFromJpeg(out);
1844 printf(
"\n warning: pic not found for world_%d_%d", wx, wy);
1848 gdImageCopyResized(pic, small,
SIZE*x,
SIZE*y, 0, 0,
SIZE,
SIZE, small->sx, small->sy);
1849 gdImageDestroy(small);
1858 out = fopen(mappath,
"wb+");
1863 small = gdImageCreateTrueColor(
SIZE*30,
SIZE*30);
1864 font = gdFontGetGiant();
1865 color = gdImageColorAllocateAlpha(pic, 255, 0, 0, 20);
1872 gdImageString(small, font, x, y, (
unsigned char *)
regions[
region]->reg->name, color);
1873 gdImageString(pic, font, x, y, (
unsigned char *)
regions[
region]->reg->name, color);
1882 out = fopen(mappath,
"wb+");
1885 gdImageDestroy(small);
1888 out = fopen(mappath,
"wb+");
1891 gdImageDestroy(pic);
1903 printf(
"map without path!\n");
1924 printf(
"empty tiled map group!");
1928 snprintf(
name,
sizeof(
name),
"tiled_map_group_%zu", map);
1942 printf(
"*** warning: tiled maps %s and %s not in same region (%s and %s).\n",
1965 slash = strrchr(
name,
'/');
1989 max = from->
count-1;
1990 for (map = max; map >= 0; map--) {
2008 for (map = 0;
static_cast<size_t>(map) <
maps_list.
count; map++) {
2015 for (map = max; map >= 0; map--) {
2036 for (
size_t race = 0; race <
races.
count; race++) {
2038 for (map = max; map >= 0; map--) {
2050 for (map = 0;
static_cast<size_t>(map) <
maps_list.
count; map++) {
2064 for (
size_t size = 0; size <
num_sizes; size++) {
2066 if (stat(picpath, &
stats))
2090 int xmin = 0, xmax = 0, ymin = 0, ymax = 0, count, last;
2093 gdImagePtr large, load;
2100 printf(
" Generating composite map for %s...", map->
name);
2104 printf(
" already uptodate.\n");
2110 printf(
"Tiled map without tiled maps?\n");
2149 if (last == count) {
2150 printf(
"do_tiled_map_picture: didn't process any map in %s (%d left)??\n", map->
path, last);
2171 out = fopen(picpath,
"rb");
2173 printf(
"\n do_tiled_map_picture: warning: pic file %s not found for %s (errno=%d)\n", picpath, map->
tiled_maps.
maps[tiled]->
path, errno);
2177 load = gdImageCreateFromPng(out);
2179 load = gdImageCreateFromJpeg(out);
2182 printf(
"\n do_tiled_map_picture: warning: pic not found for %s\n", map->
tiled_maps.
maps[tiled]->
path);
2186 gdImageDestroy(load);
2191 gdImageDestroy(large);
2208 printf(
"Writing tiled map information...\n");
2224 static std::shared_ptr<inja::Environment>
env;
2238 return found->first;
2250 return found->first;
2260 nlohmann::json result = nlohmann::json::array();
2261 for (
size_t m = 0;
m <
maps.count;
m++) {
2264 result.push_back(map->second);
2276 nlohmann::json result;
2277 for (
size_t n = 0; n <
list.size(); n++) {
2280 {
"name", npc->name },
2283 {
"message", npc->message },
2295 nlohmann::json result;
2296 for (
size_t n = 0; n <
list.count; n++) {
2297 auto race =
list.races[n];
2299 {
"name", race->name },
2300 {
"count", race->count },
2312 nlohmann::json ret = nlohmann::json::array();
2313 for (
size_t m = 0;
m <
list.count;
m++) {
2314 auto q =
list.list[
m];
2315 if (!q->map || !q->description)
2319 {
"description", q->description },
2320 {
"quest", q->quest->name },
2321 {
"number", q->quest->number },
2330 return path && path[0] ==
'/' ? path + 1 : path;
2342 {
"name", map->
name },
2345 {
"level", map->
level },
2347 {
"lore", map->
lore && map->
lore[0] ? map->
lore :
"" },
2366 {
"number", quest->
number },
2367 {
"name", quest->
name ? quest->
name :
"" },
2380 for (
size_t map = 0; map <
list.count; map++) {
2381 auto cur =
list.maps[map];
2382 if (cur->tiled_group)
2384 snprintf(
buf,
sizeof(
buf),
"map_%04lu", map);
2398 for (
size_t map = 0; map < src.
count; map++)
2408 nlohmann::json ret = nlohmann::json::array();
2412 ret.push_back((*r).second);
2422 return find->second;
2424 inja::Template parsed =
env->parse_template(filename);
2434 nlohmann::json
maps;
2437 bool need_unknown_region =
false;
2438 nlohmann::json search;
2449 snprintf(
buf,
sizeof(
buf),
"reg_%04lu", reg);
2456 nlohmann::json r = {
2465 json[
"regions"].push_back(r);
2467 search[
"reg_" + std::to_string(reg)] = {
2475 size_t map_index = 0;
2477 auto cur = map.first;
2478 if (cur->tiled_group)
2480 if (cur->cfregion ==
nullptr)
2481 need_unknown_region =
true;
2483 m[
"_index"] = map_index;
2484 json[
"maps"].push_back(
m);
2486 search[
"map_" + std::to_string(map_index++)] = {
2488 {
"name", cur->name },
2489 {
"text", std::string(cur->lore ? cur->lore :
"") },
2494 if (need_unknown_region) {
2495 json[
"regions"].push_back({
2496 {
"_key",
"reg_ffff" },
2497 {
"name",
"unknown" },
2498 {
"longname",
"unknown" },
2499 {
"description",
"unknown" },
2500 {
"maps", nlohmann::json::array() },
2501 {
"links", nlohmann::json::array() },
2505 json[
"reset_groups"] = nlohmann::json::array();
2507 json[
"reset_groups"].push_back(rg);
2510 json[
"items"] = nlohmann::json::array();
2513 nlohmann::json item = {
2515 {
"name", eq->name },
2516 {
"power", eq->power },
2517 {
"calc_power", eq->calc_power },
2518 {
"diff", eq->diff },
2521 json[
"items"][idx] = item;
2523 search[
"item_" + std::to_string(idx)] = {
2525 {
"name", eq->name },
2530 json[
"monsters"] = nlohmann::json::array();
2531 for (
size_t item = 0; item <
races.
count; item++) {
2534 nlohmann::json
m = {
2536 {
"name", race->name },
2537 {
"count", race->count },
2540 json[
"monsters"].push_back(
m);
2542 search[
"monster_" + std::to_string(item)] = {
2544 {
"name", race->name },
2549 json[
"system_quests"] = nlohmann::json::array();
2554 {
"code", quest->quest_code },
2555 {
"title", quest->quest_title },
2556 {
"description", quest->quest_description ? quest->quest_description :
"" },
2557 {
"replayable", quest->quest_restart },
2558 {
"steps", nlohmann::json::array() },
2559 {
"maps", nlohmann::json::array() },
2563 std::sort(quest->steps.begin(), quest->steps.end(), [] (
auto left,
auto right) { return left->step < right->step; });
2564 for (
size_t s = 0; s < quest->steps.size(); s++) {
2565 j[
"steps"].push_back({
2566 {
"description", quest->steps[s]->step_description ? quest->steps[s]->step_description :
"" },
2567 {
"is_completion", quest->steps[s]->is_completion_step ? true :
false },
2573 for (
size_t m = 0;
m < qim->maps.count;
m++) {
2576 j[
"maps"].push_back({
2577 {
"description", qim->maps.list[
m]->description },
2578 {
"map", map->second },
2583 json[
"system_quests"].push_back(j);
2584 search[
"quest_" + std::to_string(q)] = {
2586 {
"name", quest->quest_title ? quest->quest_title :
"" },
2587 {
"text", quest->quest_description ? quest->quest_description :
"" },
2588 {
"url",
"system_quests.html#q" + std::to_string(q) },
2592 json[
"slaying"] = nlohmann::json::array();
2595 json[
"slaying"].push_back({
2596 {
"slaying", info->slaying },
2605 json[
"quests"] = nlohmann::json::array();
2609 snprintf(
buf,
sizeof(
buf),
"quest_%d",
quests[quest]->number);
2615 std::string out(
root);
2616 out +=
"/search_data.js";
2617 std::ofstream sf(out, std::ios_base::trunc);
2618 sf <<
"var search_data = " << search <<
";" << std::endl;
2619 sf <<
"var search_type = { ";
2622 sf << sep << i <<
": \"" <<
SearchName[i] <<
"\"";
2625 sf <<
" };" << std::endl;
2632 void add_template_to_render(
const std::string &template_name,
const std::string &output_name,
const std::string ¶m);
2645 if (current[0] !=
'/')
2646 current =
'/' + current;
2657 auto template_name = args.at(0)->get<std::string>();
2658 auto output_name(template_name);
2659 auto param = (args.size() > 1 ? args.at(1)->get<std::string>() :
"");
2661 if (!param.empty()) {
2662 output_name = param +
"_" + output_name;
2663 if (param.substr(0, 4) ==
"map_") {
2665 if (map !=
nullptr) {
2666 output_name = std::string(map->path + 1) +
".html";
2669 if (param.substr(0, 4) ==
"reg_") {
2671 if (reg !=
nullptr) {
2672 output_name = std::string(reg->name) +
".html";
2677 if (template_name !=
"search_data.js" && template_name !=
"search_index.js")
2688 auto what = args.at(0)->get<std::string>();
2689 if (what.substr(0, 4) ==
"map_") {
2694 if (args.size() > 1) {
2695 size = args.at(1)->get<
int>() - 1;
2722 auto on(output_name);
2736 static std::vector<std::string>
split(
const std::string &field,
const std::string &by) {
2737 std::vector<std::string> result;
2738 size_t start = 0,
found;
2739 while ((
found = field.find(by, start)) != std::string::npos) {
2740 result.push_back(field.substr(start,
found - start));
2743 result.push_back(field.substr(start));
2756 env->add_callback(
"substr", [] (inja::Arguments &args) {
2757 std::string str = args.at(0)->get<std::string>();
2758 size_t start = args.at(1)->get<size_t>();
2759 size_t len = args.size() > 2 ? args.at(2)->get<
size_t>() : std::string::npos;
2760 return str.substr(start, len);
2763 env->add_callback(
"pad", [] (inja::Arguments &args) {
2765 int val = args.at(0)->get<int>(), digits = args.at(1)->get<
int>();
2766 snprintf(
buf,
sizeof(
buf),
"%0*d", digits, val);
2767 return std::string(
buf);
2769 env->add_callback(
"path_to_root", 0, [] (inja::Arguments &) {
2772 if (current[0] ==
'/')
2773 current = current.substr(1);
2775 while ((start = current.find(
'/', start)) != std::string::npos) {
2781 env->add_callback(
"get_by_field", 3, [] (inja::Arguments &args) {
2782 const auto &src = args.at(0);
2783 auto field = args.at(1)->get<std::string>();
2784 const auto &value = args.at(2);
2785 auto found = std::find_if(src->begin(), src->end(), [&field, &value] (
auto item) {
2786 return item[field] == *value;
2788 if (
found == src->end()) {
2789 return nlohmann::json();
2793 env->add_callback(
"get_list_by_field", 3, [] (inja::Arguments &args) {
2794 nlohmann::json ret = nlohmann::json::array();
2795 const auto &src = args.at(0);
2796 auto field = args.at(1)->get<std::string>();
2797 const auto filter = args.at(2);
2798 if (filter->is_array()) {
2799 std::copy_if(src->begin(), src->end(), std::back_inserter(ret), [&] (
auto &item) {
2800 auto val = item[field];
2801 return std::find_if(filter->begin(), filter->end(), [&] (auto li) { return val == li; }) != filter->end();
2804 std::copy_if(src->begin(), src->end(), std::back_inserter(ret), [&] (
auto &item) {
2805 return filter->get<std::string>() == item[field];
2810 env->add_callback(
"sort", [] (inja::Arguments &args) {
2811 const auto &src = args.at(0);
2812 std::vector<nlohmann::json> ret;
2813 for (
auto i : *src) {
2816 auto fields =
split(args.at(1)->get<std::string>(),
",");
2817 bool invert = args.size() > 2 ? args.at(2)->get<
bool>() :
false;
2818 bool ignore_case = args.size() > 3 ? args.at(3)->get<
bool>() :
true;
2819 std::sort(ret.begin(), ret.end(), [&] (
auto left,
auto right) {
2820 for (auto field : fields) {
2821 nlohmann::json l = left[field], r = right[field];
2822 if (ignore_case && l.is_string() && r.is_string()) {
2823 std::string ls(l.get<std::string>()), rs(r.get<std::string>());
2824 std::transform(ls.begin(), ls.end(), ls.begin(), [](unsigned char c){ return std::tolower(c); });
2825 std::transform(rs.begin(), rs.end(), rs.begin(), [](unsigned char c){ return std::tolower(c); });
2829 return invert ? (rs < ls) : (ls < rs);
2834 return invert ? (r < l) : (l < r);
2841 env->set_trim_blocks(
true);
2842 env->set_lstrip_blocks(
true);
2872 struct dirent *file;
2873 struct stat statbuf;
2878 for (ignore = 0;
ignore_path[ignore] != NULL; ignore++) {
2889 for (ignore = 0;
ignore_name[ignore] != NULL; ignore++) {
2890 if (strcmp(file->d_name,
ignore_name[ignore]) == 0)
2896 snprintf(full,
sizeof(full),
"%s/%s", path, file->d_name);
2898 status = stat(full, &statbuf);
2899 snprintf(full,
sizeof(full),
"%s/%s", from, file->d_name);
2900 if ((status != -1) && (S_ISDIR(statbuf.st_mode))) {
2915 snprintf(path,
sizeof(path),
"%s/%s",
root,
"maps.unused");
2916 dump = fopen(path,
"w+");
2918 printf(
"Unable to open file maps.unused!\n");
2922 fprintf(
dump,
"%s\n", *map);
2925 printf(
"%ld unused maps.\n",
found_maps.size());
2933 gdImagePtr elevationmap;
2939 printf(
"Saving exit/blocking/road information...");
2941 file = fopen(path,
"wb+");
2949 puts(
"Error: Could not save elevation world map due to not finding any minimum or maximum elevation.");
2953 elevationmap = gdImageCreateTrueColor(30*50, 30*50);;
2955 for (x = 0; x < 30*50; x++) {
2956 for (y = 0; y < 30*50; y++) {
2961 printf(
"Saving elevation world map...");
2963 file = fopen(path,
"wb+");
2967 gdImageDestroy(elevationmap);
2968 elevationmap = NULL;
2995 printf(
"Crossfire Mapper will generate pictures of maps, and create indexes for all maps and regions.\n\n");
2996 printf(
"Syntax: %s\n\n", program);
2997 printf(
"Optional arguments:\n");
2998 printf(
" -nopics don't generate pictures.\n");
2999 printf(
" -root=<path> destination path. Default 'html'.\n");
3000 printf(
" -limit=<number> stop processing after this number of maps, -1 to do all maps (default).\n");
3001 printf(
" -showmaps outputs the name of maps as they are processed.\n");
3002 printf(
" -jpg[=quality] generate jpg pictures, instead of default png. Quality should be 0-95, -1 for automatic.\n");
3003 printf(
" -forcepics force to regenerate pics, even if pics's date is after map's.\n");
3004 printf(
" -addmap=<map> adds a map to process. Path is relative to map's directory root.\n");
3005 printf(
" -rawmaps generates maps pics without items on random (shop, treasure) tiles.\n");
3006 printf(
" -warnnopath inform when an exit has no path set.\n");
3007 printf(
" -listunusedmaps finds all unused maps in the maps directory.\n");
3008 printf(
" -noworldmap don't write the world map in world.png.\n");
3009 printf(
" -noregionslink don't generate regions relation file.\n");
3010 printf(
" -regionslink generate regions relation file.\n");
3011 printf(
" -noexitmap don't generate map of exits.\n");
3012 printf(
" -exitmap generate map of exits.\n");
3013 printf(
" -tileset=<number> use specified tileset to generate the pictures. Default 0 (standard).\n");
3014 printf(
" -details-quests list all quests steps. Default no.\n");
3015 printf(
" -list-system-quests include 'system' quests in quest list. Default no.\n");
3016 printf(
" -templates-dir=[dir] set the directory to get templates from. Default 'templates/'.\n");
3017 printf(
" -add-template=[file] add a template to process. May be specified multiple times. If empty, 'index.html' is used.\n");
3018 printf(
" -list-template-to-process display the name of the template about to be rendered. Useful for debugging.");
3037 while (arg < argc) {
3038 if (strcmp(argv[arg],
"-nopics") == 0)
3040 else if (strncmp(argv[arg],
"-root=", 6) == 0)
3041 strncpy(
root, argv[arg]+6, 500);
3042 else if (strncmp(argv[arg],
"-limit=", 7) == 0)
3044 else if (strcmp(argv[arg],
"-showmaps") == 0)
3046 else if (strcmp(argv[arg],
"-jpg") == 0) {
3048 if (argv[arg][4] ==
'=') {
3054 else if (strcmp(argv[arg],
"-forcepics") == 0)
3056 else if (strncmp(argv[arg],
"-addmap=", 8) == 0) {
3057 if (*(argv[arg]+8) ==
'/')
3058 strncpy(path, argv[arg]+8, 500);
3060 snprintf(path, 500,
"/%s", argv[arg]+8);
3063 else if (strcmp(argv[arg],
"-rawmaps") == 0)
3065 else if (strcmp(argv[arg],
"-warnnopath") == 0)
3067 else if (strcmp(argv[arg],
"-listunusedmaps") == 0)
3069 else if (strcmp(argv[arg],
"-noworldmap") == 0)
3071 else if (strcmp(argv[arg],
"-noregionslink") == 0)
3073 else if (strcmp(argv[arg],
"-regionslink") == 0)
3075 else if (strcmp(argv[arg],
"-noexitmap") == 0)
3077 else if (strcmp(argv[arg],
"-exitmap") == 0)
3079 else if (strncmp(argv[arg],
"-tileset=", 9) == 0) {
3082 }
else if (strcmp(argv[arg],
"-detail-quests") == 0) {
3084 }
else if (strcmp(argv[arg],
"-list-system-quests") == 0) {
3086 }
else if (strncmp(argv[arg],
"-templates-dir=", 15) == 0) {
3088 }
else if (strncmp(argv[arg],
"-add-template=", 14) == 0) {
3090 }
else if (strcmp(argv[arg],
"-list-template-to-process") == 0) {
3092 }
else if (strncmp(argv[arg],
"-build-search-data", 18) == 0) {
3099 strcpy(
root,
"html");
3118 strcpy(dummy,
root);
3119 strcat(dummy,
"/a");
3132 return (value ?
"yes" :
"no");
3136 size_t current_map = 0, i;
3147 printf(
"Initializing Crossfire data...\n");
3165 printf(
"\n\n done.\n\n");
3168 printf(
"Erreor: invalid tileset %d!\n",
tileset);
3180 snprintf(max,
sizeof(max),
"%d",
map_limit);
3182 strcpy(max,
"(none)");
3183 printf(
"Crossfire map browser generator\n");
3184 printf(
"-------------------------------\n\n");
3185 printf(
"Parameters:\n");
3186 printf(
" path to write files: %s\n",
root);
3187 printf(
" maximum number of maps to process: %s\n", max);
3204 printf(
" templates to process: ");
3205 const char *sep =
"";
3207 printf(
"%s%s", sep, f.c_str());
3215 printf(
"listing all maps...");
3217 printf(
"done, %ld maps found.\n",
found_maps.size());
3221 infomap = gdImageCreateTrueColor(30*50, 30*50);
3228 for (i = 0; i < 50*30; i++)
3233 printf(
"browsing maps...\n");
3239 if (current_map%100 == 0) {
3243 printf(
" --- map limit reached, stopping ---\n");
3248 printf(
" finished map parsing, %zu maps processed, %d map pictures created, %d map pictures were uptodate. Total %d faces used.\n", current_map,
created_pics,
cached_pics,
pics_allocated);
3270 std::sort(
system_quests.begin(),
system_quests.end(), [] (
const auto &left,
const auto &right) { return strcmp(left->quest_code, right->quest_code) < 0; });
3277 if (!file.empty()) {
3282 const auto fullStart =
time(
nullptr);
3283 printf(
"rendering pages...");
3288 while (!
pages.empty()) {
3289 auto p =
pages.back();
3291 if (p.param.empty())
3295 const auto start =
time(
nullptr);
3297 printf(
" rendering page %s (%s)... ", p.template_name.c_str(), p.param.c_str());
3304 const auto elapsed =
time(
nullptr) - start;
3306 printf(
"took %ld seconds\n", elapsed);
3310 const auto elapsed =
time(
nullptr) - fullStart;
3311 printf(
" done, took %ld seconds\n", elapsed);
3330 while ((invtmp->stats.hp--) > 0)
3332 invtmp->randomitems = NULL;
3336 && invtmp->type !=
SPELL
3337 && invtmp->type !=
CLASS
3343 invtmp->randomitems = NULL;
3356 if (tmp->type ==
WAND
3361 || tmp->type ==
ALTAR
3363 tmp->randomitems = NULL;
3369 while ((tmp->stats.hp--) > 0)
3371 tmp->randomitems = NULL;
3373 object *head =
HEAD(tmp);
3390 && tmp->type !=
SPELL
3392 && tmp->type !=
CLASS
3395 tmp->randomitems = NULL;
3408 #ifndef DOXYGEN_SHOULD_SKIP_THIS
3414 void draw_ext_info(
int,
int,
const object *, uint8_t, uint8_t,
const char *txt) {
3415 fprintf(
logfile,
"%s\n", txt);
3418 void draw_ext_info_format(
int,
int,
const object *, uint8_t, uint8_t,
const char *format, ...) {
3421 va_start(ap, format);
3422 vfprintf(
logfile, format, ap);
3427 fprintf(
logfile,
"ext_info_map: %s\n", str1);
static struct_race * get_race(const char *name)
Returns the race for specified name.
struct struct_map_info * tiles[4]
@ CLASS
Object for applying character class modifications to someone.
sstring name_pl
The plural name of the object.
void init_globals(void)
Initialises all global variables.
static void write_tiled_map_page(struct_map_info *map)
Writes the page for a tiled map group.
static void fix_tiled_map_monsters(void)
Makes all monsters point to tiled maps instead of map when appliable, and merge map monster to tiled ...
void do_auto_apply(mapstruct *m)
static void add_map(struct_map_info *info, struct_map_list *list)
Adds a map to specified array, if it isn't already.
#define HAS_RANDOM_ITEMS(op)
This return TRUE if object has still randomitems which could be expanded.
const char * mapdir
Where the map files are.
struct Settings settings
Global settings.
static const char * ignore_name[]
File names to ignore for map search.
char * diff
Result of get_ob_diff() with the item's clone.
static struct_quest * get_quest_info(const char *name)
Gets the information for a quest, create the field if needed.
static region * find_region_by_key(const std::string &key)
Get the region with the specified key, nullptr if not found.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
void emergency_save(int flag)
Save all players.
static void process_map_lore(struct_map_info *map)
Extracts from the map's lore quest information if found.
const artifact * find_artifact(const object *op, const char *name)
Searches and returns a specific artifact compatible with an object, NULL if not found.
@ llevError
Error, serious thing.
region * get_region_struct(void)
Allocates and zeros a region struct, this isn't free()'d anywhere, so might be a memory leak,...
uint16_t difficulty
What level the player should be to play here.
int8_t fallback
Whether, in the event of a region not existing, this should be the one we fall back on as the default...
static int compare_map_info(const struct_map_info *left, const struct_map_info *right)
Compares struct_map_info according to the map name or the path if equal.
static std::string path_from_current(const std::string &path)
Compute the relative path from the specified file to the current file.
object * find_skill_by_number(object *who, int skillno)
This returns the first skill pointer of the given subtype (the one that accumulates exp,...
void quest_for_each(quest_op op, void *user)
Iterate over all quests.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
int is_world
If set, this region has at least one map part of the world, thus region name should be written.
static nlohmann::json generate_picture_link(inja::Arguments &args)
Return the link to the picture of the specified item.
struct struct_map_info * tiled_group
static bool build_search_file
If set, will build the 'search_data.js' file.
char * filename
Filename of the map.
static const int num_sizes
static void add_slaying(struct_map_info *map, object *item)
Adds the item's information to the map.
#define FLAG_IS_LINKED
The object is linked with other objects.
mapstruct * ready_map_name(const char *name, int flags)
Makes sure the given map is loaded and swapped in.
static void write_tiled_maps(void)
Outputs all tiled map pages.
char first_map_path[MAX_BUF]
The start-level.
#define QUERY_FLAG(xyz, p)
struct_map_in_quest_list maps
Maps part of this quest.
static nlohmann::json create_quest_object(struct_quest *quest, const std::string &key)
Return a JSON quest object.
static struct_map_info * create_map_info(void)
Returns an initialised struct_map_info.
int count
Number found on map.
struct_map_info * map
Linked map.
std::string param
Optional template parameter.
static void write_pictures_from_real_size(const char *path, gdImagePtr real, int width, int height)
static std::map< region *, std::set< region * > > region_links
int get_face_fallback(int faceset, uint16_t imageno)
This returns the set we will actually use when sending a face.
int8_t item_power
Power rating of the object.
const char * datadir
Read only data files.
static event_registration c
#define FLAG_FRIENDLY
Will help players.
struct archetype * arch
Pointer to archetype.
static enum output_format_type output_format
Selected output format.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
static int quests_count
Count of quests.
static nlohmann::json create_npc_array(npc_list &list)
Return an array of NPC information.
static struct_map_info * get_map_info(const char *path)
Gets or creates if required the info structure for a map.
static void fix_exits_to_tiled_maps(void)
Changes all exits to maps in a tiled map to point directly to the tiled map.
static std::map< struct_map_info *, std::string > reverse_maps
Link between a map and its unique identifier.
static int dump(const std::set< std::string > &items, const char *name)
static std::vector< gdImagePtr > gdfaces
Link between a quest and a map.
static size_t slaying_allocated
Allocated size of slaying_info.
void give_artifact_abilities(object *op, const object *artifact)
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-...
#define MAP_IN_MEMORY
Map is fully loaded.
struct mapstruct * map
Pointer to the map in which this object is present.
static struct_equipment * get_equipment(void)
Gets an empty struct_equipment.
static int is_special_equipment(object *item)
static size_t region_allocated
Allocated size of regions.
static nlohmann::json generate_page_and_link(inja::Arguments &args)
Create a link to a page, generating it if needed.
struct_map_list origin
Map(s) this item is found in.
object * generate_treasure(treasurelist *t, int difficulty)
Generate a treasure from a list generating a single item.
non standard information is not specified or uptime fields
face_sets * find_faceset(int id)
object * item
Special values of the artifact.
static char root[500]
Path to store generated files.
static nlohmann::json create_map_in_quest_array(struct_map_in_quest_list &list)
Return an array of map-in-quest items.
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
static const char * yesno(int value)
Helper to write yes/no.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
char * name
Map's name as defined in the map file.
static void fix_map_names(void)
Ensures all maps have a name (if there was a limit to map processing, some maps will have a NULL name...
struct_map_list maps[S_MAX]
static struct_map_list maps_list
Maps to process or found.
static int color_unlinked_exit
Color for exits without a path set.
static std::vector< pageToRender > pages
List of pages to render.
static int list_unused_maps
If set, program will list maps found in directory but not linked from the first maps.
void esrv_update_spells(player *pl)
This looks for any spells the player may have that have changed their stats.
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
static nlohmann::json create_region_array(const std::set< region * > ®ions)
Return an array of region identifiers.
static void add_npc_to_map(npc_list *list, const object *npc)
Add the specified NPC to the list.
void rod_adjust(object *rod)
Adjusts rod attributes.
the faster the spell may be cast there are several other common only the caster may be affected by the spell The most common spell range is that of touch This denotes that the caster much touch the recipient of the spell in order to release the spell monster
char * name
Shortend name of the region as maps refer to it.
sstring title
Of foo, etc.
#define FLAG_CURSED
The object is cursed.
char path[HUGE_BUF]
Filename of the map.
bool quest_is_system
If set then the quest isn't counted or listed.
int calc_power
Item power calculated via calc_item_power().
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
#define HUGE_BUF
Used for messages - some can be quite long.
SearchType
Search values, for the JS search engine.
Plugin animator file specs[Config] name
static int force_pics
To force picture regeneration even if map didn't change.
static int world_exit_info
If set, will generate a world map of exits.
static int sort_struct_quest(const void *left, const void *right)
Sorts 2 struct_quest, on the map's name or path.
void dragon_ability_gain(object *who, int atnr, int level)
When a dragon-player gains a new stage of evolution, he gets some treasure.
Utility structure to group map-quest link structure.
char * longname
Official title of the region, this might be defined to be the same as name.
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
struct struct_quest * quest
Point back to the quest.
static void init_renderer_env()
Initialize env and set various callbacks and options.
char * description
Description, from the main map's lore.
void init_gods(void)
This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD...
int16_t y
Position in the map for this object.
static event_registration m
void set_darkness_map(mapstruct *m)
Set the darkness level for a map, based on the time of the day.
#define MOVE_ALL
Mask of all movement types.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
void apply_auto_fix(mapstruct *m)
Go through the entire map (only the first time when an original map is loaded) and performs special a...
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
DIR * opendir(const char *)
static inja::TemplateStorage templateCache
static struct struct_region_info ** regions
Found regions.
int y
Coordinates in the map.
struct_map_list exits_from
LogLevel debug
Default debugging level.
static bool detail_quests
Whether to show all quests details or not.
static struct_equipment * ensure_unique(struct_equipment *item)
Searches the item list for an identical item, except maps.
const char * message
NPC's message.
static struct_slaying_info * get_slaying_struct(const char *slaying)
Returns a struct_slaying_info for specified slaying.
static void generate_picture_path(const char *path, size_t pic_size, char *out, size_t len)
static int elevation_max
Lowest elevation found.
#define FLAG_UNPAID
Object hasn't been paid for yet.
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
Information about a NPC with a custom message.
static void define_quest(const char *name, struct_map_info *mainmap, const char *description)
Sets the main map for a quest.
char * path_combine_and_normalize(const char *src, const char *dst, char *path, size_t size)
Combines the 2 paths.
static void add_to_struct_map_in_quest_list(struct_map_in_quest_list *list, struct_map_in_quest *item)
static void do_tiled_map_picture(struct_map_info *map)
Generates the large and small pictures for a tiled map.
void account_char_free(Account_Chars *chars)
This frees all data associated with the character information.
object clone
An object from which to do object_copy()
static struct_slaying_info ** slaying_info
Found slaying fields.
sstring add_string(const char *str)
Share a string.
#define FLAG_MONSTER
Will attack players.
static struct_race_list races
Monsters found in maps.
std::vector< struct_npc_info * > npc_list
List of NPCs with a custom message.
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
Computes the size of a multitile object.
int main(int argc, char **argv)
#define HEAD(op)
Returns the head part of an object.
static const char * output_extensions[]
Extensions depending on output format.
static nlohmann::json create_maps_array(struct_map_list &maps)
Return an array of map identifiers.
static int show_maps
If set, will generate much information on map loaded.
static std::vector< quest_definition * > system_quests
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
static int get_elevation_color(int elevation, gdImagePtr elevationmap)
Gets the color for an elevation.
static std::set< std::string > reset_groups
All defined reset groups.
char * msg
The description of the region.
void init_readable(void)
Initialize linked lists utilized by message functions in tailor_readable_ob()
static void quest_callback(const quest_definition *quest, void *)
struct dirent * readdir(DIR *)
void void ext_info_map(int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
Writes to everyone on the specified map.
char * name
Monster's name.
static int is_slaying(object *item)
Is the slaying field relevant for this item?
int power
Item power as declared by the item itself.
static nlohmann::json create_race_array(struct_race_list &list)
Return an array of monster information.
spell prayer lvl t sp speed range duration short description
void object_update_speed(object *op)
Updates the speed of an object.
struct_map_list origin
Maps to find said monster.
static int color_slowing
Slows movement.
uint8_t type
PLAYER, BULLET, etc.
struct_map_in_quest_list quests
static void write_world_map(void)
Generates a big world map.
void command_help(object *op, const char *params)
Player is asking for some help.
static void add_map_to_quest(struct_map_info *map, const char *name, const char *description)
Links a map to a quest.
static struct_npc_info * create_npc_info(const object *npc)
Create the struct_npc_info from the specified NPC.
uint8_t * data
Image data.
void move_firewall(object *op)
Move for FIREWALL.
static int color_road
Road or equivalent.
static int tileset
Tileset to use to generate pics.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
static int is_blocking(object *item)
Checks if item blocks movement or not.
#define FLAG_NO_PICK
Object can't be picked up.
static void do_exit_map(mapstruct *map)
Proceses exit / road / blocking information for specified map into the global infomap map.
static void create_destination(void)
Ensures destination directory exists.
struct struct_race ** races
Races on the list.
static void check_slaying_inventory(struct_map_info *map, object *item)
Recursively checks if the object should be considered for slaying information.
#define FLAG_IS_A_TEMPLATE
Object has no ingame life until instantiated.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
static int jpeg_quality
Quality for jpg pictures.
static void append_map_list(struct_map_list &dest, struct_map_list &src)
Append the contents of src to dest.
FILE * logfile
Used by server/daemon.c.
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
static int rawmaps
Whether to generate raw pics or instancied ones.
static void init_struct_map_in_quest_list(struct_map_in_quest_list *list)
One monster race in the maps.
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
size_t allocated
Allocated space.
struct struct_map_info ** maps
size_t count
Number of races.
static void fill_json(nlohmann::json &json)
Add all global variables to the data available to templates.
static void add_map_to_region(struct_map_info *map, region *reg)
Links a map to a region.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn though Notes on Specific and settings file datadir Usually usr share crossfire Contains data that the server does not need to modify while such as the etc A default install will pack the artifact
static bool list_system_quests
Whether to show 'system' quests or not.
static int generate_pics
Whether to generate the picture or not.
#define MAP_WIDTH(m)
Map width.
static nlohmann::json create_map_object(struct_map_info *map, const std::string &key)
Return a JSON map object.
struct_map_info * mainmap
Map defining the quest.
static std::shared_ptr< inja::Environment > env
Rendering environment.
#define MAX_BUF
Used for all kinds of things.
static int sort_map_info(const void *left, const void *right)
Sorts the struct_map_info according to the map name or the path if equal.
static void fill_reverse_maps(struct_map_list &list)
Fill the reverse_maps array with the provided 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 d
int is_valid_faceset(int fsn)
Checks specified faceset is valid.
void esrv_del_item(player *pl, object *ob)
Tells the client to delete an item.
One page to render, with its parameters.
MoveType move_slow
Movement types this slows down.
static int sort_slaying(const void *left, const void *right)
Helper function to sort an array of struct_slaying_info.
static struct_map_list tiled_map_list
Pseudo-maps grouping other maps.
static void add_race_to_list(struct_race *race, struct_race_list *list, int check)
Appends a race to a race list.
A buffer that will be expanded as content is added to it.
#define FLAG_DAMNED
The object is very cursed.
static void check_equipment(object *item, struct_map_info *map)
Checks if item and its inventory are worthy to be listed.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
static std::vector< std::string > path_stack
Path, relative to output root, of pages being generated.
static void merge_tiled_maps(struct_map_info *map, struct_map_info *tiled_map)
Merge two tiled maps groups.
static int cached_pics
Non recreated pics.
static void list_map(const char *path)
Marks specified path as processed.
static std::set< std::string > rendered_templates
List of generated files, to not generate multiple times.
int apply_auto(object *op)
Map was just loaded, handle op's initialization.
char * path
Full path of the map from the start directory.
this information may not reflect the current implementation This brief document is meant to describe the operation of the crossfire as well as the form of the data The metaserver listens on port for tcp and on port for udp packets The server sends updates to the metaserver via udp The metaserver only does basic checking on the data that server sends It trusts the server for the ip name it provides The metaserver does add the ip address and also tracks the idle time(time since last packet received). The client gets its information from the metaserver through connecting by means of tcp. The client should retrieve http the body s content type is text plain The current metaserver implementation is in Perl But the metaserver could be in any language perl is fast enough for the amount of data that is being exchanged The response includes zero or more server entries Each entry begins with the line START_SERVER_DATA and ends with the line END_SERVER_DATA Between these lines key value pairs("key=value") may be present. The entries are sent in arbitrary order. A client should apply some ordering when displaying the entries to the user. TODO b additional information outside BEGIN_SERVER_DATA END_SERVER_DATA maps
sstring slaying
Which race to do double damage to.
static void init_map_list(struct_map_list *list)
Initialises a list structure.
std::vector< region * > all_regions
static void add_region_link(mapstruct *source, mapstruct *dest)
Creates a link between two maps if they are on different regions.
void clean_tmp_files(void)
Save unique maps and clean up temporary map files unless recycling temporary maps.
void init_library(void)
It is vital that init_library() is called by any functions using this library.
sstring name
The name of the object, obviously...
static void free_equipment(struct_equipment *equip)
Frees a struct_equipment.
static int created_pics
Picture statistics.
static void add_map_to_slaying(struct_slaying_info *info, int item, struct_map_info *map)
Adds the specified map to the slaying information if not already present.
int sum
Sum of locations, to compute name position.
@ OF_PNG
PNG, default value.
sstring artifact
If set, the item is the artifact with this name and the matching type.
struct_map_list maps_list
Maps in the region.
object * env
Pointer to the object which is the environment.
char * create_pathname(const char *name, char *buf, size_t size)
Get the full path to a map file.
#define FLAG_AUTO_APPLY
Will be applied when created.
const typedef char * sstring
static void save_picture(FILE *file, gdImagePtr pic)
Saves a map to a file, based on jpg/png settings.
static bool display_rendered_template
Whether to display the template to be rendered or not.
static std::string templates_root("templates/")
Directory to get templates from, with a leading /.
Definition of an in-game quest.
struct_race_list monsters
archetype * find_archetype(const char *name)
static int ** elevation_info
All elevation spots in the "world_" maps.
static int color_blocking
Block all movement.
char * description
Description associated with the map for the quest.
static inja::Template get_template(const std::string &filename)
uint32_t in_memory
Combination of IN_MEMORY_xxx flags.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
sstring msg
If this is a book/sign/magic mouth/etc.
struct_map_list tiled_maps
static size_t region_count
Count of regions.
static void do_parameters(int argc, char **argv)
Handles command-line parameters.
#define CLEAR_FLAG(xyz, p)
static nlohmann::json all_data
All JSON data available to templates.
uint16_t datalen
Length of data.
static void add_monster(object *monster, struct_map_info *map)
Adds a monster to the monster list.
struct struct_map_in_quest ** list
#define MAP_HEIGHT(m)
Map height.
int number
Unique quest identifier.
std::string template_name
Template name to use.
void get_ob_diff(StringBuffer *sb, const object *op, const object *op2)
Returns a pointer to a static string which contains all variables which are different in the two give...
player * find_player_partial_name(const char *plname)
Find a player by a partial name.
static int sort_race(const void *a, const void *b)
Sort 2 struct_race.
static bool do_regions_link
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
void object_give_identified_properties(object *op)
Ensure op has all its "identified" properties set.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various stats
static void init_race_list(struct_race_list *list)
Blanks a struct_race_list.
static void process_map(struct_map_info *info)
Processes a map.
static int quests_allocated
Allocated items in quests.
int strcasecmp(const char *s1, const char *s2)
static std::string SearchName[int(SearchType::Count)]
Search names for types, for the JS search engine.
static std::map< region *, std::string > reverse_regions
Link between a region and its unique identifier.
region * get_region_by_map(mapstruct *m)
Gets a region from a map.
#define S_DOOR
Connection/slaying information.
struct treasurelist * randomitems
Items to be generated.
static struct_map_info * create_tiled_map(void)
Create a new tiled map and link it to the tiled map list.
static int world_map
If set, will generate a world map.
static std::vector< std::string > templates
List of template files to start processing from.
static const char * ignore_path[]
Directories to ignore for map search.
Structure handling character information for an account.
static size_t slaying_count
Count of items in slaying_info.
void add_template_to_render(const std::string &template_name, const std::string &output_name, const std::string ¶m)
Push the specified template, with optional param, on the list of files to process.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
static const char * remove_trailing_slash(const char *path)
Magical Runes Runes are magical inscriptions on the dungeon which cast a spell or detonate when something steps on them Flying objects don t detonate runes Beware ! Runes are invisible most of the time They are only visible occasionally ! There are several runes which are there are some special runes which may only be called with the invoke and people may apply it to read it Maybe useful for mazes ! This rune will not nor is it ordinarily invisible Partial Visibility of they ll be visible only part of the time They have a(your level/2) chance of being visible in any given round
static gdImagePtr infomap
World map with exits / roads / blocking / ...
static int sort_struct_map_in_quest(const void *left, const void *right)
Sorts 2 struct_map_in_quest, on the map's name or path.
SockList * player_get_delayed_buffer(player *pl)
Get a delayed socket buffer, that will be sent after the player's tick is complete.
static void relative_path(const char *from, const char *to, char *result)
Computes the shortest path from one file to another.
static void dump_unused_maps(void)
Writes the list of unused maps, maps found in the directories but not linked from the other maps.
static int sort_region(const void *left, const void *right)
Sorts an array of struct_region_info by region name.
static std::vector< struct_equipment * > special_equipment
Special equipment list.
void make_path_to_file(const char *filename)
Checks if any directories in the given path doesn't exist, and creates if necessary.
static void fix_exits_for_map(struct_map_info *current, struct_map_list *from, int is_from)
Changes for the list all maps to the tiled map they are part of, if applicable.
Account_Chars * account_char_load(const char *account_name)
For a given account name, load the character information and return it.
sstring name
More definite name, like "generate_kobold".
const char * name
NPC's name.
uint32_t nrof
Number of objects.
static std::vector< std::string > split(const std::string &field, const std::string &by)
uint32_t reset_time
Server time when map gets reset, seconds since epoch.
static void do_help(const char *program)
Prints usage information, and exit.
living stats
Str, Con, Dex, etc.
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
This is one artifact, ie one special item.
#define FLAG_IDENTIFIED
Item is identifiable (e.g.
int calc_item_power(const object *op)
This takes an object 'op' and figures out what its item_power rating should be.
static void write_world_info(void)
Writes the exit information world map.
static int tiled_map_need_pic(struct_map_info *map)
Information about one face set.
static int map_limit
Maximum number of maps to browse, -1 for all.
static struct_quest ** quests
All quests in the game.
void account_char_save(Account_Chars *chars)
Saves the character information for the given account.
static void fix_tiled_map(void)
Ensures all tiled maps have a name, a region, a filename and a path.
output_format_type
Map output formats.
static int pics_allocated
Number of created pictures for GD.
One special item (weapon, shield, ...).
face_info * faces
images in this faceset
Contains the base information we use to make up a packet we want to send.
MoveType move_block
What movement types this blocks.
static std::vector< char * > found_maps
Maps found in directories.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
static struct_map_info * find_map_by_key(const std::string &key)
Get the map with the specified key, nullptr if not found.
static int warn_no_path
Whether to warn of exits without a path.
static struct_quest * find_quest_info(const char *name)
Gets the information for a quest if it exists.
@ DETECTOR
peterm: detector is an object which notices the presense of another object and is triggered like butt...
static void find_maps(const char *from)
Recursively find all all maps in a directory.
char * slaying
Slaying value.
static int is_road(object *item)
Checks if object is considered a road or not.
static int elevation_min
Maximal elevation found.
static int color_linked_exit
Exit leading to another map.
static bool sort_equipment(const struct_equipment *l, const struct_equipment *r)
Sort 2 struct_equipment.
static void add_one_item(object *item, struct_map_info *map)
Adds an item to the list of special items.
void account_logout(const char *account_name)
Remove 'account_name' from the list of logged in accounts.
std::string output_name
Output file name.
object * identify(object *op)
Identifies an item.