53 if (strcmp(ob->
arch->
name,
"rune_mark") == 0)
63 switch (new_item->
type) {
105 if (rune->type ==
SIGN && strcmp(rune->arch->name,
"rune_mark") == 0)
124 if (book->type ==
BOOK)
144 if (wall->type ==
WALL)
160 if ((rune->type ==
SIGN) && (!strcmp(rune->arch->name,
"rune_mark"))) {
192 "You need to put a book or scroll with the message.");
238 while (itest++ < 1000) {
239 connected = 1+rand()%20000;
278 if (!rune || !rune->
msg) {
280 "You need to put a marking rune with the group name.");
287 if (tmp->type ==
FORCE 288 && tmp->slaying != NULL && strcmp(tmp->slaying, pl->
map->
path) == 0
289 && tmp->msg != NULL && tmp->msg == rune->
msg) {
299 if (connected == -1) {
301 "Could not create more groups.");
341 struct archt *new_arch;
353 strncpy(archetype, wall->
arch->
name,
sizeof(archetype));
355 underscore = strchr(archetype,
'_');
360 if (!strcmp(underscore+1,
"win1"))
362 else if (!strcmp(underscore+1,
"win2"))
364 else if (!isdigit(*(underscore+1)))
369 len =
sizeof(
archetype)-strlen(archetype)-2;
373 if ((x > 0) &&
get_wall(map, x-1, y))
377 if ((y > 0) &&
get_wall(map, x, y-1))
384 strncat(archetype,
"0", len);
388 strncat(archetype,
"1_3", len);
392 strncat(archetype,
"1_4", len);
397 strncat(archetype,
"win2", len);
399 strncat(archetype,
"2_1_2", len);
404 strncat(archetype,
"1_2", len);
408 strncat(archetype,
"2_2_4", len);
412 strncat(archetype,
"2_2_1", len);
416 strncat(archetype,
"3_1", len);
420 strncat(archetype,
"1_1", len);
424 strncat(archetype,
"2_2_3", len);
428 strncat(archetype,
"2_2_2", len);
432 strncat(archetype,
"3_3", len);
437 strncat(archetype,
"win1", len);
439 strncat(archetype,
"2_1_1", len);
444 strncat(archetype,
"3_4", len);
448 strncat(archetype,
"3_2", len);
452 strncat(archetype,
"4", len);
459 if (!strncmp(archetype, wall->
arch->
name,
sizeof(archetype)))
473 for (flag = 0; flag < 4; flag++)
474 old_flags[flag] = wall->
flags[flag];
481 for (flag = 0; flag < 4; flag++)
482 wall->
flags[flag] = old_flags[flag];
509 struct archt *new_wall;
510 int i, xt, yt, wall_removed;
513 snprintf(message,
sizeof(message),
"You change the floor to better suit your tastes.");
524 if (
WALL == tmp->type) {
526 new_wall = tmp->arch;
529 snprintf(message,
sizeof(message),
"You destroy the wall and redo the floor.");
544 if (wall_removed == 0 && floor != NULL) {
545 if (floor->
arch == new_floor->
arch) {
568 for (i = 1; i <= 8; i++) {
598 for (xt = x-2; xt <= x+2; xt++)
599 for (yt = y-2; yt <= y+2; yt++) {
627 object *current_wall;
635 char current_basename[
MAX_BUF];
640 strncpy(current_basename, current_wall->
arch->
name,
sizeof(current_basename));
641 current_basename[
sizeof(current_basename)-1] =
'\0';
642 underscore = strchr(current_basename,
'_');
643 if (underscore && isdigit(*(underscore+1))) {
647 strncpy(new_basename, new_wall->
arch->
name,
sizeof(new_basename));
648 new_basename[
sizeof(new_basename)-1] =
'\0';
649 underscore = strchr(new_basename,
'_');
650 if (underscore && isdigit(*(underscore+1))) {
654 if (!strncmp(current_basename, new_basename,
sizeof(new_basename))) {
661 snprintf(message,
sizeof(message),
"You build a wall.");
670 snprintf(message,
sizeof(message),
"You redecorate the wall to better suit your tastes.");
676 for (xt = x-1; xt <= x+1; xt++)
677 for (yt = y-1; yt <= y+1; yt++) {
707 object *current_wall;
709 struct archt *new_arch;
722 strncpy(archetype, current_wall->
arch->
name,
sizeof(archetype));
724 underscore = strchr(archetype,
'_');
728 if (!strcmp(underscore,
"win1")
729 || !strcmp(underscore,
"win2")) {
733 if (!strcmp(underscore,
"2_1_1"))
734 strcpy(underscore,
"win1");
735 else if (!strcmp(underscore,
"2_1_2"))
736 strcpy(underscore,
"win2");
745 "There is no wall there.");
759 for (flag = 0; flag < 4; flag++)
760 old_flags[flag] = current_wall->
flags[flag];
767 for (flag = 0; flag < 4; flag++)
768 window->
flags[flag] = old_flags[flag];
817 "This square has no floor, you can't build here.");
832 switch (new_item->
type) {
847 if (connected == -1) {
862 if (con_rune != NULL) {
903 LOG(
llevError,
"apply_builder_remove: (null) square at (%d, %d, %s)\n", x, y, pl->
map->
path);
912 "Nothing to remove.");
917 switch (item->
type) {
920 "Can't remove a wall with that, build a floor.");
969 "You can't build or destroy under yourself.");
976 if ((1 > x) || (1 > y)
979 "Can't build on map edge.");
993 LOG(
llevError,
"apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, pl->
map->
path);
995 "You'd better not build here, it looks weird.");
1006 "You can't build here.");
1022 struct archt *new_arch;
1031 "You need to mark raw materials to use.");
1037 "You can't use the marked item to build.");
1051 "You can't use this strange material.");
1060 "You can't build here.");
1084 "Don't know how to apply this material, sorry.");
1095 "Don't know how to apply this tool, sorry.");
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
static int apply_builder_wall(object *pl, object *new_wall, short x, short y)
archetype * find_archetype(const char *name)
#define INS_BELOW_ORIGINATOR
#define FOR_OB_AND_ABOVE_PREPARE(op_)
static object * get_connection_rune(object *pl, short x, short y)
static void remove_marking_runes(struct mapdef *map, short x, short y)
static object * get_msg_book(object *pl, short x, short y)
static int find_or_create_connection_for_map(object *pl, short x, short y, object *rune)
void free_string(sstring str)
short freearr_x[SIZEOFFREE]
object * ranges[range_size]
#define OUT_OF_REAL_MAP(M, X, Y)
static int adjust_sign_msg(object *pl, short x, short y, object *tmp)
static object * get_wall(struct mapdef *map, int x, int y)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
short freearr_y[SIZEOFFREE]
void object_free_drop_inventory(object *ob)
static int apply_builder_window(object *pl, object *new_wall_win, short x, short y)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
object * create_archetype(const char *name)
#define FOR_OB_AND_ABOVE_FINISH()
object * object_insert_in_ob(object *op, object *where)
static bool IS_PLAYER(object *op)
static void fix_walls(struct mapdef *map, int x, int y)
object * find_marked_object(object *op)
#define QUERY_FLAG(xyz, p)
#define INS_ABOVE_FLOOR_ONLY
object * object_create_arch(archetype *at)
static int apply_builder_floor(object *pl, object *new_floor, short x, short y)
void apply_map_builder(object *pl, int dir)
static int find_unused_connected_value(struct mapdef *map)
#define object_decrease_nrof_by_one(xyz)
#define FLAG_IS_BUILDABLE
static int can_build_over(struct mapdef *map, object *new_item, short x, short y)
sstring add_string(const char *str)
static int apply_builder_item(object *pl, object *new_item, short x, short y)
#define GET_MAP_OB(M, X, Y)
void LOG(LogLevel logLevel, const char *format,...)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
void object_set_msg(object *op, const char *msg)
void query_name(const object *op, char *buf, size_t size)
object * arch_to_object(archetype *at)
void object_update_speed(object *op)
#define MSG_TYPE_APPLY_BUILD
#define FOR_INV_PREPARE(op_, it_)
void object_remove(object *op)
void apply_builder_remove(object *pl, int dir)