View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002612 | FSSCP | SEXPs | public | 2012-02-23 23:31 | 2012-12-10 03:21 |
Reporter | haloboy100 | Assigned To | Admiral MS | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
OS | Windows 7 Proffessional 64-bit | ||||
Product Version | 3.6.14 RC5 | ||||
Summary | 0002612: set-object-position doesn't work with waypoints. | ||||
Description | Set-object-position either won't work properly with waypoints (as it lists in its FRED description), or the AI is unable to work with waypoints that change position. If the waypoint is moved at one point in the mission (even before the goal is set for the AI to fly to it), the AI will fly to the waypoint's initial position regardless. | ||||
Steps To Reproduce | See attached mission file for example. | ||||
Tags | No tags attached. | ||||
has duplicate | 0002123 | closed | Goober5000 | Changing a waypoint's position has no effect on ships using that waypoint |
|
|
|
Please change the version of this report to RC5 - I put RC4 by mistake. |
|
I think this issue - at least as it relates to the inability for AI to move to the waypoint's subsequently set position - is already known. Those coders who've been around longer may be able to provide additional background. |
|
Did it ever work with waypoints? I'm fairly sure it never did. |
|
Well, regardless, I think it was intended to work with waypoints, according to the description of the SEXP in FRED. |
|
See my post http://www.hard-light.net/forums/index.php?topic=81595.msg1627660#msg1627660 for a potential fix. |
|
dyn_waypoints.patch (396 bytes)
Index: code/parse/sexp.cpp =================================================================== --- code/parse/sexp.cpp (revision 9096) +++ code/parse/sexp.cpp (working copy) @@ -6665,6 +6665,10 @@ { oswpt.objp->pos = target_vec; set_object_for_clients(oswpt.objp); + if (!(Game_mode & GM_MULTIPLAYER)) { + oswpt.waypointp->set_pos(&target_vec); + } + return; } |
|
Added Admiral MS' two patches from the HLP forums, and set issue to 'Code Review' so that it gets noticed. |
|
Good catch by Admiral MS. This is indeed the core cause of the problem. Unfortunately the patch does not completely handle the multiplayer situation, so it will need to be tweaked. Additionally, there are similarly slightly incorrect uses of OSWPT_WAYPOINT throughout sexp.cpp which will need to be fixed as well. |
|
Multiplayer seems to be a bit difficult because I found no function to send changes of the waypoint list to clients. It might be possible with a multi_sexp for set-object-position though. With "Additionally, there are similarly slightly incorrect uses of OSWPT_WAYPOINT throughout sexp.cpp which will need to be fixed as well. " do you mean all sexps that have something to do with waypoints but use oswpt.objp instead of oswpt.waypointp? |
|
dyn_waypoints_v2.patch (1,386 bytes)
Index: code/parse/sexp.cpp =================================================================== --- code/parse/sexp.cpp (revision 9096) +++ code/parse/sexp.cpp (working copy) @@ -6664,7 +6664,13 @@ case OSWPT_TYPE_WAYPOINT: { oswpt.objp->pos = target_vec; - set_object_for_clients(oswpt.objp); + oswpt.waypointp->set_pos(&target_vec); + multi_start_callback(); + multi_send_int(OBJ_INDEX(oswpt.objp)); + multi_send_float(target_vec.xyz.x); + multi_send_float(target_vec.xyz.y); + multi_send_float(target_vec.xyz.z); + multi_end_callback(); return; } @@ -6693,6 +6699,24 @@ } } +// only for waypoints cause they don't get transferred the normal way +void multi_sexp_set_object_position() +{ + object *objp; + vec3d wp_vec; + int objnum; + multi_get_int(objnum); + multi_get_float(wp_vec.xyz.x); + multi_get_float(wp_vec.xyz.y); + multi_get_float(wp_vec.xyz.z); + objp = &Objects[objnum]; + if (objp->type == OBJ_WAYPOINT) { + objp->pos = wp_vec; + waypoint *wpt = find_waypoint_with_objnum(OBJ_INDEX(objp)); + wpt->set_pos(&wp_vec); + } +} + // Goober5000 void sexp_set_object_orientation(int n) { @@ -22829,6 +22853,9 @@ case OP_SET_OBJECT_SPEED_Z: multi_sexp_set_object_speed(); break; + case OP_SET_OBJECT_POSITION: + multi_sexp_set_object_position(); + break; // bad sexp in the packet default: |
|
Added new patch file (dyn_waypoints_v2.patch) to handle multiplayer. Waypoint coordinates were set properly client side during my tests. |
|
The fix for this issue is crashing FSO whenever a waypoint is set for a ship. This is likely due to the two case statements handling both ship and waypoint are sharing the same code. If a ship's position is being changed, an invalid handle to a waypoint will also try to be changed which is causing a NULL pointer exception. |
|
I've committed 9115 which restores the old set object position code for the case statement handling ships while Admiral MS's new code for waypoints gets it's own case statement. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-02-23 23:31 | haloboy100 | New Issue | |
2012-02-23 23:31 | haloboy100 | File Added: Teleport test.fs2 | |
2012-02-23 23:34 | haloboy100 | Note Added: 0013346 | |
2012-02-24 02:15 | niffiwan | Product Version | 3.6.14 RC4 => 3.6.14 RC5 |
2012-02-24 04:32 | Echelon9 | Note Added: 0013348 | |
2012-02-24 04:32 | Echelon9 | Status | new => acknowledged |
2012-02-24 08:26 | karajorma | Note Added: 0013352 | |
2012-02-24 14:39 | haloboy100 | Note Added: 0013357 | |
2012-02-24 14:40 | haloboy100 | Note Edited: 0013357 | |
2012-08-08 11:15 | Admiral MS | Note Added: 0013895 | |
2012-08-08 14:28 | Echelon9 | Assigned To | => Echelon9 |
2012-08-08 14:28 | Echelon9 | Status | acknowledged => assigned |
2012-08-08 14:29 | Echelon9 | File Added: remove_waypoints.patch | |
2012-08-08 14:29 | Echelon9 | File Added: dyn_waypoints.patch | |
2012-08-08 14:30 | Echelon9 | Note Added: 0013896 | |
2012-08-08 14:30 | Echelon9 | Status | assigned => code review |
2012-08-08 21:10 | Echelon9 | File Deleted: remove_waypoints.patch | |
2012-08-09 15:54 | Goober5000 | Note Added: 0013899 | |
2012-08-09 18:20 | Admiral MS | Note Added: 0013900 | |
2012-08-09 18:51 | Admiral MS | Note Edited: 0013900 | |
2012-08-11 13:23 | Admiral MS | File Added: dyn_waypoints_v2.patch | |
2012-08-11 13:25 | Admiral MS | Note Added: 0013903 | |
2012-08-14 20:17 | Valathil | Status | code review => resolved |
2012-08-14 20:17 | Valathil | Resolution | open => fixed |
2012-08-17 05:48 | Swifty | Note Added: 0013915 | |
2012-08-17 05:48 | Swifty | Status | resolved => feedback |
2012-08-17 05:48 | Swifty | Resolution | fixed => reopened |
2012-08-17 06:44 | Swifty | Note Added: 0013916 | |
2012-08-17 06:54 | Swifty | Status | feedback => resolved |
2012-08-17 06:54 | Swifty | Resolution | reopened => fixed |
2012-08-24 02:07 | Goober5000 | Relationship added | has duplicate 0002123 |
2012-12-10 03:21 | Goober5000 | Assigned To | Echelon9 => Admiral MS |