projects
/
mafia.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
efb97d6
)
Don't push/shift on array references
author
Marius Gavrilescu
<marius@ieval.ro>
Sat, 15 Aug 2015 15:47:38 +0000
(18:47 +0300)
committer
Marius Gavrilescu
<marius@ieval.ro>
Sat, 15 Aug 2015 15:47:45 +0000
(18:47 +0300)
lib/Mafia.pm
patch
|
blob
|
blame
|
history
diff --git
a/lib/Mafia.pm
b/lib/Mafia.pm
index d12b3eeea0f646e74c5e1f56f0ad7b277b73a19e..ada67d210e7278ce4ee11500ae04243fa19bc857 100644
(file)
--- a/
lib/Mafia.pm
+++ b/
lib/Mafia.pm
@@
-176,7
+176,7
@@
sub putaction {
if (exists $args{target} && exists $args{source} && $players{$args{target}}{faction} eq mafia && $players{$args{source}}{weak}) {
putaction($delay, ACT_KILL, target => $args{source}, reason => 'targeted scum');
}
if (exists $args{target} && exists $args{source} && $players{$args{target}}{faction} eq mafia && $players{$args{source}}{weak}) {
putaction($delay, ACT_KILL, target => $args{source}, reason => 'targeted scum');
}
- push
$actions[$delay]->{$type
}, \%args
+ push
@{$actions[$delay]->{$type}
}, \%args
}
sub doaction {
}
sub doaction {
@@
-187,9
+187,9
@@
sub doaction {
if (defined $source && defined $target) {
# Watcher and tracker variables
$tplayers{$source}{targets} //= [];
if (defined $source && defined $target) {
# Watcher and tracker variables
$tplayers{$source}{targets} //= [];
- push
$tplayers{$source}{targets
}, $target;
+ push
@{$tplayers{$source}{targets}
}, $target;
$tplayers{$target}{sources} //= [];
$tplayers{$target}{sources} //= [];
- push
$tplayers{$target}{sources
}, $source;
+ push
@{$tplayers{$target}{sources}
}, $source;
# Copy this action to everybody hiding behind $target
if (exists $tplayers{$target}{hiders}) {
# Copy this action to everybody hiding behind $target
if (exists $tplayers{$target}{hiders}) {
@@
-219,7
+219,7
@@
sub doaction {
if ($tplayers{$target}{guard_count} && defined $source) {
$tplayers{$target}{guard_count}--;
# Copy this action to the first guard
if ($tplayers{$target}{guard_count} && defined $source) {
$tplayers{$target}{guard_count}--;
# Copy this action to the first guard
- $args{target} = shift
$tplayers{$target}{guards
};
+ $args{target} = shift
@{$tplayers{$target}{guards}
};
@_ = ($type, %args);
goto &doaction;
}
@_ = ($type, %args);
goto &doaction;
}
@@
-234,7
+234,7
@@
sub doaction {
when(ACT_LYNCH){
if ($tplayers{$target}{guard_count}) {
$tplayers{$target}{guard_count}--;
when(ACT_LYNCH){
if ($tplayers{$target}{guard_count}) {
$tplayers{$target}{guard_count}--;
- $args{target} = shift
$tplayers{$target}{guards
};
+ $args{target} = shift
@{$tplayers{$target}{guards}
};
$target=$args{target};
}
if ($tplayers{$target}{protection}) {
$target=$args{target};
}
if ($tplayers{$target}{protection}) {
@@
-271,7
+271,7
@@
sub doaction {
when(ACT_GUARD){
$tplayers{$target}{guard_count}++;
$tplayers{$target}{guards} //= [];
when(ACT_GUARD){
$tplayers{$target}{guard_count}++;
$tplayers{$target}{guards} //= [];
- push
$tplayers{$target}{guards
}, $source;
+ push
@{$tplayers{$target}{guards}
}, $source;
}
when(ACT_ROLECOP){
}
when(ACT_ROLECOP){
@@
-290,7
+290,7
@@
sub doaction {
when(ACT_HIDE){
$tplayers{$source}{hidden} = 1;
$tplayers{$target}{hiders} //= [];
when(ACT_HIDE){
$tplayers{$source}{hidden} = 1;
$tplayers{$target}{hiders} //= [];
- push
$tplayers{$target}{hiders
}, $source
+ push
@{$tplayers{$target}{hiders}
}, $source
}
}
}
}
}
}
This page took
0.011519 seconds
and
4
git commands to generate.