#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <zlib.h>

/* including main header file */
#include "mud.h"

/*
 * cmd_leave_trail()
 *
 * Sets current sector of ch to value
 * of the word.
 */
void cmd_leave_trail(D_MOBILE * ch, char *arg)
{
    int x;
    
    if (arg[0] == '\0')
    {
        stc("Edit to what number?\n\r", ch);
        return;
    }
    
    x = atoi (arg);

    map[ch->y][ch->x] = x;

    stc("Done\n\r", ch);
}

void cmd_edit_box (D_MOBILE * ch, char * arg)
{
    char arg1[MAX_BUFFER];
    char arg2[MAX_BUFFER];
    int x;
    int y;
    int size;
    int sector;
    
    arg = one_arg(arg, arg1);
    arg = one_arg(arg, arg2);
    
    if (arg1[0] == '\0' || arg2[0] == '\0')
    {
        stc("Edit wha? <box size> <sector>)\n\r", ch);
        return;
    }
    
    size = atoi (arg1);
    sector = atoi (arg2);
    
    
    for (y = ch->y; y < (ch->y + size); y++)
    {
        for (x = ch->x; x < (ch->x + size); x++)
        {
            map[y][x] = sector;
        }
    }
    stc("Done!\n\r", ch);
}