+ while (1)
+ {
+ struct yx_uint16 pos = find_passable_pos(world->map);
+ struct MapObj * mo_ptr;
+ uint8_t clear = 1;
+ for (mo_ptr = world->map_objs;
+ mo_ptr != NULL;
+ mo_ptr = mo_ptr->next)
+ {
+ if (yx_uint16_cmp(&pos, &mo_ptr->pos) && 0 != mo_ptr->lifepoints)
+ {
+ clear = 0;
+ break;
+ }
+ }
+ if (1 == clear)
+ {
+ mo->pos = pos;
+ break;
+ }
+ }
+ mo->next = NULL;
+ struct MapObj ** last_ptr_ptr = &world->map_objs;
+ struct MapObj * mo_ptr;
+ while (NULL != * last_ptr_ptr)
+ {
+ mo_ptr = * last_ptr_ptr;
+ last_ptr_ptr = & mo_ptr->next;
+ }
+ * last_ptr_ptr = mo;