nakedmudv3.6/
nakedmudv3.6/lib/
nakedmudv3.6/lib/help/A/
nakedmudv3.6/lib/help/B/
nakedmudv3.6/lib/help/C/
nakedmudv3.6/lib/help/D/
nakedmudv3.6/lib/help/G/
nakedmudv3.6/lib/help/H/
nakedmudv3.6/lib/help/J/
nakedmudv3.6/lib/help/L/
nakedmudv3.6/lib/help/M/
nakedmudv3.6/lib/help/O/
nakedmudv3.6/lib/help/P/
nakedmudv3.6/lib/help/R/
nakedmudv3.6/lib/help/S/
nakedmudv3.6/lib/help/W/
nakedmudv3.6/lib/logs/
nakedmudv3.6/lib/misc/
nakedmudv3.6/lib/players/
nakedmudv3.6/lib/txt/
nakedmudv3.6/lib/world/
nakedmudv3.6/lib/world/examples/
nakedmudv3.6/lib/world/examples/mproto/
nakedmudv3.6/lib/world/examples/oproto/
nakedmudv3.6/lib/world/examples/reset/
nakedmudv3.6/lib/world/examples/rproto/
nakedmudv3.6/lib/world/examples/trigger/
nakedmudv3.6/lib/world/limbo/
nakedmudv3.6/lib/world/limbo/room/
nakedmudv3.6/lib/world/limbo/rproto/
nakedmudv3.6/src/alias/
nakedmudv3.6/src/dyn_vars/
nakedmudv3.6/src/editor/
nakedmudv3.6/src/example_module/
nakedmudv3.6/src/help2/
nakedmudv3.6/src/set_val/
nakedmudv3.6/src/socials/
nakedmudv3.6/src/time/
//*****************************************************************************
//
// bedit.c
//
// bedit is the OLC for bitvector editing. Allows people to turn on/off bits for
// a bitvector.
//
//*****************************************************************************

#include "../mud.h"
#include "../socket.h"
#include "../bitvector.h"

#include "olc.h"



//*****************************************************************************
// bitvector editing functions
//*****************************************************************************
void bedit_menu   (SOCKET_DATA *sock, BITVECTOR *vector) {
  LIST *bits = bitvectorListBits(vector);
  send_to_socket(sock, "{wCurrent bits: {c%s\r\n", bitvectorGetBits(vector));
  olc_display_list(sock, bits, 3);
  deleteListWith(bits, free);
}

int  bedit_chooser(SOCKET_DATA *sock, BITVECTOR *vector, const char *option) {
  if(!isdigit(*option)) 
    return MENU_CHOICE_INVALID;
  else {
    int choice = atoi(option);
    if(choice < 0 || choice >= bitvectorSize(vector))
      return MENU_CHOICE_INVALID;
    else {
      LIST *bits = bitvectorListBits(vector);
      char  *bit = listGet(bits, choice);
      bitToggle(vector, bit);
      deleteListWith(bits, free);
      return MENU_NOCHOICE;
    }
  }
}

bool bedit_parser (SOCKET_DATA *sock, BITVECTOR *vector, int choice, 
		   const char *arg) {
  // no parser... everything is done in the chooser
  return FALSE;
}