… | |
… | |
40 | |
40 | |
41 | =over 4 |
41 | =over 4 |
42 | |
42 | |
43 | =cut |
43 | =cut |
44 | |
44 | |
45 | package safe::mapscript; |
45 | package cf::mapscript::eval; |
46 | |
46 | |
47 | use common::sense; |
47 | use common::sense; |
48 | |
48 | |
49 | =item $self |
49 | =item $self |
50 | |
50 | |
… | |
… | |
64 | The object that triggered the activator, usually (but not always) the |
64 | The object that triggered the activator, usually (but not always) the |
65 | player who stepped on a check inv, pulled a lever etc. Can be C<undef>. |
65 | player who stepped on a check inv, pulled a lever etc. Can be C<undef>. |
66 | |
66 | |
67 | =cut |
67 | =cut |
68 | |
68 | |
69 | our ($self, $state, $activator, $originator); |
69 | use vars qw($self $state $activator $originator); |
70 | |
70 | |
71 | =item @obs = find $id_or_object |
71 | =item @obs = find $id_or_object |
72 | |
72 | |
73 | Finds all objects with the given I<connected> C<$id>. If an object |
73 | Finds all objects with the given I<connected> C<$id>. If an object |
74 | reference is passed, it will be returned unchanged. |
74 | reference is passed, it will be returned unchanged. |
… | |
… | |
106 | $ob->set_speed (1); |
106 | $ob->set_speed (1); |
107 | } |
107 | } |
108 | |
108 | |
109 | package cf::mapscript; |
109 | package cf::mapscript; |
110 | |
110 | |
111 | use strict qw(subs vars); |
111 | use common::sense; |
|
|
112 | |
|
|
113 | *{"main::safe::cf::mapscript::eval::"} = \%{"main::cf::mapscript::eval::"}; |
112 | |
114 | |
113 | our %CACHE; |
115 | our %CACHE; |
114 | |
116 | |
115 | sub activate($$$) { |
117 | sub activate($$$) { |
|
|
118 | package cf::mapscript::eval; |
|
|
119 | |
116 | ($self, $state, $activator, $originator) = @_; |
120 | ($self, $state, $activator, $originator) = @_; |
117 | |
121 | |
118 | ( |
122 | ( |
119 | $CACHE{$self->msg} ||= cf::safe_eval |
123 | $CACHE{$self->msg} ||= cf::safe_eval |
120 | "package mapscript; sub {\n" |
124 | "package cf::mapscript::eval; sub {\n" |
121 | . "#line 1 '" . ($self->debug_desc) . "'\n" |
125 | . "#line 1 '" . ($self->debug_desc) . "'\n" |
122 | . $self->msg |
126 | . $self->msg |
123 | . "\n}" |
127 | . "\n}" |
124 | or sub { } |
128 | or sub { } |
125 | )->(); |
129 | )->(); |