version 1.18 | | version 1.19 |
---|
| | |
| | |
/* | | /* |
* static char *rcsid_item_c = | | * static char *rcsid_item_c = |
* "$Id: item.c,v 1.18 2001/08/29 07:14:16 mwedel Exp $"; | | * "$Id: item.c,v 1.19 2001/10/30 00:49:03 michtoen Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
len=strlen(buf); | | len=strlen(buf); |
if (len>255) len=255; | | if (len>255) len=255; |
SockList_AddChar(sl, len); | | SockList_AddChar(sl, (char) len); |
strncpy((char*)sl->buf+sl->len, buf,len); | | strncpy((char*)sl->buf+sl->len, buf,len); |
sl->len += len; | | sl->len += len; |
} | | } |
| | |
strncpy(item_n+len+1, item_p, 127); | | strncpy(item_n+len+1, item_p, 127); |
item_n[254]=0; | | item_n[254]=0; |
len += strlen(item_n+1+len) + 1; | | len += strlen(item_n+1+len) + 1; |
SockList_AddChar(&sl, len); | | SockList_AddChar(&sl, (char ) len); |
memcpy(sl.buf+sl.len, item_n, len); | | memcpy(sl.buf+sl.len, item_n, len); |
sl.len += len; | | sl.len += len; |
} else | | } else |
| | |
else { | | else { |
if (FABS(tmp->speed)<0.001) anim_speed=255; | | if (FABS(tmp->speed)<0.001) anim_speed=255; |
else if (FABS(tmp->speed)>=1.0) anim_speed=1; | | else if (FABS(tmp->speed)>=1.0) anim_speed=1; |
else anim_speed = (1.0/FABS(tmp->speed)); | | else anim_speed = (int) (1.0/FABS(tmp->speed)); |
} | | } |
if (anim_speed>255) anim_speed=255; | | if (anim_speed>255) anim_speed=255; |
} | | } |
SockList_AddChar(&sl, anim_speed); | | SockList_AddChar(&sl, (char) anim_speed); |
SockList_AddInt(&sl, tmp->nrof); | | SockList_AddInt(&sl, tmp->nrof); |
SET_FLAG(tmp, FLAG_CLIENT_SENT); | | SET_FLAG(tmp, FLAG_CLIENT_SENT); |
got_one++; | | got_one++; |
| | |
strncpy(item_n+len+1, item_p, 127); | | strncpy(item_n+len+1, item_p, 127); |
item_n[254]=0; | | item_n[254]=0; |
len += strlen(item_n+1+len) + 1; | | len += strlen(item_n+1+len) + 1; |
SockList_AddChar(&sl, len); | | SockList_AddChar(&sl, (char) len); |
memcpy(sl.buf+sl.len, item_n, len); | | memcpy(sl.buf+sl.len, item_n, len); |
sl.len += len; | | sl.len += len; |
} else | | } else |
| | |
else { | | else { |
if (FABS(tmp->speed)<0.001) anim_speed=255; | | if (FABS(tmp->speed)<0.001) anim_speed=255; |
else if (FABS(tmp->speed)>=1.0) anim_speed=1; | | else if (FABS(tmp->speed)>=1.0) anim_speed=1; |
else anim_speed = (1.0/FABS(tmp->speed)); | | else anim_speed = (int) (1.0/FABS(tmp->speed)); |
} | | } |
if (anim_speed>255) anim_speed=255; | | if (anim_speed>255) anim_speed=255; |
} | | } |
SockList_AddChar(&sl, anim_speed); | | SockList_AddChar(&sl, (char)anim_speed); |
SockList_AddInt(&sl, tmp->nrof); | | SockList_AddInt(&sl, tmp->nrof); |
SET_FLAG(tmp, FLAG_CLIENT_SENT); | | SET_FLAG(tmp, FLAG_CLIENT_SENT); |
got_one++; | | got_one++; |
| | |
strcpy((char*)sl.buf,"upditem "); | | strcpy((char*)sl.buf,"upditem "); |
sl.len=strlen((char*)sl.buf); | | sl.len=strlen((char*)sl.buf); |
| | |
SockList_AddChar(&sl, flags); | | SockList_AddChar(&sl, (char) flags); |
SockList_AddInt(&sl, op->count); | | SockList_AddInt(&sl, op->count); |
| | |
if (flags & UPD_LOCATION) | | if (flags & UPD_LOCATION) |
| | |
strncpy(item_n+len+1, item_p, 127); | | strncpy(item_n+len+1, item_p, 127); |
item_n[254]=0; | | item_n[254]=0; |
len += strlen(item_n+1+len) + 1; | | len += strlen(item_n+1+len) + 1; |
SockList_AddChar(&sl, len); | | SockList_AddChar(&sl, (char)len); |
memcpy(sl.buf+sl.len, item_n, len); | | memcpy(sl.buf+sl.len, item_n, len); |
sl.len += len; | | sl.len += len; |
} else | | } else |
| | |
else { | | else { |
if (FABS(op->speed)<0.001) anim_speed=255; | | if (FABS(op->speed)<0.001) anim_speed=255; |
else if (FABS(op->speed)>=1.0) anim_speed=1; | | else if (FABS(op->speed)>=1.0) anim_speed=1; |
else anim_speed = (1.0/FABS(op->speed)); | | else anim_speed = (int) (1.0/FABS(op->speed)); |
} | | } |
if (anim_speed>255) anim_speed=255; | | if (anim_speed>255) anim_speed=255; |
} | | } |
SockList_AddChar(&sl, anim_speed); | | SockList_AddChar(&sl, (char)anim_speed); |
} | | } |
if (flags & UPD_NROF) | | if (flags & UPD_NROF) |
SockList_AddInt(&sl, op->nrof); | | SockList_AddInt(&sl, op->nrof); |
| | |
strncpy(item_n+len+1, item_p, 127); | | strncpy(item_n+len+1, item_p, 127); |
item_n[254]=0; | | item_n[254]=0; |
len += strlen(item_n+1+len) + 1; | | len += strlen(item_n+1+len) + 1; |
SockList_AddChar(&sl, len); | | SockList_AddChar(&sl, (char)len); |
memcpy(sl.buf+sl.len, item_n, len); | | memcpy(sl.buf+sl.len, item_n, len); |
sl.len += len; | | sl.len += len; |
} else | | } else |
| | |
else { | | else { |
if (FABS(op->speed)<0.001) anim_speed=255; | | if (FABS(op->speed)<0.001) anim_speed=255; |
else if (FABS(op->speed)>=1.0) anim_speed=1; | | else if (FABS(op->speed)>=1.0) anim_speed=1; |
else anim_speed = (1.0/FABS(op->speed)); | | else anim_speed = (int) (1.0/FABS(op->speed)); |
} | | } |
if (anim_speed>255) anim_speed=255; | | if (anim_speed>255) anim_speed=255; |
} | | } |
SockList_AddChar(&sl, anim_speed); | | SockList_AddChar(&sl, (char)anim_speed); |
SockList_AddInt(&sl, op->nrof); | | SockList_AddInt(&sl, op->nrof); |
Send_With_Handling(&pl->contr->socket, &sl); | | Send_With_Handling(&pl->contr->socket, &sl); |
SET_FLAG(op, FLAG_CLIENT_SENT); | | SET_FLAG(op, FLAG_CLIENT_SENT); |
| | |
* pointer, or null if it can't be found. | | * pointer, or null if it can't be found. |
*/ | | */ |
| | |
object *esrv_get_ob_from_count(object *pl, long count) | | object *esrv_get_ob_from_count(object *pl, tag_t count) |
{ | | { |
object *op, *tmp; | | object *op, *tmp; |
| | |
| | |
| | |
/* Move an object to a new lcoation */ | | /* Move an object to a new lcoation */ |
| | |
void esrv_move_object (object *pl, long to, long tag, long nrof) | | void esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof) |
{ | | { |
object *op, *env; | | object *op, *env; |
| | |