Return objptridx_t from obj_create_copy
This commit is contained in:
parent
599af3e1ba
commit
da8e5459d6
|
@ -663,7 +663,7 @@ objptridx_t obj_create(enum object_type_t type, ubyte id, int segnum, const vms_
|
||||||
ubyte ctype, ubyte mtype, ubyte rtype);
|
ubyte ctype, ubyte mtype, ubyte rtype);
|
||||||
|
|
||||||
// make a copy of an object. returs num of new object
|
// make a copy of an object. returs num of new object
|
||||||
int obj_create_copy(int objnum, vms_vector *new_pos, int newsegnum);
|
objptridx_t obj_create_copy(int objnum, vms_vector *new_pos, int newsegnum);
|
||||||
|
|
||||||
// remove object from the world
|
// remove object from the world
|
||||||
void obj_delete(objptridx_t objnum);
|
void obj_delete(objptridx_t objnum);
|
||||||
|
|
|
@ -1224,18 +1224,13 @@ objptridx_t obj_create(enum object_type_t type, ubyte id,int segnum,const vms_ve
|
||||||
|
|
||||||
#ifdef EDITOR
|
#ifdef EDITOR
|
||||||
//create a copy of an object. returns new object number
|
//create a copy of an object. returns new object number
|
||||||
int obj_create_copy(int objnum, vms_vector *new_pos, int newsegnum)
|
objptridx_t obj_create_copy(int objnum, vms_vector *new_pos, int newsegnum)
|
||||||
{
|
{
|
||||||
int newobjnum;
|
|
||||||
object *obj;
|
|
||||||
|
|
||||||
// Find next free object
|
// Find next free object
|
||||||
newobjnum = obj_allocate();
|
objptridx_t obj = obj_allocate();
|
||||||
|
|
||||||
if (newobjnum == object_none)
|
if (obj == object_none)
|
||||||
return newobjnum;
|
return obj;
|
||||||
|
|
||||||
obj = &Objects[newobjnum];
|
|
||||||
|
|
||||||
*obj = Objects[objnum];
|
*obj = Objects[objnum];
|
||||||
|
|
||||||
|
@ -1244,13 +1239,13 @@ int obj_create_copy(int objnum, vms_vector *new_pos, int newsegnum)
|
||||||
obj->next = obj->prev = object_none;
|
obj->next = obj->prev = object_none;
|
||||||
obj->segnum = segment_none;
|
obj->segnum = segment_none;
|
||||||
|
|
||||||
obj_link(newobjnum,newsegnum);
|
obj_link(obj,newsegnum);
|
||||||
|
|
||||||
obj->signature = obj_get_signature();
|
obj->signature = obj_get_signature();
|
||||||
|
|
||||||
//we probably should initialize sub-structures here
|
//we probably should initialize sub-structures here
|
||||||
|
|
||||||
return newobjnum;
|
return obj;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue