Beispiel #1
0
  /** The default constructor creates a parameter set with from the template
      argument structure. The keyword list is created and the defaults are
      set. */
  MibSParams() :
    AlpsParameterSet(
		     static_cast<int>(endOfBoolParams),
		     static_cast<int>(endOfIntParams),
		     static_cast<int>(endOfDblParams),
		     static_cast<int>(endOfStrParams),
		     static_cast<int>(endOfStrArrayParams)
		     )
    {
      createKeywordList();
      setDefaultEntries();
    }
Beispiel #2
0
char interpEditObjTypeMenu(usint ch, dikuObject *obj, dikuObject *origObj,
                           char *addedIdentKeyword)
{
  struct rccoord coords;
  char strn[256], numbStrn[32], newName[256];
  stringNode *strnN;
  ulong i;


 // edit obj short name

  if (ch == 'A')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object short name: &n");

   // length - 1 - 1 because we gotta allow space for the tilde at the end

    getStrn(obj->objShortName, MAX_OBJSNAME_LEN - 1 - 1 - 1, 1, 7, '°',
            obj->objShortName, FALSE, FALSE);

    remTrailingSpaces(obj->objShortName);
    remLeadingSpaces(obj->objShortName);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj long name

  if (ch == 'B')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object long name: &n");

   // length - 1 - 1 because we gotta allow space for the tilde at the end

    getStrn(obj->objLongName, MAX_OBJLNAME_LEN - 1 - 1 - 1, 1, 7, '°',
            obj->objLongName, FALSE, FALSE);

    remTrailingSpaces(obj->objLongName);
    remLeadingSpaces(obj->objLongName);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj keywords

  if (ch == 'C')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object keywords: &n");

    createKeywordString(obj->keywordListHead, strn);
    strn[strlen(strn) - 1] = '\0';  // get rid of tilde

    getStrn(strn, MAX_OBJKEY_LEN - 1, 1, 7, '°', strn, FALSE, FALSE);

    remTrailingSpaces(strn);
    remLeadingSpaces(strn);
    strcat(strn, "~");

    deleteStringNodes(obj->keywordListHead);
    obj->keywordListHead = createKeywordList(strn);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra flags

  if (ch == 'D')
  {
    editObjExtraFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra2 flags

  if (ch == 'E')
  {
    editObjExtra2Flags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj wear flags

  if (ch == 'F')
  {
    editObjWearFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj anti flags

  if (ch == 'G')
  {
    editObjAntiFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj anti2 flags

  if (ch == 'H')
  {
    editObjAnti2Flags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj type, applies, values

  if (ch == 'I')
  {
    editObjMisc(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj weight, dam bonus, etc

  if (ch == 'J')
  {
    editObjMisc2(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra descs

  if (ch == 'K')
  {
    if (editObjExtraDesc(obj, addedIdentKeyword))
    {
     // user aborted, check for _id_ keyword and remove it

      if (*addedIdentKeyword)
      {
        strnN = obj->keywordListHead;
        while (strnN)
        {
          if (!strcmp(strnN->string, "_ID_"))
          {
            if (!strnN->Last) // head of list
            {
              obj->keywordListHead = obj->keywordListHead->Next;
              obj->keywordListHead->Last = NULL;

              delete strnN;
            }
            else
            {
              strnN->Last->Next = strnN->Next;
              strnN->Next->Last = strnN->Last;

              delete strnN;
            }
          }

          strnN = strnN->Next;
        }
      }
    }

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj trap info

  if (ch == 'M')
  {
    editObjTrapInfo(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // if allowed, edit aff1 flag

  if (getObjAffectVal() && (ch == 'N'))
  {
    editObjAffect1Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff2 flag

  if (getObjAffectVal() && (ch == 'O'))
  {
    editObjAffect2Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff3 flag

  if (getObjAffectVal() && (ch == 'P'))
  {
    editObjAffect3Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff4 flag

  if (getObjAffectVal() && (ch == 'Q'))
  {
    editObjAffect4Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // change limit

  if (ch == 'L')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString(
"&+CNew limit on loads for this object type (0 = no limit): &n");

    itoa(getNumbEntities(ENTITY_OBJECT, obj->objNumber, TRUE), numbStrn, 10);
//    strn[0] = '\0';

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if (!strnumer(strn))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);
    if ((i <= getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE)) && (i != 0))
    {
      _settextposition(coords.row, 1);
      clrline(coords.row, 7, 0);
      _setbkcolor(0);

      displayColorString(
"&+CError: Limit being set lower than or equal to the number loaded - press any key&n");

      getkey();

      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    setEntityOverride(ENTITY_OBJECT, obj->objNumber, i, obj->globalmaxload);
    obj->maxload = i;

    madeChanges = TRUE;

    displayEditObjTypeMenu(obj);
  }
  else
  if (ch == 'R')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString(
"&+CNew MUD-wide limit on loads for this object type (0 = no limit): &n");

    itoa(getNumbEntities(ENTITY_OBJECT, obj->objNumber, TRUE), numbStrn, 10);
//    strn[0] = '\0';

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if (!strnumer(strn))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);
    if ((i <= getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE)) && (i != 0))
    {
      _settextposition(coords.row, 1);
      clrline(coords.row, 7, 0);
      _setbkcolor(0);

      displayColorString(
"&+CError: Limit being set lower than or equal to the number loaded - press any key&n");

      getkey();

      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    setEntityOverride(ENTITY_OBJECT, obj->objNumber, obj->maxload, i);
    obj->globalmaxload = i;

    madeChanges = TRUE;

    displayEditObjTypeMenu(obj);
  }

  else

 // change vnum

  if ((ch == 'V') && !obj->defaultObj)
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    sprintf(strn, "&+YNew object vnum (highest allowed %u): &n",
            numbLookupEntries - 1);
    displayColorString(strn);

    itoa(obj->objNumber, numbStrn, 10);

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if ((!strnumer(strn)) || (atoi(strn) >= numbLookupEntries) ||
        (findObj(atoi(strn))))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);

    resetAllObjHere(obj->objNumber, i, roomHead);
    resetNumbLoaded(ENTITY_OBJECT, obj->objNumber, i);

    checkAndFixRefstoObj(obj->objNumber, i);

    objLookup[i] = origObj;
    objLookup[obj->objNumber] = NULL;

    obj->objNumber = i;

    resetEntityPointersByNumb(TRUE, FALSE);

    _settextposition(1, 1);

    clrline(1, 0, 0);
    fixObjName(obj->objShortName, newName);

    _setbkcolor(0);
    sprintf(strn, "&n&+gEditing object type #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n",
            obj->objNumber, newName);

    displayColorString(strn);

    clrline(coords.row, 7, 0);
    _settextposition(coords.row, 1);

    displayColorString(getMenuPromptName());
  }
  else

 // quit

  if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE;

  return FALSE;
}