mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-22 18:20:13 +01:00
Bug-Fix: Furniture fixes for removed furniture, and sitter counts (Thanks MTFox)
This commit is contained in:
parent
5e3ffd750b
commit
6ddc788b1b
2 changed files with 48 additions and 40 deletions
|
|
@ -696,6 +696,7 @@ void obj_to_room(struct obj_data *object, room_rnum room)
|
||||||
void obj_from_room(struct obj_data *object)
|
void obj_from_room(struct obj_data *object)
|
||||||
{
|
{
|
||||||
struct obj_data *temp;
|
struct obj_data *temp;
|
||||||
|
struct char_data *t, *tempch;
|
||||||
|
|
||||||
if (!object || IN_ROOM(object) == NOWHERE) {
|
if (!object || IN_ROOM(object) == NOWHERE) {
|
||||||
log("SYSERR: NULL object (%p) or obj not in a room (%d) passed to obj_from_room",
|
log("SYSERR: NULL object (%p) or obj not in a room (%d) passed to obj_from_room",
|
||||||
|
|
@ -703,6 +704,15 @@ void obj_from_room(struct obj_data *object)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if people are sitting in it, toss their butt to the ground */
|
||||||
|
if (OBJ_SAT_IN_BY(object) != NULL) {
|
||||||
|
for (tempch = OBJ_SAT_IN_BY(object); tempch; tempch = t) {
|
||||||
|
t = NEXT_SITTING(tempch);
|
||||||
|
SITTING(tempch) = NULL;
|
||||||
|
NEXT_SITTING(tempch) = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
REMOVE_FROM_LIST(object, world[IN_ROOM(object)].contents, next_content);
|
REMOVE_FROM_LIST(object, world[IN_ROOM(object)].contents, next_content);
|
||||||
|
|
||||||
if (ROOM_FLAGGED(IN_ROOM(object), ROOM_HOUSE))
|
if (ROOM_FLAGGED(IN_ROOM(object), ROOM_HOUSE))
|
||||||
|
|
|
||||||
28
src/utils.c
28
src/utils.c
|
|
@ -893,7 +893,6 @@ void char_from_furniture(struct char_data *ch)
|
||||||
{
|
{
|
||||||
struct obj_data *furniture;
|
struct obj_data *furniture;
|
||||||
struct char_data *tempch;
|
struct char_data *tempch;
|
||||||
int i, found = 0;
|
|
||||||
|
|
||||||
if (!SITTING(ch))
|
if (!SITTING(ch))
|
||||||
return;
|
return;
|
||||||
|
|
@ -909,34 +908,33 @@ void char_from_furniture(struct char_data *ch)
|
||||||
log("SYSERR: Char from furniture, but no furniture!");
|
log("SYSERR: Char from furniture, but no furniture!");
|
||||||
SITTING(ch) = NULL;
|
SITTING(ch) = NULL;
|
||||||
NEXT_SITTING(ch) = NULL;
|
NEXT_SITTING(ch) = NULL;
|
||||||
|
GET_OBJ_VAL(furniture, 1) = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tempch == ch){
|
if (tempch == ch){
|
||||||
if (!NEXT_SITTING(ch))
|
if (!NEXT_SITTING(ch)) {
|
||||||
OBJ_SAT_IN_BY(furniture) = NULL;
|
OBJ_SAT_IN_BY(furniture) = NULL;
|
||||||
else
|
} else {
|
||||||
OBJ_SAT_IN_BY(furniture) = NEXT_SITTING(ch);
|
OBJ_SAT_IN_BY(furniture) = NEXT_SITTING(ch);
|
||||||
GET_OBJ_VAL(furniture, 1) -= 1;
|
|
||||||
SITTING(ch) = NULL;
|
|
||||||
NEXT_SITTING(ch) = NULL;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
for (i = 0; i < GET_OBJ_VAL(furniture, 1) && found == 0; i++){
|
for (tempch = OBJ_SAT_IN_BY(furniture); tempch; tempch = NEXT_SITTING(tempch)) {
|
||||||
if (NEXT_SITTING(tempch) != ch){
|
if (NEXT_SITTING(tempch) == ch) {
|
||||||
NEXT_SITTING(tempch) = NEXT_SITTING(ch);
|
NEXT_SITTING(tempch) = NEXT_SITTING(ch);
|
||||||
found++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found)
|
}
|
||||||
log("SYSERR: Char flagged as sitting, but not in furniture.");
|
|
||||||
else
|
|
||||||
GET_OBJ_VAL(furniture, 1) -= 1;
|
GET_OBJ_VAL(furniture, 1) -= 1;
|
||||||
|
|
||||||
SITTING(ch) = NULL;
|
SITTING(ch) = NULL;
|
||||||
NEXT_SITTING(ch) = NULL;
|
NEXT_SITTING(ch) = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
if (GET_OBJ_VAL(furniture, 1) < 1){
|
||||||
|
OBJ_SAT_IN_BY(furniture) = NULL;
|
||||||
|
GET_OBJ_VAL(furniture, 1) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue