--- deliantra/server/ext/login.ext 2007/12/28 19:44:34 1.77 +++ deliantra/server/ext/login.ext 2008/04/06 17:08:51 1.82 @@ -54,8 +54,20 @@ 1 } -sub safe_spot($$$) { - my ($m, $x, $y) = @_; +sub safe_spot($) { + my ($pl) = @_; + + my $ob = $pl->ob; + + my $m = $ob->map + or return; + my $x = $ob->x; + my $y = $ob->y; + +# return 0;#d# +# warn join ":", $m->at ($x, $y);#d# +# warn "FOO$m { ".scalar ($m->at ($x, $y))." }\n"; +# return 0; scalar grep $_->type == cf::SAVEBED, $m->at ($x, $y) } @@ -75,15 +87,13 @@ my $m = cf::map::find $map; my $time = delete $pl->{unclean_save}; - if ($time && $m && !safe_spot $m, $x, $y) { + if ($time && $m) { if ($time < $m->{instantiate_time}) { # the map was reset in the meantime my $age = $cf::RUNTIME - $time; warn $ob->name, " map reset after logout, logout age $age (>= $MAX_DISCONNECT_TIME)\n";#d# - ($map, $x, $y) = $pl->savebed; - if ($age >= $MAX_DISCONNECT_TIME) { $ob->message ( "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " @@ -97,6 +107,8 @@ $ob->stats->hp (-10000); #] if they survive this they deserved to live $pl->killer ("a cave-in"); } else { + ($map, $x, $y) = $pl->savebed; + $ob->message ( "You didn't use a bed to reality to leave this realm, leaving your body in great danger. " . "Fortunately, some friendly dwellers found you, checked your passport, and brought you to safety. " @@ -148,12 +160,12 @@ *** *** Look at your client preferences: *** -*** CFPlus: all known versions automatically enable the facecache. +*** deliantra: all known versions automatically enable the facecache. *** cfclient: use the -cache commandline option. *** cfclient: map will not redraw automatically (bug). *** gcfclient: use -cache commandline option, or enable *** gcfclient: Client => Configure => Map & Image => Cache Images. -*** jcrossclient: your client is broken, use CFPlus or gcfclient. +*** jcrossclient: your client is broken, use deliantra or gcfclient. *** *** EOF @@ -487,7 +499,8 @@ $_->ob->message ("$name left the game.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; } else { $_->ob->message ("$name uncerimoniously disconnected.", cf::NDI_DK_ORANGE | cf::NDI_UNIQUE) for cf::player::list; - $pl->{unclean_save} = $cf::RUNTIME; + $pl->{unclean_save} = $cf::RUNTIME + unless safe_spot $pl; } }, ); @@ -544,7 +557,7 @@ } }; warn $@ if $@; - Coro::cede; + cf::cede_to_tick; }; } };