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.");
200 if (custom_name != NULL) {
201 snprintf(buf,
sizeof(buf),
"talking %s", custom_name);
203 snprintf(buf,
sizeof(buf),
"talking %s", book->
name);
210 snprintf(buf2,
sizeof(buf2),
"talking %s", book->
name_pl);
239 while (itest++ < 1000) {
240 connected = 1+rand()%20000;
279 if (!rune || !rune->
msg) {
281 "You need to put a marking rune with the group name.");
288 if (tmp->type ==
FORCE 289 && tmp->slaying != NULL && strcmp(tmp->slaying, pl->
map->
path) == 0
290 && tmp->msg != NULL && tmp->msg == rune->
msg) {
300 if (connected == -1) {
302 "Could not create more groups.");
341 uint32_t old_flags[4];
342 struct archetype *new_arch;
354 strncpy(archetype, wall->
arch->
name,
sizeof(archetype));
355 archetype[
sizeof(archetype)-1] =
'\0';
356 underscore = strchr(archetype,
'_');
361 if (!strcmp(underscore+1,
"win1"))
363 else if (!strcmp(underscore+1,
"win2"))
365 else if (!isdigit(*(underscore+1)))
370 len =
sizeof(archetype)-strlen(archetype)-2;
374 if ((x > 0) &&
get_wall(map, x-1, y))
378 if ((y > 0) &&
get_wall(map, x, y-1))
385 strncat(archetype,
"0", len);
389 strncat(archetype,
"1_3", len);
393 strncat(archetype,
"1_4", len);
398 strncat(archetype,
"win2", len);
400 strncat(archetype,
"2_1_2", len);
405 strncat(archetype,
"1_2", len);
409 strncat(archetype,
"2_2_4", len);
413 strncat(archetype,
"2_2_1", len);
417 strncat(archetype,
"3_1", len);
421 strncat(archetype,
"1_1", len);
425 strncat(archetype,
"2_2_3", len);
429 strncat(archetype,
"2_2_2", len);
433 strncat(archetype,
"3_3", len);
438 strncat(archetype,
"win1", len);
440 strncat(archetype,
"2_1_1", len);
445 strncat(archetype,
"3_4", len);
449 strncat(archetype,
"3_2", len);
453 strncat(archetype,
"4", len);
460 if (!strncmp(archetype, wall->
arch->
name,
sizeof(archetype)))
474 for (flag = 0; flag < 4; flag++)
475 old_flags[flag] = wall->
flags[flag];
482 for (flag = 0; flag < 4; flag++)
483 wall->
flags[flag] = old_flags[flag];
511 int i, xt, yt, wall_removed;
514 snprintf(message,
sizeof(message),
"You change the floor to better suit your tastes.");
525 if (
WALL == tmp->type) {
527 new_wall = tmp->arch;
530 snprintf(message,
sizeof(message),
"You destroy the wall and redo the floor.");
545 if (wall_removed == 0 && floor != NULL) {
546 if (floor->
arch == new_floor->
arch) {
569 for (i = 1; i <= 8; i++) {
599 for (xt = x-2; xt <= x+2; xt++)
600 for (yt = y-2; yt <= y+2; yt++) {
628 object *current_wall;
636 char current_basename[
MAX_BUF];
641 strncpy(current_basename, current_wall->
arch->
name,
sizeof(current_basename));
642 current_basename[
sizeof(current_basename)-1] =
'\0';
643 underscore = strchr(current_basename,
'_');
644 if (underscore && isdigit(*(underscore+1))) {
648 strncpy(new_basename, new_wall->
arch->
name,
sizeof(new_basename));
649 new_basename[
sizeof(new_basename)-1] =
'\0';
650 underscore = strchr(new_basename,
'_');
651 if (underscore && isdigit(*(underscore+1))) {
655 if (!strncmp(current_basename, new_basename,
sizeof(new_basename))) {
662 snprintf(message,
sizeof(message),
"You build a wall.");
671 snprintf(message,
sizeof(message),
"You redecorate the wall to better suit your tastes.");
677 for (xt = x-1; xt <= x+1; xt++)
678 for (yt = y-1; yt <= y+1; yt++) {
708 object *current_wall;
710 struct archetype *new_arch;
712 uint32_t old_flags[4];
723 strncpy(archetype, current_wall->
arch->
name,
sizeof(archetype));
724 archetype[
sizeof(archetype)-1] =
'\0';
725 underscore = strchr(archetype,
'_');
729 if (!strcmp(underscore,
"win1")
730 || !strcmp(underscore,
"win2")) {
734 if (!strcmp(underscore,
"2_1_1"))
735 strcpy(underscore,
"win1");
736 else if (!strcmp(underscore,
"2_1_2"))
737 strcpy(underscore,
"win2");
746 "There is no wall there.");
760 for (flag = 0; flag < 4; flag++)
761 old_flags[flag] = current_wall->
flags[flag];
768 for (flag = 0; flag < 4; flag++)
769 window->
flags[flag] = old_flags[flag];
818 "This square has no floor, you can't build here.");
833 switch (new_item->
type) {
848 if (connected == -1) {
863 if (con_rune != NULL) {
904 LOG(
llevError,
"apply_builder_remove: (null) square at (%d, %d, %s)\n", x, y, pl->
map->
path);
913 "Nothing to remove.");
918 switch (item->
type) {
921 "Can't remove a wall with that, build a floor.");
970 "You can't build or destroy under yourself.");
977 if ((1 > x) || (1 > y)
980 "Can't build on map edge.");
994 LOG(
llevError,
"apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, pl->
map->
path);
996 "You'd better not build here, it looks weird.");
1007 "You can't build here.");
1032 "You need to mark raw materials to use.");
1038 "You can't use the marked item to build.");
1052 "You can't use this strange material.");
1061 "You can't build here.");
1085 "Don't know how to apply this material, sorry.");
1096 "Don't know how to apply this tool, sorry.");
object * ranges[range_size]
Object for each range.
#define FLAG_UNPAID
Object hasn't been paid for yet.
#define FLAG_IS_LINKED
The object is linked with other objects.
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
Spell-related defines: spellpath, subtypes, ...
struct archetype * arch
Pointer to archetype.
#define FLAG_IS_BUILDABLE
Can build on item.
#define FOR_OB_AND_ABOVE_PREPARE(op_)
Constructs a loop iterating over an object and all objects above it in the same pile.
static int find_or_create_connection_for_map(object *pl, short x, short y, object *rune)
Helper function for door/button/connected item building.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
Defines for the ingame clock, ticks management and weather system.
oblinkpt * next
Next value in the list.
static object * get_connection_rune(object *pl, short x, short y)
Returns the marking rune on the square, for purposes of building connections.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
static void remove_marking_runes(mapstruct *map, short x, short y)
Erases all marking runes at specified location (before building a wall)
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
archetype * find_archetype(const char *name)
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
object * more
Pointer to the rest of a large body of objects.
sstring slaying
Which race to do double damage to.
sstring add_string(const char *str)
Share a string.
#define MAP_HEIGHT(m)
Map height.
object * above
Pointer to the object stacked above this one.
#define ST_MAT_ITEM
Most other items, including doors & such.
int16_t y
Position in the map for this object.
void apply_builder_remove(object *pl, int dir)
Item remover.
#define OUT_OF_REAL_MAP(M, X, Y)
Checks if a square is out of the map.
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
oblinkpt * buttons
Linked list of linked lists of buttons.
long value
Used as connected value in buttons/gates.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
peterm: detector is an object which notices the presense of another object and is triggered like butt...
#define ST_MAT_WINDOW
Window.
#define MSG_TYPE_APPLY
Applying objects.
archetype * try_find_archetype(const char *name)
Used to link together several object links.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
Floor tile -> native layer 0.
#define ST_BD_BUILD
Builds an item.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
#define FOR_OB_AND_ABOVE_FINISH()
Finishes FOR_OB_AND_ABOVE_PREPARE().
sstring name
More definite name, like "generate_kobold".
#define ST_MAT_FLOOR
Floor.
#define INS_ON_TOP
Always put object on top.
float speed
Frequency of object 'moves' relative to server tick rate.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
char path[HUGE_BUF]
Filename of the map.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
static bool IS_PLAYER(object *op)
#define QUERY_FLAG(xyz, p)
void query_name(const object *op, char *buf, size_t size)
Describes an item.
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.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
sstring msg
If this is a book/sign/magic mouth/etc.
ob_flags flags
Various flags.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
const Face * face
Face with colors.
void apply_map_builder(object *pl, int dir)
Global building function.
object * find_marked_object(object *op)
Return the object the player has marked with the 'mark' command below.
#define ST_BD_REMOVE
Removes an item.
static int apply_builder_window(object *pl, object *new_wall_win, short x, short y)
Window building function.
static void fix_walls(mapstruct *map, int x, int y)
Fixes walls around specified spot.
#define HEAD(op)
Returns the head part of an object.
#define INS_ABOVE_FLOOR_ONLY
Put object immediatly above the floor.
#define MAX_BUF
Used for all kinds of things.
int16_t invisible
How much longer the object will be invis.
struct mapstruct * map
Pointer to the map in which this object is present.
Skill-related defines, including subtypes.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
static object * get_msg_book(object *pl, short x, short y)
Returns the book/scroll on the current square, for purposes of building.
object * object_create_arch(archetype *at)
Create a full object using the given archetype.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
static int apply_builder_item(object *pl, object *new_item, short x, short y)
Generic item builder.
static int apply_builder_floor(object *pl, object *new_floor, short x, short y)
Floor building function.
sstring name_pl
The plural name of the object.
static int adjust_sign_msg(object *pl, short x, short y, object *tmp)
Make the built object inherit the msg of books that are used with it.
#define object_decrease_nrof_by_one(xyz)
sstring name
The name of the object, obviously...
#define MAP_WIDTH(m)
Map width.
uint8_t type
PLAYER, BULLET, etc.
void object_update_speed(object *op)
Updates the speed of an object.
#define GET_MAP_OB(M, X, Y)
Gets the bottom object on a map.
#define NDI_UNIQUE
Print immediately, don't buffer.
static int find_unused_connected_value(mapstruct *map)
Returns an unused value for 'connected'.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
static int apply_builder_wall(object *pl, object *new_wall, short x, short y)
Wall building function.
Structure containing object statistics.
uint8_t subtype
Subtype of object.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
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...
#define FLAG_UNIQUE
Item is really unique (UNIQUE_ITEMS)
#define FLAG_NO_PICK
Object can't be picked up.
static object * get_wall(mapstruct *map, int x, int y)
Returns first item of type WALL.
object clone
An object from which to do object_copy()
#define CUSTOM_NAME_FIELD
Key in an object for the player-assigned custom name.
#define MSG_TYPE_APPLY_BUILD
Build related actions.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
static int can_build_over(mapstruct *map, object *new_item, short x, short y)
Check if objects on a square interfere with building.
uint32_t path_attuned
Paths the object is attuned to.