• R/O
  • SSH
  • HTTPS

jinrousiki: Commit


Commit MetaInfo

Révision2770 (tree)
l'heure2021-08-16 04:57:49
Auteurumethyl

Message de Log

Number::OutRange()

Change Summary

Modification

--- trunk/include/functions.php (revision 2769)
+++ trunk/include/functions.php (revision 2770)
@@ -309,6 +309,11 @@
309309 public static function InRange($number, $from, $to) {
310310 return $from < $number && $number < $to;
311311 }
312+
313+ //範囲外 (target < a || b < target)
314+ public static function OutRange($number, $from, $to) {
315+ return $number < $from || $to < $number;
316+ }
312317 }
313318
314319 //-- Switch (bool) 関連 --//
--- trunk/include/game_functions.php (revision 2769)
+++ trunk/include/game_functions.php (revision 2770)
@@ -146,7 +146,7 @@
146146 $stack = [];
147147 for ($i = -1; $i < 2; $i++) {
148148 $j = $num + $i * self::BASE;
149- if ($j < 1 || $max + 1 < $j) {
149+ if (Number::OutRange($j, 1, $max + 1)) {
150150 continue;
151151 }
152152
--- trunk/include/option/option_class.php (revision 2769)
+++ trunk/include/option/option_class.php (revision 2770)
@@ -436,7 +436,7 @@
436436 $post = sprintf('%s_count', $this->name);
437437 RQ::Get()->ParsePostInt($post);
438438 $count = RQ::Get()->$post;
439- if ($count < 1 || 99 < $count) {
439+ if (Number::OutRange($count, 1, 99)) {
440440 RoomManagerHTML::OutputResult('limit_over', $this->GetName());
441441 }
442442 $this->Set(sprintf('%s:%d', $this->name, $count));
--- trunk/include/option/real_time.php (revision 2769)
+++ trunk/include/option/real_time.php (revision 2770)
@@ -17,7 +17,7 @@
1717 RQ::Get()->ParsePostInt($post_day, $post_night);
1818 $day = RQ::Get()->$post_day;
1919 $night = RQ::Get()->$post_night;
20- if ($day < 1 || 99 < $day || $night < 1 || 99 < $night) {
20+ if (Number::OutRange($day, 1, 99) || Number::OutRange($night, 1, 99)) {
2121 RoomManagerHTML::OutputResult('time');
2222 }
2323 $this->Set(sprintf('%s:%d:%d', $this->name, $day, $night));
--- trunk/include/role/barrier_wizard.php (revision 2769)
+++ trunk/include/role/barrier_wizard.php (revision 2770)
@@ -21,7 +21,7 @@
2121 }
2222
2323 protected function ValidateVoteNightTargetList(array $list) {
24- if (count($list) < 1 || 4 < count($list)) {
24+ if (Number::OutRange(count($list), 1, 4)) {
2525 throw new UnexpectedValueException(VoteRoleMessage::INVALID_TARGET_RANGE);
2626 }
2727 }
Afficher sur ancien navigateur de dépôt.