61 if (strcmp(ob->
arch->
name,
"rune_mark") == 0)
71 switch (new_item->
type) {
115 while (rune && ((rune->
type !=
SIGN) || (strcmp(rune->
arch->
name,
"rune_mark"))))
135 while (book && (book->
type !=
BOOK))
156 while (wall && (wall->
type !=
WALL))
210 "You need to put a book or scroll with the message.", NULL);
257 while (itest++ < 1000) {
258 connected = 1+rand()%20000;
297 if (!rune || !rune->
msg) {
299 "You need to put a marking rune with the group name.", NULL);
306 force = force->
below;
312 if (connected == -1) {
314 "Could not create more groups.", NULL);
354 struct archt *new_arch;
366 strncpy(archetype, wall->
arch->
name,
sizeof(archetype));
368 underscore = strchr(archetype,
'_');
373 if (!strcmp(underscore+1,
"win1"))
375 else if (!strcmp(underscore+1,
"win2"))
377 else if (!isdigit(*(underscore+1)))
382 len =
sizeof(
archetype)-strlen(archetype)-2;
386 if ((x > 0) &&
get_wall(map, x-1, y))
390 if ((y > 0) &&
get_wall(map, x, y-1))
397 strncat(archetype,
"0", len);
401 strncat(archetype,
"1_3", len);
405 strncat(archetype,
"1_4", len);
410 strncat(archetype,
"win2", len);
412 strncat(archetype,
"2_1_2", len);
417 strncat(archetype,
"1_2", len);
421 strncat(archetype,
"2_2_4", len);
425 strncat(archetype,
"2_2_1", len);
429 strncat(archetype,
"3_1", len);
433 strncat(archetype,
"1_1", len);
437 strncat(archetype,
"2_2_3", len);
441 strncat(archetype,
"2_2_2", len);
445 strncat(archetype,
"3_3", len);
450 strncat(archetype,
"win1", len);
452 strncat(archetype,
"2_1_1", len);
457 strncat(archetype,
"3_4", len);
461 strncat(archetype,
"3_2", len);
465 strncat(archetype,
"4", len);
472 if (!strncmp(archetype, wall->
arch->
name,
sizeof(archetype)))
486 for (flag = 0; flag < 4; flag++)
487 old_flags[flag] = wall->
flags[flag];
494 for (flag = 0; flag < 4; flag++)
495 wall->
flags[flag] = old_flags[flag];
523 struct archt *new_wall;
524 int i, xt, yt, wall_removed;
527 snprintf(message,
sizeof(message),
"You change the floor to better suit your tastes.");
544 new_wall = tmp->
arch;
547 snprintf(message,
sizeof(message),
"You destroy the wall and redo the floor.");
564 if (wall_removed == 0 && floor != NULL) {
565 if (floor->
arch == new_floor->
arch) {
588 for (i = 1; i <= 8; i++) {
616 for (xt = x-2; xt <= x+2; xt++)
617 for (yt = y-2; yt <= y+2; yt++) {
645 object *current_wall;
653 char current_basename[
MAX_BUF];
658 strncpy(current_basename, current_wall->
arch->
name,
sizeof(current_basename));
659 current_basename[
sizeof(current_basename)-1] =
'\0';
660 underscore = strchr(current_basename,
'_');
661 if (underscore && isdigit(*(underscore+1))) {
665 strncpy(new_basename, new_wall->
arch->
name,
sizeof(new_basename));
666 new_basename[
sizeof(new_basename)-1] =
'\0';
667 underscore = strchr(new_basename,
'_');
668 if (underscore && isdigit(*(underscore+1))) {
672 if (!strncmp(current_basename, new_basename,
sizeof(new_basename))) {
679 snprintf(message,
sizeof(message),
"You build a wall.");
688 snprintf(message,
sizeof(message),
"You redecorate the wall to better suit your tastes.");
694 for (xt = x-1; xt <= x+1; xt++)
695 for (yt = y-1; yt <= y+1; yt++) {
725 object *current_wall;
727 struct archt *new_arch;
740 strncpy(archetype, current_wall->
arch->
name,
sizeof(archetype));
742 underscore = strchr(archetype,
'_');
746 if (!strcmp(underscore,
"win1")
747 || !strcmp(underscore,
"win2")) {
751 if (!strcmp(underscore,
"2_1_1"))
752 strcpy(underscore,
"win1");
753 else if (!strcmp(underscore,
"2_1_2"))
754 strcpy(underscore,
"win2");
763 "There is no wall there.", NULL);
777 for (flag = 0; flag < 4; flag++)
778 old_flags[flag] = current_wall->
flags[flag];
785 for (flag = 0; flag < 4; flag++)
786 window->
flags[flag] = old_flags[flag];
830 floor = floor->
above;
834 "This square has no floor, you can't build here.", NULL);
849 switch (new_item->
type) {
864 if (connected == -1) {
879 if (con_rune != NULL) {
920 "Invalid square.", NULL);
921 LOG(
llevError,
"apply_builder_remove: (null) square at (%d, %d, %s)\n", x, y, pl->
map->
path);
930 "Nothing to remove.", NULL);
935 switch (item->
type) {
938 "Can't remove a wall with that, build a floor.", NULL);
988 "You can't build or destroy under yourself.", NULL);
995 if ((1 > x) || (1 > y)
998 "Can't build on map edge.", NULL);
1012 LOG(
llevError,
"apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, pl->
map->
path);
1014 "You'd better not build here, it looks weird.", NULL);
1025 "You can't build here.", NULL);
1042 struct archt *new_arch;
1051 "You need to mark raw materials to use.", NULL);
1057 "You can't use the marked item to build.", NULL);
1065 "You can't use this strange material.", NULL);
1074 "You can't build here.", NULL);
1098 "Don't know how to apply this material, sorry.", NULL);
1109 "Don't know how to apply this tool, sorry.", NULL);
static int apply_builder_wall(object *pl, object *new_wall, short x, short y)
archetype * find_archetype(const char *name)
#define INS_BELOW_ORIGINATOR
static object * get_connection_rune(object *pl, short x, short y)
sstring add_refcount(sstring str)
static void remove_marking_runes(struct mapdef *map, short x, short y)
static object * get_msg_book(object *pl, short x, short y)
object * insert_ob_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int 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]
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
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_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
short freearr_y[SIZEOFFREE]
#define MSG_TYPE_APPLY_BUILD
static int apply_builder_window(object *pl, object *new_wall_win, short x, short y)
void remove_ob(object *op)
object * create_archetype(const char *name)
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 * insert_ob_in_ob(object *op, object *where)
object * object_create_arch(archetype *at)
static int apply_builder_floor(object *pl, object *new_floor, short x, short y)
int snprintf(char *dest, int max, const char *format,...)
void apply_map_builder(object *pl, int dir)
static int find_unused_connected_value(struct mapdef *map)
#define FLAG_IS_BUILDABLE
static int can_build_over(struct mapdef *map, object *new_item, short x, short y)
void update_ob_speed(object *op)
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,...)
void query_name(const object *op, char *buf, size_t size)
void free_object(object *ob)
object * arch_to_object(archetype *at)
void apply_builder_remove(object *pl, int dir)