Changeset 60


Ignore:
Timestamp:
Apr 21, 2007, 3:26:20 AM (14 years ago)
Author:
zerodeux
Message:

subtle server fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • insia/perl/bomberman/server.pl

    r59 r60  
    1111use strict;
    1212
     13my $port = 2500;
    1314
    1415my %linfo;
     
    8889  my ($cli, $target) = @_;
    8990
    90   send_to_client($target, "PLAYER-STATUS $cli->{'name'} $cli->{'dir'} $cli->{'col'} $cli->{'row'}")
     91  send_to_client($target, "PLAYER-STATUS $cli->{'name'} $cli->{'dir'} $cli->{'col'} $cli->{'row'}") if defined $cli->{'dir'};
    9192}
    9293
     
    9899  };
    99100  push @clients, $cli;
     101  print "clients: ".join(' ', map { "[".$_->{'handle'}->fileno()." $_->{'name'}]"; } @clients)."\n";
    100102}
    101103
     
    145147sub op_move {
    146148  my ($cli, $dir) = @_;
     149
     150  return if !defined $cli->{'dir'};
    147151
    148152  my ($col, $row) = ($cli->{'col'}, $cli->{'row'});
     
    168172sub op_bomb_drop {
    169173  my ($cli) = @_;
     174
     175  return if !defined $cli->{'dir'};
     176
    170177  send_to_client($cli, "ERROR bomb drop not implemented");
    171178}
     
    193200$server = new IO::Socket::INET(
    194201  'Proto'     => 'tcp',
    195   'LocalPort' => 2500,
     202  'LocalPort' => $port,
    196203  'ReuseAddr' => 1,
    197204);
Note: See TracChangeset for help on using the changeset viewer.