mirror of
https://github.com/tbamud/tbamud.git
synced 2025-09-22 05:50:48 +02:00
Update handler.c
Fixes the display order of objects in obj_to_room(). Objects are now displayed in the order they are placed/dropped. This prevents fountains, boards, etcetera from "moving" around the room.
This commit is contained in:
parent
16a46903e4
commit
3635026433
1 changed files with 16 additions and 8 deletions
|
@ -671,17 +671,25 @@ struct char_data *get_char_num(mob_rnum nr)
|
|||
/* put an object in a room */
|
||||
void obj_to_room(struct obj_data *object, room_rnum room)
|
||||
{
|
||||
if (!object || room == NOWHERE || room > top_of_world)
|
||||
if (!object || room == NOWHERE || room > top_of_world){
|
||||
log("SYSERR: Illegal value(s) passed to obj_to_room. (Room #%d/%d, obj %p)",
|
||||
room, top_of_world, (void *)object);
|
||||
else {
|
||||
object->next_content = world[room].contents;
|
||||
world[room].contents = object;
|
||||
IN_ROOM(object) = room;
|
||||
object->carried_by = NULL;
|
||||
if (ROOM_FLAGGED(room, ROOM_HOUSE))
|
||||
SET_BIT_AR(ROOM_FLAGS(room), ROOM_HOUSE_CRASH);
|
||||
}
|
||||
else {
|
||||
if (world[room].contents == NULL){ // if list is empty
|
||||
world[room].contents = object; // add object to list
|
||||
}
|
||||
else {
|
||||
struct obj_data *i = world[room].contents; // define a temporary pointer
|
||||
while (i->next_content != NULL) i = i->next_content; // find the first without a next_content
|
||||
i->next_content = object; // add object at the end
|
||||
}
|
||||
object->next_content = NULL; // mostly for sanity. should do nothing.
|
||||
IN_ROOM(object) = room
|
||||
object->carried_by = NULL;
|
||||
if (ROOM_FLAGGED(room, ROOM_HOUSE))
|
||||
SET_BIT_AR(ROOM_FLAGS(room), ROOM_HOUSE_CRASH);
|
||||
}
|
||||
}
|
||||
|
||||
/* Take an object from a room */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue