--- deliantra/server/lib/cf/mapscript.pm 2009/01/08 21:35:54 1.4 +++ deliantra/server/lib/cf/mapscript.pm 2010/01/10 19:21:47 1.8 @@ -1,5 +1,27 @@ #! perl +# +# This file is part of Deliantra, the Roguelike Realtime MMORPG. +# +# Copyright (©) 2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team +# +# Deliantra is free software: you can redistribute it and/or modify it under +# the terms of the Affero GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the Affero GNU General Public License +# and the GNU General Public License along with this program. If not, see +# . +# +# The authors can be reached via e-mail to +# + =head1 NAME cf::mapscript @@ -20,13 +42,13 @@ =cut -package safe::mapscript; +package cf::mapscript::eval; -use strict qw(subs vars); +use common::sense; =item $self -The mapscript object itself +The mapscript object itself. =item $state @@ -44,7 +66,7 @@ =cut -our ($self, $state, $activator, $originator); +use vars qw($self $state $activator $originator); =item @obs = find $id_or_object @@ -80,22 +102,26 @@ sub timer($$) { my $ob = (&find)[0]; - $ob->speed_left ($_[1] / -cf::TICK); + $ob->speed_left (-$_[1] / cf::TICK); $ob->set_speed (1); } package cf::mapscript; -use strict qw(subs vars); +use common::sense; + +*{"main::safe::cf::mapscript::eval::"} = \%{"main::cf::mapscript::eval::"}; our %CACHE; sub activate($$$) { + package cf::mapscript::eval; + ($self, $state, $activator, $originator) = @_; ( $CACHE{$self->msg} ||= cf::safe_eval - "package mapscript; sub {\n" + "package cf::mapscript::eval; sub {\n" . "#line 1 '" . ($self->debug_desc) . "'\n" . $self->msg . "\n}"