From 07969da2a0adb7436eb5966bf70e131c96122524 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 20 Dec 2006 09:53:32 +0000 Subject: [PATCH] cancel edit mode on (owner) player disconnect --- fbxa/bot_qw.qc | 7 +++++++ fbxa/editor.h | 1 - fbxa/editor.r | 33 +++++++++++++++++---------------- fbxa/waypoint.r | 1 + 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/fbxa/bot_qw.qc b/fbxa/bot_qw.qc index 7fad4e7..8a3eb07 100644 --- a/fbxa/bot_qw.qc +++ b/fbxa/bot_qw.qc @@ -223,6 +223,7 @@ ClientDisconnected = if (players[i].ent.enemy == e) [players[i] lost:p:0]; } + [p releaseEditor]; } [p release]; }; @@ -504,6 +505,12 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning = { return ishuman; } + +-(void)releaseEditor +{ + if (editor) + [EditorState close_menu]; +} @end void () diff --git a/fbxa/editor.h b/fbxa/editor.h index 6b3bc3e..18531b2 100644 --- a/fbxa/editor.h +++ b/fbxa/editor.h @@ -15,7 +15,6 @@ string confirm_cmd; Target owner; - Waypoint current_way; Waypoint last_way; integer hold_select; Bot test_bot; diff --git a/fbxa/editor.r b/fbxa/editor.r index 6587c73..e15c15d 100644 --- a/fbxa/editor.r +++ b/fbxa/editor.r @@ -765,47 +765,48 @@ +confirm { - local EditorState editor = ((Target) @self.@this).editor; + local Target player = (Target) @self.@this; + local EditorState editor = player.editor; switch (editor.confirm_cmd) { case "link ways": - if (editor.current_way) { - if (![editor.last_way linkWay:editor.current_way]) + if (player.current_way) { + if (![editor.last_way linkWay:player.current_way]) sprint (@self, PRINT_HIGH, "Unable to link them\n"); } break; case "telelink ways": - if (editor.current_way) { - if (![editor.last_way teleLinkWay:editor.current_way]) + if (player.current_way) { + if (![editor.last_way teleLinkWay:player.current_way]) sprint (@self, PRINT_HIGH, "Unable to link them\n"); } break; case "delete link": - if (editor.current_way) { - [editor.last_way unlinkWay:editor.current_way]; + if (player.current_way) { + [editor.last_way unlinkWay:player.current_way]; } break; case "create link x2": - if (editor.current_way) { - if (![editor.last_way teleLinkWay:editor.current_way]) + if (player.current_way) { + if (![editor.last_way teleLinkWay:player.current_way]) sprint (@self, PRINT_HIGH, "Unable to link 1 to 2\n"); - if (![editor.current_way teleLinkWay:editor.last_way]) + if (![player.current_way teleLinkWay:editor.last_way]) sprint (@self, PRINT_HIGH, "Unable to link 2 to 1\n"); } break; case "delete link x2": - if (editor.current_way) { - [editor.last_way unlinkWay:editor.current_way]; - [editor.current_way unlinkWay:editor.last_way]; + if (player.current_way) { + [editor.last_way unlinkWay:player.current_way]; + [player.current_way unlinkWay:editor.last_way]; } break; case "delete all ways": [Waypoint clearAll]; - editor.current_way = editor.last_way = NIL; + player.current_way = editor.last_way = NIL; break; case "delete waypoint": [waypoint_array removeItem:editor.last_way]; - if (editor.current_way == editor.last_way) - editor.current_way = NIL; + if (player.current_way == editor.last_way) + player.current_way = NIL; editor.last_way = NIL; break; } diff --git a/fbxa/waypoint.r b/fbxa/waypoint.r index 0499b67..edee97b 100644 --- a/fbxa/waypoint.r +++ b/fbxa/waypoint.r @@ -411,6 +411,7 @@ Waypoint Loading from file { if (ent) { remove (ent); + ent = NIL; own = 0; } }