Пример #1
0
        internal static void Mark( Player player, Command command ) {
            int x, y, h;
            Position pos;
            if( command.NextInt( out x ) && command.NextInt( out y ) && command.NextInt( out h ) ) {
                pos = new Position( x, y, h );
            } else {
                pos = new Position( (player.Position.X - 1) / 32,
                                    (player.Position.Y - 1) / 32,
                                    (player.Position.H - 1) / 32 );
            }
            pos.X = (short)Math.Min( player.World.Map.WidthX - 1, Math.Max( 0, (int)pos.X ) );
            pos.Y = (short)Math.Min( player.World.Map.WidthY - 1, Math.Max( 0, (int)pos.Y ) );
            pos.H = (short)Math.Min( player.World.Map.Height - 1, Math.Max( 0, (int)pos.H ) );

            if( player.SelectionMarksExpected > 0 ) {
                player.AddSelectionMark( pos, true );
            } else {
                player.MessageNow( "Cannot mark - no draw or zone commands initiated." );
            }
        }