37 fprintf(stderr,
"Reading parameters from stdin...\n");
40 memset(&rp, 0,
sizeof(
RMParms));
63 for (j = 0; j < height; ++j) {
64 for (i = 0; i < width; ++i) {
66 display_char = layout[i][j];
68 switch (display_char) {
77 putchar(display_char);
86 char **(*func)(int, int, int, int);
113 static void test_layout(
int width,
int height,
char **(*layout_func)(
int,
int,
int,
int)) {
118 if (layout_func == NULL)
121 layout = layout_func(width, height, 0, 0);
129 fprintf(stderr,
"Type 'random_map -h' for usage instructions.\n");
135 "Usage: random_map [options]\n" 138 " -h display this help message\n" 139 " -g <file> randomly generate the specified map file\n" 140 " -l <layout> layout to use. See Layouts for valid layouts.\n" 141 " (overridden by -g)\n" 142 " -t test map layout (overriden by -g)\n" 143 " -x <width> specify map width\n" 144 " -y <height> specify map height\n" 147 " rogue -- roguelike map generator\n" 148 " snake -- snake map generator\n" 149 " sspiral -- square spiral map generator\n" 150 " spiral -- spiral map generator\n" 151 " maze -- maze map generator\n" 152 " onion -- onion map generator\n" 156 int main(
int argc,
char *argv[]) {
157 int flag, mode = 0, width = 80, height = 23;
158 char *filename_out=NULL;
164 while ((flag = getopt(argc, argv,
"g:hl:tx:y:")) != -1) {
168 filename_out = optarg;
177 if (strcmp(optarg, layout_list[i].
name) == 0)
185 width = atoi(optarg);
188 height = atoi(optarg);
200 }
else if (mode == 2) {
269 while ((tmp->stats.hp--) > 0) {
276 && tmp->randomitems) {
279 while ((tmp->stats.hp--) > 0) {
309 uint8_t subtype,
const char *message) {
315 fprintf(
logfile,
"%s\n", message);
319 uint8_t subtype,
const char *format, ...) {
328 va_start(ap, format);
340 fprintf(
logfile,
"ext_info_map: %s\n", str1);
#define FLAG_DAMNED
The object is very cursed.
#define FLAG_UNPAID
Object hasn't been paid for yet.
void esrv_update_spells(player *pl)
void ext_info_map(int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
FILE * logfile
Used by server/daemon.c.
void init_readable(void)
Initialize linked lists utilized by message functions in tailor_readable_ob()
int save_map(mapstruct *m, int flag)
Saves a map to file.
char ** map_gen_spiral(int xsize, int ysize, int option, int _unused_layers)
Generates a spiral layout.
int apply_auto(object *op)
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
void init_library(void)
It is vital that init_library() is called by any functions using this library.
Random map related variables.
#define MAP_HEIGHT(m)
Map height.
static void print_quickhelp(void)
Print a message stating how to get help.
int16_t y
Position in the map for this object.
static void generate_map(char *OutFileName)
Global type definitions and header inclusions.
void init_globals(void)
Initialises all global variables.
void rod_adjust(object *rod)
static void print_usage(void)
Print out usage information.
void set_darkness_map(mapstruct *m)
static void print_map(char **layout, int width, int height)
Print the human-readable layout of a map.
char ** roguelike_layout_gen(int xsize, int ysize, int options, int _unused_layers)
Actually make the rogue layout.
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
object * identify(object *op)
Identifies an item.
void esrv_del_item(player *pl, object *ob)
#define QUERY_FLAG(xyz, p)
char ** make_square_spiral_layout(int xsize, int ysize, int _unused_options, int _unused_layers)
Generates a square-spiral layout.
char ** maze_gen(int xsize, int ysize, int option, int _unused_layers)
This function generates a random blocked maze with the property that there is only one path from one ...
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
static layout layout_list[NROFLAYOUTS]
void esrv_send_item(object *ob, object *obx)
void set_map_timeout(mapstruct *oldmap)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
void emergency_save(int x)
object * find_skill_by_number(object *who, int skillno)
int main(int argc, char *argv[])
living stats
Str, Con, Dex, etc.
#define SAVE_MODE_INPLACE
Map is saved from where it was loaded.
struct mapstruct * map
Pointer to the map in which this object is present.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
static const flag_definition flags[]
Flag mapping.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
void esrv_update_item(int flags, object *pl, object *op)
#define FLAG_CURSED
The object is cursed.
struct treasurelist * randomitems
Items to be generated.
#define FLAG_AUTO_APPLY
Will be applied when created.
int load_parameters(FILE *fp, int bufstate, RMParms *RP)
static event_registration m
object * generate_treasure(treasurelist *t, int difficulty)
Generate a treasure from a list generating a single item.
void apply_auto_fix(mapstruct *m)
void clean_tmp_files(void)
#define MAP_WIDTH(m)
Map width.
#define CLEAR_FLAG(xyz, p)
uint8_t type
PLAYER, BULLET, etc.
void move_firewall(object *ob)
void init_gods(void)
This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD...
char ** map_gen_onion(int xsize, int ysize, int option, int layers)
Generates an onion layout.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
uint16_t difficulty
What level the player should be to play here.
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...
char **(* func)(int, int, int, int)
void dragon_ability_gain(object *ob, int x, int y)
static void test_layout(int width, int height, char **(*layout_func)(int, int, int, int))
Test the map layout produced by the specified generator.
char ** make_snake_layout(int xsize, int ysize, int _unused_options, int _unused_layers)
Generate a snake-like layout.
#define HAS_RANDOM_ITEMS(op)
This return TRUE if object has still randomitems which could be expanded.
mapstruct * generate_random_map(const char *OutFileName, RMParms *RP, char **use_layout, sstring reset_group)
Main random map routine.