Lambda-Closures durch Inline-Closures ersetzt
Change-Id: Ic4d3a5d1d6e66354b348b07fc95561739a2a0980
diff --git a/std/player/base.c b/std/player/base.c
index 0d5de1e..785a0b6 100644
--- a/std/player/base.c
+++ b/std/player/base.c
@@ -855,8 +855,9 @@
if (str=="keine")
SetProp(P_HOMEPAGE, 0);
else {
- tmp = filter(regexplode(str, "[<][^>]*[>]"),
- lambda(({'e}), ({#'!=, ({#'[, 'e, 0}), '<'})));
+ tmp = filter(regexplode(str, "[<][^>]*[>]"), function int (string e) {
+ return (e[0] != '<');
+ });
write("Sie lautet jetzt: "+(str = implode(tmp, ""))+"\n");
SetProp(P_HOMEPAGE, str);
}
diff --git a/std/player/channel.c b/std/player/channel.c
index 9f8512a..3a11661 100644
--- a/std/player/channel.c
+++ b/std/player/channel.c
@@ -544,11 +544,9 @@
SetProp(P_CHANNEL_SHORT, DEFAULT_SHORTCUTS
+ (IS_LEARNER(this_object()) ? WIZARD_SHORTCUTS : ([])));
}
- walk_mapping(QueryProp(P_CHANNEL_SHORT),
- lambda(({'i/*'*/, 'c, 'r}),
- ({#'+=, 'r/*'*/,
- ({#'sprintf/*'*/, "%5.5s = %s\n", 'i, 'c})})),
- &txt);
+ foreach(string abk, string ch_name : QueryProp(P_CHANNEL_SHORT)) {
+ txt += sprintf("%5.5s = %s\n", abk, ch_name);
+ }
txt = sprintf("Folgende Abkuerzungen sind definiert:\n%-78#s\n",
implode(sort_array(old_explode(txt, "\n"), #'>/*'*/), "\n"));
More(txt);
diff --git a/std/player/invmaster/invmaster.c b/std/player/invmaster/invmaster.c
index 5b6d599..6ecac91 100644
--- a/std/player/invmaster/invmaster.c
+++ b/std/player/invmaster/invmaster.c
@@ -119,20 +119,14 @@
// it just checks every word of the name, if it does not begin
// with a capital letter, it is abbreviated
// this happens only if the name length exceeds 20 chars...
- abbreviate=lambda(({'x}),
- ({#'?, ({#'>, ({#'member, quote(({"der", "des"})), 'x}), 0}),
- "d.",
- ({#'?, ({#'>, ({#'sizeof, 'x}), 3}),
- ({#'?, ({#',, ({#'=, 'a, ({#'allocate, 1}) }),
- ({#'=, ({#'[, 'a, 0}), 'x }),
- ({#'sizeof, ({#'regexp, 'a, "^[a-z].*"}) })
- }),
- ({#'+, ({#'[..], 'x, 0, 1}), "."}),
- 'x
- }),
- 'x
- })
- }));
+ abbreviate = function string (string x) {
+ if ( member(({"der","des"}), x) > 0 )
+ return "d.";
+ else if ( sizeof(x) > 3)
+ return regreplace(x, "^[a-z].+", x[0..0]+".", 0x1);
+ else
+ return x;
+ };
}
// function that tries to guess a good item name and use abbrevations
diff --git a/std/player/travel.c b/std/player/travel.c
index 3e07c0a..6b55957 100644
--- a/std/player/travel.c
+++ b/std/player/travel.c
@@ -233,8 +233,9 @@
+"reisen.\n");
- dstr = filter( filter_objects(ship,"short"), lambda( ({'x}),
- ({ #'==, ({#'environment, 'x}), environment() }) ) );
+ dstr = filter(ship, function int (object x) {
+ return (environment(x) == environment() && x->short());
+ });
if (sizeof(dstr))
{
@@ -365,8 +366,9 @@
write(break_string("Dahin kannst Du mit "
+_traveller(map_objects(ship, "name", WEM))+" gelangen.",78));
- dstr = filter(filter_objects(ship,"short"),lambda( ({'x}),
- ({ #'==, ({#'environment, 'x}), environment() }) ) );
+ dstr = filter(ship, function int (object x) {
+ return (environment(x) == environment() && x->short());
+ });
if (sizeof(dstr))
{
@@ -462,8 +464,9 @@
write("'"+capitalize(mit)+"' koennte "
+_traveller(map_objects(ship,"name",WER))+" sein.\n");
- dstr = filter(filter_objects(ship,"short"),lambda( ({'x}),
- ({ #'==, ({#'environment, 'x}), environment() }) ) );
+ dstr = filter(ship, function int (object x) {
+ return (environment(x) == environment() && x->short());
+ });
if (sizeof(dstr))
{