diff --git a/code/object/waypoint.cpp b/code/object/waypoint.cpp index 23d14b1fc9..d70dde1550 100644 --- a/code/object/waypoint.cpp +++ b/code/object/waypoint.cpp @@ -91,14 +91,14 @@ void waypoint_list::set_name(char *name) } //********************FUNCTIONS******************** -void waypoint_parse_init() -{ - Waypoint_lists.clear(); -} - +void waypoint_parse_init() +{ + Waypoint_lists.clear(); +} + void waypoint_level_close() { - Waypoint_lists.clear(); + Waypoint_lists.clear(); } int calc_waypoint_instance(int waypoint_list_index, int waypoint_index) @@ -161,7 +161,7 @@ waypoint_list *find_matching_waypoint_list(char *name) for (ii = Waypoint_lists.begin(); ii != Waypoint_lists.end(); ++ii) { - if (!strcmp(ii->get_name(), name)) + if (!stricmp(ii->get_name(), name)) return &(*ii); } @@ -426,14 +426,14 @@ int waypoint_add(vec3d *pos, int waypoint_instance) Assert(wp_list != NULL); Assert((uint) wp_index <= wp_list->get_waypoints().size()); - // iterate through all waypoints that are at this index or later, - // and edit their instances so that they point to a waypoint one place higher - for (object *objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) - { - if ((objp->type == OBJ_WAYPOINT) && (calc_waypoint_list_index(objp->instance) == wp_list_index) && (calc_waypoint_index(objp->instance) >= wp_index)) - objp->instance++; - } - } + // iterate through all waypoints that are at this index or later, + // and edit their instances so that they point to a waypoint one place higher + for (object *objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) + { + if ((objp->type == OBJ_WAYPOINT) && (calc_waypoint_list_index(objp->instance) == wp_list_index) && (calc_waypoint_index(objp->instance) >= wp_index)) + objp->instance++; + } + } // so that masking in the other function works // (though if you actually hit this Assert, you have other problems) @@ -491,39 +491,39 @@ void waypoint_remove(waypoint *wpt) // iterate through all waypoints that are in lists later than this one, // and edit their instances so that they point to a list one place lower - for (object *objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) - { - if ((objp->type == OBJ_WAYPOINT) && (calc_waypoint_list_index(objp->instance) > this_list)) - objp->instance -= 0x10000; - } - } - } - // shift the other waypoints down - else - { - // remove this particular waypoint - SCP_list::iterator ii; - int i; - for (i = 0, ii = wp_list->get_waypoints().begin(); ii != wp_list->get_waypoints().end(); ++i, ++ii) - { - if (i == this_index) - { - wp_list->get_waypoints().erase(ii); - break; - } - } - Assert(ii != wp_list->get_waypoints().end()); - - // iterate through all waypoints that are later than this one, - // and edit their instances so that they point to a waypoint one place lower - for (object *objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) - { - if ((objp->type == OBJ_WAYPOINT) && (calc_waypoint_list_index(objp->instance) == this_list) && (calc_waypoint_index(objp->instance) > this_index)) - objp->instance--; - } - } - - // FRED has its own object removal logic - if (!Fred_running) - obj_delete(objnum); -} + for (object *objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) + { + if ((objp->type == OBJ_WAYPOINT) && (calc_waypoint_list_index(objp->instance) > this_list)) + objp->instance -= 0x10000; + } + } + } + // shift the other waypoints down + else + { + // remove this particular waypoint + SCP_list::iterator ii; + int i; + for (i = 0, ii = wp_list->get_waypoints().begin(); ii != wp_list->get_waypoints().end(); ++i, ++ii) + { + if (i == this_index) + { + wp_list->get_waypoints().erase(ii); + break; + } + } + Assert(ii != wp_list->get_waypoints().end()); + + // iterate through all waypoints that are later than this one, + // and edit their instances so that they point to a waypoint one place lower + for (object *objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) + { + if ((objp->type == OBJ_WAYPOINT) && (calc_waypoint_list_index(objp->instance) == this_list) && (calc_waypoint_index(objp->instance) > this_index)) + objp->instance--; + } + } + + // FRED has its own object removal logic + if (!Fred_running) + obj_delete(objnum); +} diff --git a/code/parse/scripting.cpp b/code/parse/scripting.cpp index 5b07b231e0..1e43e2f083 100644 --- a/code/parse/scripting.cpp +++ b/code/parse/scripting.cpp @@ -329,6 +329,11 @@ bool ConditionedHook::ConditionsValid(int action, object *objp) break; } + case CHA_ONWPFIRED: { + if (! (stricmp(Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].name, scp->data.name) == 0 || (stricmp(Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.current_secondary_bank]].name, scp->data.name) == 0))) + return false; + } + } } // case CHC_WEAPONCLASS break;