nakedmud-mod/
nakedmud-mod/html/tutorials/
nakedmud-mod/html/tutorials/building_extras/
nakedmud-mod/html/tutorials/c/
nakedmud-mod/html/tutorials/reference/
nakedmud-mod/html/tutorials/scripting/
nakedmud-mod/html/tutorials/scripting_extras/
nakedmud-mod/lib/
nakedmud-mod/lib/help/A/
nakedmud-mod/lib/help/B/
nakedmud-mod/lib/help/C/
nakedmud-mod/lib/help/D/
nakedmud-mod/lib/help/G/
nakedmud-mod/lib/help/H/
nakedmud-mod/lib/help/J/
nakedmud-mod/lib/help/L/
nakedmud-mod/lib/help/M/
nakedmud-mod/lib/help/O/
nakedmud-mod/lib/help/P/
nakedmud-mod/lib/help/R/
nakedmud-mod/lib/help/S/
nakedmud-mod/lib/help/W/
nakedmud-mod/lib/logs/
nakedmud-mod/lib/misc/
nakedmud-mod/lib/players/
nakedmud-mod/lib/pymodules/polc/
nakedmud-mod/lib/txt/
nakedmud-mod/lib/world/
nakedmud-mod/lib/world/zones/examples/
nakedmud-mod/lib/world/zones/examples/mproto/
nakedmud-mod/lib/world/zones/examples/oproto/
nakedmud-mod/lib/world/zones/examples/reset/
nakedmud-mod/lib/world/zones/examples/rproto/
nakedmud-mod/lib/world/zones/examples/trigger/
nakedmud-mod/lib/world/zones/limbo/
nakedmud-mod/lib/world/zones/limbo/room/
nakedmud-mod/lib/world/zones/limbo/rproto/
nakedmud-mod/src/alias/
nakedmud-mod/src/dyn_vars/
nakedmud-mod/src/editor/
nakedmud-mod/src/example_module/
nakedmud-mod/src/help2/
nakedmud-mod/src/set_val/
nakedmud-mod/src/socials/
nakedmud-mod/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;
}