cancel edit mode on (owner) player disconnect

This commit is contained in:
Bill Currie 2006-12-20 09:53:32 +00:00
parent cc4429d1fe
commit 07969da2a0
4 changed files with 25 additions and 17 deletions

View file

@ -223,6 +223,7 @@ ClientDisconnected =
if (players[i].ent.enemy == e) if (players[i].ent.enemy == e)
[players[i] lost:p:0]; [players[i] lost:p:0];
} }
[p releaseEditor];
} }
[p release]; [p release];
}; };
@ -504,6 +505,12 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
{ {
return ishuman; return ishuman;
} }
-(void)releaseEditor
{
if (editor)
[EditorState close_menu];
}
@end @end
void () void ()

View file

@ -15,7 +15,6 @@
string confirm_cmd; string confirm_cmd;
Target owner; Target owner;
Waypoint current_way;
Waypoint last_way; Waypoint last_way;
integer hold_select; integer hold_select;
Bot test_bot; Bot test_bot;

View file

@ -765,47 +765,48 @@
+confirm +confirm
{ {
local EditorState editor = ((Target) @self.@this).editor; local Target player = (Target) @self.@this;
local EditorState editor = player.editor;
switch (editor.confirm_cmd) { switch (editor.confirm_cmd) {
case "link ways": case "link ways":
if (editor.current_way) { if (player.current_way) {
if (![editor.last_way linkWay:editor.current_way]) if (![editor.last_way linkWay:player.current_way])
sprint (@self, PRINT_HIGH, "Unable to link them\n"); sprint (@self, PRINT_HIGH, "Unable to link them\n");
} }
break; break;
case "telelink ways": case "telelink ways":
if (editor.current_way) { if (player.current_way) {
if (![editor.last_way teleLinkWay:editor.current_way]) if (![editor.last_way teleLinkWay:player.current_way])
sprint (@self, PRINT_HIGH, "Unable to link them\n"); sprint (@self, PRINT_HIGH, "Unable to link them\n");
} }
break; break;
case "delete link": case "delete link":
if (editor.current_way) { if (player.current_way) {
[editor.last_way unlinkWay:editor.current_way]; [editor.last_way unlinkWay:player.current_way];
} }
break; break;
case "create link x2": case "create link x2":
if (editor.current_way) { if (player.current_way) {
if (![editor.last_way teleLinkWay:editor.current_way]) if (![editor.last_way teleLinkWay:player.current_way])
sprint (@self, PRINT_HIGH, "Unable to link 1 to 2\n"); 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"); sprint (@self, PRINT_HIGH, "Unable to link 2 to 1\n");
} }
break; break;
case "delete link x2": case "delete link x2":
if (editor.current_way) { if (player.current_way) {
[editor.last_way unlinkWay:editor.current_way]; [editor.last_way unlinkWay:player.current_way];
[editor.current_way unlinkWay:editor.last_way]; [player.current_way unlinkWay:editor.last_way];
} }
break; break;
case "delete all ways": case "delete all ways":
[Waypoint clearAll]; [Waypoint clearAll];
editor.current_way = editor.last_way = NIL; player.current_way = editor.last_way = NIL;
break; break;
case "delete waypoint": case "delete waypoint":
[waypoint_array removeItem:editor.last_way]; [waypoint_array removeItem:editor.last_way];
if (editor.current_way == editor.last_way) if (player.current_way == editor.last_way)
editor.current_way = NIL; player.current_way = NIL;
editor.last_way = NIL; editor.last_way = NIL;
break; break;
} }

View file

@ -411,6 +411,7 @@ Waypoint Loading from file
{ {
if (ent) { if (ent) {
remove (ent); remove (ent);
ent = NIL;
own = 0; own = 0;
} }
} }