Ejemplo n.º 1
0
Archivo: Utils.cpp Proyecto: yzf/Parser
_formula* Utils::_thetaReplace(const vector<int>& _preMiniPredicates, 
                const vector<int>& _curMiniPredicates, const vector<int>& _otherPredicates,
                const int& _rId, const int& _index, _formula* _fml, _formula* _fatherFml) {
    assert(_fml);
    switch (_fml->formula_type) {
        case ATOM:
            if (NULL != _fatherFml && NEGA == _fatherFml->formula_type) {
                if (isInList(_fml->predicate_id, _curMiniPredicates)) {
                    // p->r 替换 ~p
                    _fatherFml->formula_type = IMPL;
                    _fatherFml->subformula_r = compositeToAtom(_rId, NULL);
                }
                else if (isInList(_fml->predicate_id, _otherPredicates)) {
                    // Q_j_vary->r 替换 ~Q
                    const char* qName = Vocabulary::instance().getNameById(_fml->predicate_id, PREDICATE);
                    char qVaryName[64];
                    sprintf(qVaryName, "%s_%d%s", qName, _index, VARY_PREDICATE_POSTFIX);
                    // ->
                    _fatherFml->formula_type = IMPL;
                    // Q_j_vary
                    int qVaryId = Vocabulary::instance().getSymbolId(qVaryName, PREDICATE);
                    assert(qVaryId != -1);
                    _fatherFml->subformula_l->predicate_id = qVaryId;
                    // r
                    _fatherFml->subformula_r = compositeToAtom(_rId, NULL); 
                }
            }
            else { // Q_j_vary  替换 Q,Q_j_vary属于内涵谓词
                if (isInList(_fml->predicate_id, _otherPredicates)) {
                    const char* qName = Vocabulary::instance().getNameById(_fml->predicate_id, PREDICATE);
                    char qVaryName[64];
                    sprintf(qVaryName, "%s_%d%s", qName, _index,  VARY_PREDICATE_POSTFIX);
                    int qVaryId = Vocabulary::instance().getSymbolId(qVaryName, PREDICATE);
                    assert(qVaryId != -1);
                    _fml->predicate_id = qVaryId;
                }
                // ~~p 替换 p
                else if (isInList(_fml->predicate_id, _preMiniPredicates)) {
                    _fml = compositeByConnective(NEGA, _fml);
                    _fml = compositeByConnective(NEGA, _fml);
                }
            }
            break;
        case IMPL:
        case CONJ:
        case DISJ:
            _fml->subformula_r = _thetaReplace(_preMiniPredicates, _curMiniPredicates, _otherPredicates, 
                    _rId, _index, _fml->subformula_r, _fml);
        case UNIV:
        case EXIS:
        case NEGA:
            _fml->subformula_l = _thetaReplace(_preMiniPredicates, _curMiniPredicates, _otherPredicates, 
                    _rId, _index, _fml->subformula_l, _fml);
            break;
        default:
            assert(0);
    }
    return _fml;
}
Ejemplo n.º 2
0
bool AStar::judgeSurround(const ASCOORD& coord,const ASCOORD& parentCoord,int G)
{
	if(!isInList(m_closeList,coord) && !m_mark.isMask(coord._y,coord._x))
	{
		StepData* pSD = findFromList(m_openList,coord);
		if (pSD && pSD->_g > G)
		{
			pSD->_g = G;
			pSD->_parentCoord = parentCoord;
		}
		else if(!pSD)
		{
			StepData newSD(coord);
			newSD._g = G;
			newSD._h = computeH(coord);
			newSD._parentCoord = parentCoord;

			m_openList.push_back(newSD);

			if(newSD._coord == m_start)
				return true;
		}
	}

	return false;
}
Ejemplo n.º 3
0
int main(int argc, char* argv[]) {
  uint32_t limit  = 1000000; /* default */
  uint32_t target = 60;      /* default */
  uint32_t i,found,cycle,startVal,prevVal,currVal;

  if(argc > 1 && !strcmp(argv[1],"--help")) { return print_help(argv[0]); }
  if(argc > 1) {  sscanf(argv[1],"%u",&limit ); }
  if(argc > 2) {  sscanf(argv[2],"%u",&target); }

  initializeMemotizationTable(limit);

  for(i=found=0; i<limit; ++i) {
    if(memo_data[i] == UNSET) { /* not yet calculated */
      startVal = prevVal = currVal = i;
      /* loop until pre-calculated value found */
      /*  OR  until cycle generated */
      for(cycle=0; !cycle && memo_data[currVal]==UNSET;) { /* value not-pre-calculated */
        prevVal = currVal;
        currVal = digitFactorial(currVal);
        cycle   = isInList(startVal,currVal);
        memo_next[prevVal] = currVal;
      }
      setChainLengths(startVal,currVal);
    }
    if(memo_data[i]==target)
      ++found;
  }
  printf("Digit Factorial Chains (non-repeating) of length %u: %u\n",target, found);
  return 0;
}
Ejemplo n.º 4
0
uint32_t isInList(const uint32_t cVal, const uint32_t tVal) {
  if(cVal==UNSET)
    return 0;
  if(cVal==tVal)
    return 1;
  return isInList(memo_next[cVal], tVal);
}
Ejemplo n.º 5
0
LangType Buffer::getLangFromExt(const char *ext)
{
	NppParameters *pNppParam = NppParameters::getInstance();
	int i = pNppParam->getNbLang();
	i--;
	while (i >= 0)
	{
		Lang *l = pNppParam->getLangFromIndex(i--);

		const char *defList = l->getDefaultExtList();
		const char *userList = NULL;

		LexerStylerArray &lsa = pNppParam->getLStylerArray();
		const char *lName = l->getLangName();
		LexerStyler *pLS = lsa.getLexerStylerByName(lName);
		
		if (pLS)
			userList = pLS->getLexerUserExt();

		std::string list("");
		if (defList)
			list += defList;
		if (userList)
		{
			list += " ";
			list += userList;
		}
		if (isInList(ext, list.c_str()))
			return l->getLangID();
	}
	return L_TXT;
}
Ejemplo n.º 6
0
/*---------------------------------------------------------------------------*/
csr_list_result csr_list_remove(csr_list* list, csr_list_node* node)
{
    require(TR_CSR_LIST, list != NULL);
    require(TR_CSR_LIST, node != NULL);
    require(TR_CSR_LIST, isInList(list, node) != NULL); /*lint !e666 */

    if (list->head == node)
    {
        list->head = node->next;
        if (list->head == NULL)
        {
            list->tail = NULL;
        }
        DELETE_NODE(node);
    }
    else
    {
        csr_list_node* prevnode = findPrevNode(list, node);
        if (prevnode == NULL)
        {
            return csr_list_not_found;
        }
        prevnode->next = node->next;
        if (prevnode->next == NULL)
        {
            list->tail = prevnode;
        }
        DELETE_NODE(node);
    }
    list->count--;
    return csr_list_success;
}
Ejemplo n.º 7
0
void World::doAStar()
{
    CellVector openlist, closedlist;

    //add starting node to open list
    openlist.push_back(mBeginNode);

    //add walkable nodes to open list
    populateOpenList(mBeginNode, mEndNode, openlist, closedlist);

    //remove starting node from open list, add it to closed list
    switchLists(mBeginNode, openlist, closedlist);

    while(!isInList(mEndNode, closedlist)) {
        //get lowest fval cell
        GridCell* lowest_fval_cell = getLowestFValCell(openlist);

        //remove lowest fval cell from openlist & put in closed list
        switchLists(lowest_fval_cell, openlist, closedlist);

        //add walkable nodes next to lowest_fval_cell to open list
        populateOpenList(lowest_fval_cell, mEndNode, openlist, closedlist);
    }

    for(auto cell : closedlist) {
        cell->setColor(sf::Color::White);
    }

    mBeginNode->setColor(sf::Color::Green);
    mEndNode->setColor(sf::Color::Red);
}
Ejemplo n.º 8
0
void AutoCompletion::getWordArray(vector<generic_string> & wordArray, TCHAR *beginChars)
{
	const size_t bufSize = 256;

	generic_string expr(TEXT("\\<"));
	expr += beginChars;
	expr += TEXT("[^ \\t\\n\\r.,;:\"()=<>'+!\\[\\]]*");

	int docLength = int(_pEditView->execute(SCI_GETLENGTH));

	int flags = SCFIND_WORDSTART | SCFIND_MATCHCASE | SCFIND_REGEXP | SCFIND_POSIX;

	_pEditView->execute(SCI_SETSEARCHFLAGS, flags);
	int posFind = _pEditView->searchInTarget(expr.c_str(), expr.length(), 0, docLength);

	while (posFind != -1 && posFind != -2)
	{
		int wordStart = int(_pEditView->execute(SCI_GETTARGETSTART));
		int wordEnd = int(_pEditView->execute(SCI_GETTARGETEND));

		size_t foundTextLen = wordEnd - wordStart;
		if (foundTextLen < bufSize)
		{
			TCHAR w[bufSize];
			_pEditView->getGenericText(w, bufSize, wordStart, wordEnd);

			if (lstrcmp(w, beginChars) != 0)
				if (!isInList(w, wordArray))
					wordArray.push_back(w);
		}
		posFind = _pEditView->searchInTarget(expr.c_str(), expr.length(), wordEnd, docLength);
	}
}
Ejemplo n.º 9
0
BOOL FLEXlm::shouldCheckout(CString feature)
{
   if (m_sAvailLicFName.IsEmpty()) return TRUE;

   if (m_bCreateLicList) return TRUE;

   return isInList(feature);
}
Ejemplo n.º 10
0
/*---------------------------------------------------------------------------*/
csr_list_node* csr_list_getnext_void(csr_list* list, csr_list_node* node)
{
    require(TR_CSR_LIST, list != NULL);
    require(TR_CSR_LIST, node != NULL);
    require(TR_CSR_LIST, isInList(list, node) != NULL); /*lint !e666 */

    return node->next;
}
Ejemplo n.º 11
0
/*
* Requires parent cell, end node, open and closed lists
* sets the cell's h, g, f values as well as its parent
* puts the cell in the open list
*/
int populateOpenList(GridCell* parent, GridCell* destination, std::vector<GridCell*>& open_list, std::vector<GridCell*>& closed_list)
{
    for(auto cell : parent->getNeighbors()) {
        if(cell->getWalkable() && cell != parent && !isInList(cell, closed_list)) {
            //check if cell is in open list already
            if(isInList(cell, open_list)) {
                //wut?????? if x + y > x??
                int new_gval = cell->mGValue + parent->mGValue;
                if(new_gval < parent->mGValue) {
                    cell->mParent = parent;
                    getGValue(parent, destination, cell);
                }
            }
            else {
                getGValue(parent, destination, cell);
                cell->mParent = parent;
                open_list.push_back(cell);
            }
        }
    }
}
Ejemplo n.º 12
0
/*public static*/
const Coordinate&
EdgeRing::ptNotInList(const CoordinateSequence* testPts,
                      const CoordinateSequence* pts)
{
    const std::size_t npts = testPts->getSize();
    for(std::size_t i = 0; i < npts; ++i) {
        const Coordinate& testPt = testPts->getAt(i);
        if(!isInList(testPt, pts)) {
            return testPt;
        }
    }
    return Coordinate::getNull();
}
Ejemplo n.º 13
0
void DocumentTimeline::NotifyAnimationUpdated(Animation& aAnimation) {
  AnimationTimeline::NotifyAnimationUpdated(aAnimation);

  if (!mIsObservingRefreshDriver) {
    nsRefreshDriver* refreshDriver = GetRefreshDriver();
    if (refreshDriver) {
      MOZ_ASSERT(isInList(),
                 "We should not register with the refresh driver if we are not"
                 " in the document's list of timelines");

      ObserveRefreshDriver(refreshDriver);
    }
  }
}
Ejemplo n.º 14
0
/*public static*/
const Coordinate&
EdgeRing::ptNotInList(const CoordinateSequence *testPts,
                      const CoordinateSequence *pts)
{
    const std::size_t npts = testPts->getSize();
    for (std::size_t i = 0; i < npts; ++i)
    {
        const Coordinate& testPt = testPts->getAt(i);
        // TODO: shouldn't this be ! isInList ?
        if (isInList(testPt, pts))
            return testPt;
    }
    return Coordinate::getNull();
}
Ejemplo n.º 15
0
bool AutoCompletion::showApiAndWordComplete()
{
	int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS));
	int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true));

	if (curPos == startPos)
		return false;

	const size_t bufSize = 256;
	TCHAR beginChars[bufSize];
	
	size_t len = (curPos > startPos)?(curPos - startPos):(startPos - curPos);
	if (len >= bufSize)
		return false;

	// Get word array
	vector<generic_string> wordArray;
	_pEditView->getGenericText(beginChars, bufSize, startPos, curPos);

	getWordArray(wordArray, beginChars);


	for (size_t i = 0, len = _keyWordArray.size(); i < len; ++i)
	{
		if (_keyWordArray[i].find(beginChars) == 0)
		{
			if (!isInList(_keyWordArray[i], wordArray))
				wordArray.push_back(_keyWordArray[i]);
		}
	}

	sort(wordArray.begin(), wordArray.end());

	// Get word list
	generic_string words(TEXT(""));

	for (size_t i = 0, len = wordArray.size(); i < len; ++i)
	{
		words += wordArray[i];
		if (i != wordArray.size()-1)
			words += TEXT(" ");
	}

	_pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' '));
	_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
	_pEditView->showAutoComletion(curPos - startPos, words.c_str());

	return true;
}
Ejemplo n.º 16
0
void
DocumentTimeline::NotifyRefreshDriverCreated(nsRefreshDriver* aDriver)
{
  MOZ_ASSERT(!mIsObservingRefreshDriver,
             "Timeline should not be observing the refresh driver before"
             " it is created");

  if (!mAnimationOrder.isEmpty()) {
    MOZ_ASSERT(isInList(),
               "We should not register with the refresh driver if we are not"
               " in the document's list of timelines");
    aDriver->AddRefreshObserver(this, Flush_Style);
    mIsObservingRefreshDriver = true;
  }
}
Ejemplo n.º 17
0
/*---------------------------------------------------------------------------*/
void csr_list_insert_head(csr_list* list, csr_list_memory_ownership ownership, csr_list_node* node, void* value)
{
    require(TR_CSR_LIST, list != NULL);
    require(TR_CSR_LIST, node != NULL);
    require(TR_CSR_LIST, value != NULL);
    require(TR_CSR_LIST, isInList(list, node) == NULL); /*lint !e666 */

    INIT_NODE(node, list->head, ownership, value);

    if (list->head == NULL)
    {
        list->tail = node;
    }
    list->head = node;
    list->count++;
}
Ejemplo n.º 18
0
void DocumentTimeline::NotifyRefreshDriverCreated(nsRefreshDriver* aDriver) {
  MOZ_ASSERT(!mIsObservingRefreshDriver,
             "Timeline should not be observing the refresh driver before"
             " it is created");

  if (!mAnimationOrder.isEmpty()) {
    MOZ_ASSERT(isInList(),
               "We should not register with the refresh driver if we are not"
               " in the document's list of timelines");
    ObserveRefreshDriver(aDriver);
    // Although we have started observing the refresh driver, it's possible we
    // could perform a paint before the first refresh driver tick happens.  To
    // ensure we're in a consistent state in that case we run the first tick
    // manually.
    MostRecentRefreshTimeUpdated();
  }
}
Ejemplo n.º 19
0
/*---------------------------------------------------------------------------*/
void csr_list_insert_after(csr_list* list, csr_list_memory_ownership ownership, csr_list_node* existingnode, csr_list_node* node, void* value)
{
    require(TR_CSR_LIST, list != NULL);
    require(TR_CSR_LIST, existingnode != NULL);
    require(TR_CSR_LIST, node != NULL);
    require(TR_CSR_LIST, value != NULL);
    require(TR_CSR_LIST, isInList(list, existingnode) != NULL); /*lint !e666 */

    INIT_NODE(node, existingnode->next, ownership, value);

    existingnode->next = node;

    if (list->tail == existingnode)
    {
        list->tail = node;
    }
    list->count++;
}
Ejemplo n.º 20
0
FUNCTION int Q4ZV(obj Q5HY, obj pet)
{
  list Q48U;
  if(!hasObjListVar(pet, "myBoss"))
  {
    return(0x00);
  }
  getObjListVar(Q48U, pet, "myBoss");
  if(!isInList(Q48U, Q5HY))
  {
    return(0x00);
  }
  if(!hasObjVar(pet, "myLoyalty"))
  {
    return(0x00);
  }
  int myLoyalty = getObjVar(pet, "myLoyalty");
  if(myLoyalty < 0x01)
  {
    return(0x00);
  }
  return(0x01);
}
Ejemplo n.º 21
0
static inline UBool isDigit(char c) {return isInList(c, DIGIT_CHAR);}
Ejemplo n.º 22
0
bool AutoCompletion::showWordComplete(bool autoInsert) 
{
	int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS));
	int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true));

	if (curPos == startPos)
		return false;

	const size_t bufSize = 256;
	size_t len = (curPos > startPos)?(curPos - startPos):(startPos - curPos);
	if (len >= bufSize)
		return false;

	TCHAR beginChars[bufSize];

	_pEditView->getGenericText(beginChars, startPos, curPos);

	generic_string expr(TEXT("\\<"));
	expr += beginChars;
	expr += TEXT("[^ \\t.,;:\"()=<>'+!\\[\\]]*");

	int docLength = int(_pEditView->execute(SCI_GETLENGTH));

	int flags = SCFIND_WORDSTART | SCFIND_MATCHCASE | SCFIND_REGEXP | SCFIND_POSIX;

	_pEditView->execute(SCI_SETSEARCHFLAGS, flags);
	vector<generic_string> wordArray;
	int posFind = _pEditView->searchInTarget(expr.c_str(), 0, docLength);

	while (posFind != -1)
	{
		int wordStart = int(_pEditView->execute(SCI_GETTARGETSTART));
		int wordEnd = int(_pEditView->execute(SCI_GETTARGETEND));
		
		size_t foundTextLen = wordEnd - wordStart;

		if (foundTextLen < bufSize)
		{
			TCHAR w[bufSize];
			_pEditView->getGenericText(w, wordStart, wordEnd);

			if (lstrcmp(w, beginChars))
				if (!isInList(w, wordArray))
					wordArray.push_back(w);
		}
		posFind = _pEditView->searchInTarget(expr.c_str(), wordEnd, docLength);
	}
	if (wordArray.size() == 0) return false;

	if (wordArray.size() == 1 && autoInsert) 
	{
		_pEditView->replaceTargetRegExMode(wordArray[0].c_str(), startPos, curPos);
		_pEditView->execute(SCI_GOTOPOS, startPos + wordArray[0].length());
		return true;
	}

	sort(wordArray.begin(), wordArray.end());
	generic_string words(TEXT(""));

	for (size_t i = 0 ; i < wordArray.size() ; i++)
	{
		words += wordArray[i];
		if (i != wordArray.size()-1)
			words += TEXT(" ");
	}

	// UNICODE TO DO
	_pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' '));
	_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
	_pEditView->showAutoComletion(curPos - startPos, words.c_str());

	_activeCompletion = CompletionWord;
	return true;
}
Ejemplo n.º 23
0
bool AutoCompletion::showWordAndFuncComplete() 
{
	int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS));
	int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true));

	if (curPos == startPos)
		return false;

	const size_t bufSize = 256;
	size_t len = (curPos > startPos)?(curPos - startPos):(startPos - curPos);
	if (len >= bufSize)
		return false;

	TCHAR beginChars[bufSize];

	_pEditView->getGenericText(beginChars, startPos, curPos);

	generic_string expr(TEXT("\\<"));
	expr += beginChars;
	expr += TEXT("[^ \\t.,;:\"()=<>'+!\\[\\]]*");

	int docLength = int(_pEditView->execute(SCI_GETLENGTH));

	int flags = SCFIND_WORDSTART | SCFIND_MATCHCASE | SCFIND_REGEXP | SCFIND_POSIX;

	_pEditView->execute(SCI_SETSEARCHFLAGS, flags);
	vector<generic_string> wordArray;
	int posFind = _pEditView->searchInTarget(expr.c_str(), 0, docLength);

	while (posFind != -1)
	{
		int wordStart = int(_pEditView->execute(SCI_GETTARGETSTART));
		int wordEnd = int(_pEditView->execute(SCI_GETTARGETEND));
		
		size_t foundTextLen = wordEnd - wordStart;

		if (foundTextLen < bufSize)
		{
			TCHAR w[bufSize];
			_pEditView->getGenericText(w, wordStart, wordEnd);

			if (lstrcmp(w, beginChars))
				if (!isInList(w, wordArray))
					wordArray.push_back(w);
		}
		posFind = _pEditView->searchInTarget(expr.c_str(), wordEnd, docLength);
	}

	/////////////////////////////////////////////////////////////////
	// 把符合条件的关键字插入单词队列中
    size_t posi = 0;
	size_t posj = _keyWords.find("\n");
	while(posj != string::npos)
	{
		generic_string keyword = _keyWords.substr(posi, posj-posi);
		if (keyword.find(beginChars) == 0)
		{
			if (!isInList(_keyWords.substr(posi, posj-posi), wordArray))
			{
				wordArray.push_back(_keyWords.substr(posi, posj-posi));
			}
		}
		posi = ++posj;
		posj = _keyWords.find("\n", posj);
		//find start from position posj
	}
	/////////////////////////////////////////////////////////////////

	if (wordArray.size() == 0) return false;

	sort(wordArray.begin(), wordArray.end());
	generic_string words(TEXT(""));

	for (size_t i = 0 ; i < wordArray.size() ; i++)
	{
		words += wordArray[i];
		if (i != wordArray.size()-1)
			words += TEXT(" ");
	}

	// UNICODE TO DO
	_pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' '));
	_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
	_pEditView->showAutoComletion(curPos - startPos, words.c_str());

	_activeCompletion = CompletionWord;
	return true;
}
Ejemplo n.º 24
0
void FLEXlm::addToCheckList(CString feature)
{
   if (m_sAvailLicFName.IsEmpty()) return;

   if (!isInList(feature)) m_saLicsToCheck.Add(feature);
}
Ejemplo n.º 25
0
static inline UBool isSpecialAsciiChar(char c) {return isInList(c,SPECIAL);}
Ejemplo n.º 26
0
float calculate_clustering_cost(int **InputDsm, int size)
{
    float ans = -1.0;

    int **dsm;
    dsm = (int**) malloc(sizeof(int*)*size);
    int row;
    for(row=0;row<size;row++){
	dsm[row] = (int*)malloc(sizeof(int)*size);
    }

    //dsm = InputDsm;
    //memcpy(dsm, InputDsm,sizeof(int)*size*size);
    //Copy input dsm to dsm
    int i,j;
    for(i=0;i<size;i++){
	for(j=0;j<size;j++){
	    dsm[i][j]=InputDsm[i][j];
	    //printf("%i,",dsm[i][j]);
	}
	//printf("\n");
    }



    int *buses;
    buses = malloc(sizeof(int));
    int busesSize=0;
    int *coordsX;
    int *coordsY;
    coordsX= malloc(sizeof(int));
    coordsY= malloc(sizeof(int));
    int coordsSize=0;
    int *coordsProjected;
    coordsProjected = malloc(sizeof(int));
    int *coordsProjectedX;
    coordsProjectedX = malloc(sizeof(int));
    int coordsProjectedSize=0;
 
 
 
    //STEP 1. GET VERTICAL BUSES 
    //calculateVerticalBuses( dsm, &size, ALPHA, &buses, &busesSize, &coordsX, &coordsY, &coordsSize, &coordsProjected, &coordsProjectedSize);	
    int colCount;
    float x,y,z,w;
    


   //Calibration with different alpha values
   int al[7] = {40,35,30,25,20,15,10};
   //int al[7] = {10,15,20,25,30,35,40};
   double delta = (size*15)/100;
   int aa,exit=0,last=0,lastt=0;
   for(aa=0;aa<7;aa++)
   {
     int alpha = al[aa];
     for(i=0; i<size; i++)
     {
	if(aa==0)
	{
	    colCount=0;
	    for(j=0;j<size;j++){
		
	        if(dsm[i][j] != 0){
		    colCount +=1;
                    coordsX = realloc(coordsX,sizeof(int)*(coordsSize+1));
                    coordsY = realloc(coordsY,sizeof(int)*(coordsSize+1));
	 	    coordsX[coordsSize]=i;
	 	    coordsY[coordsSize]=j;
		    coordsSize+=1;

  		    coordsProjected = realloc(coordsProjected, sizeof(int)*(coordsProjectedSize+1));
		    coordsProjected[coordsProjectedSize] = i;
  		    coordsProjectedX = realloc(coordsProjectedX, sizeof(int)*(coordsProjectedSize+1));
		    coordsProjectedX[coordsProjectedSize] = j;
		    coordsProjectedSize+=1;
	         }
	    }
	}
	if(colCount!=0){
	    y = (float)colCount;
	    z = (float)size;
	    w = (float) 100/z;
	    x = (float)w*y;
	    if(x>alpha){
   		//printf("busesSize:%i\n",busesSize);		
		buses = realloc(buses,sizeof(int)*(busesSize+1));
		buses[busesSize]=i;
		busesSize+=1;
	    }
	    y,z,w,x=0; 	
	}
    } 
     printf("num buses: %i with alpha :%i last:%i\n", busesSize,alpha,last); 
     //last posbility - stay with this result from aa==7
     if(exit==1 || aa==7)
	break;
     else if((busesSize)>delta)
     {
	//With biggest alpha we have already a significant amount of buses
	if(aa==0)
	    break; 	
	 //Go back and recalculate last buses resulta based on alpha aa-1 
	 aa-=2;	
	 exit=1;
     }
     else
	last=busesSize;
     //RESTART ALL VALUES
     busesSize=0;
     buses = realloc(buses,sizeof(int));		
}

    //STEP 2. REMOVE DEPENDENCIES RELATED TO BUSES	

    int deletes=0;
    //int i;
    for(i=0;i<coordsSize;i++){
        //printf("x 0: %i \n", coordsX[i]);  
	if((int)isInList(coordsX[i], buses, busesSize)==1)
	{
	    //printf("entro\n");
	    remove_element(coordsProjected, coordsProjectedSize, i-deletes);
	    coordsProjectedSize-=1;
	    deletes+=1;	    
	}
    }

   printf("num buses: %i\n", busesSize); 
   printf("num coords: %i\n", coordsSize); 
   //printf("bus 0: %i \n", buses[0]);  
   //printArray(buses,busesSize);
   //printArray(coordsX,coordsSize);
   //printArray(coordsY,coordsSize);
   //printArray(coordsProjected,coordsProjectedSize);
   //printArray(coordsProjectedX,coordsProjectedSize);

   //STEP 3. FIND CLUSTERS FROM DEPENDENCIES
   
   int **clusterBEST;
   int *clusterSizeBEST;
   int greater=0;
   clusterSizeBEST = (int*)malloc(sizeof(int));
   clusterBEST =(int**)malloc(sizeof(int*));
   int sseBEST=-1;
   int numClustersBEST=0; 

   int numClusters;
   float **obj;
   float **clusters;
   int **cluster;
   int *clusterSize;
   int *membership;
   float *sortedCent;

   int ks[8]={2,3,4,6,8,12,16,20};
   int k;	
   for(k=0;k<8;k++)
   { 

   numClusters = ks[k];

   if(numClusters>coordsProjectedSize){
	return -1;
   }
   obj = malloc(coordsProjectedSize*sizeof(float*));
   int rr;
   for(rr=0;rr<coordsProjectedSize;rr++){
       obj[rr]= malloc(sizeof(float));
       obj[rr][0]=coordsProjected[rr]; 
   }

   membership = (int*)malloc(coordsProjectedSize*sizeof(int));
   clusters =  seq_kmeans(obj, 1 ,coordsProjectedSize, numClusters, 0.001 , membership);
   
   //STEP 4. SORT ASCENDING THE CENTROIDS
   int sortSize=0;
   sortedCent = malloc(numClusters*sizeof(float));
   for(i=0;i<numClusters;i++)
	sortedCent[i]=-1;
   
   int ult =-1;
   for(i=0;i<numClusters;i++){
	if(ult!=-1){
	    for(j=0;j<sortSize;j++){
		if(clusters[i][0]<sortedCent[j]){
		    add_element(sortedCent, sortSize, (float) clusters[i][0], j);
		    //sortedCent[j]=clusters[i][0];
		    sortSize+=1;
		    ult= i;
                    break;
		}
	    }
	    if(ult!=i)
	    {
		add_element(sortedCent, sortSize, clusters[i][0], sortSize);
		//sortedCent[sortSize]=clusters[i][0];
		sortSize+=1;
	    }
	}
 	else{
 	    add_element(sortedCent, sortSize, clusters[i][0], 0);
	    //sortedCent[sortSize]=clusters[i][0];
	    sortSize+=1;
	    ult=i;
	}
   } 

  

   /*   
   printf("centroid 0 %f\n", clusters[0][0]);
   printf("centroid 1 %f\n", clusters[1][0]);
   printf("centroid 2 %f\n", clusters[2][0]);
   printf("sort centroid 0 %f\n", sortedCent[0]);
   printf("sort centroid 1 %f\n", sortedCent[1]);
   printf("sort centroid 2 %f\n", sortedCent[2]);
   */

   //Asign X,Y dependency coordinates to each identify cluster   
   cluster = (int**)malloc((numClusters+1)*sizeof(int*));
   clusterSize = (int*)malloc((numClusters+1)*sizeof(int));
   for(row=0;row<numClusters+1;row++)
   {
       cluster[row]=(int*)malloc(sizeof(int));
       clusterSize[row]=0;
   }
   float limitA, limitB; 
   int sse=0;
   for(i=0;i<coordsProjectedSize;i++)
   {
	//CHECK first if dependency is not outside the cluster extricly in the diagonal of the dsm
	int clNum = membership[i];
	float cc = clusters[clNum][0];
        int indx;
	indx = getIndexCluster(sortedCent, numClusters , cc);
	float lastCentroid=0,centroid=0,nextCentroid=0;

	//printArrayFloat(sortedCent,numClusters);
	centroid=cc;
	if(indx!=0 && indx!=-1)
	    lastCentroid = sortedCent[indx-1];
	else
            lastCentroid=0.0;
 	if(indx!=numClusters-1 && indx!=-1)
	    nextCentroid = sortedCent[indx+1];
	else
            nextCentroid=size;
	    
	//printf("lastC:%f  cent:%f next:%f\n",lastCentroid,centroid,nextCentroid);	

	if(lastCentroid>centroid)
	   printf("********LIST NOT ORDENED!!!");

	if(indx==0)
	   limitA=0;
	else
	   limitA = ((centroid-lastCentroid)/2.0)+lastCentroid ;

	if(indx==numClusters-1)
	   limitB=size;
	else
	   limitB = ((nextCentroid-centroid)/2.0)+centroid;

	int y = coordsProjected[i];
	int x = coordsProjectedX[i];
	//printf("y:%i x:%i  limitA:%f limitB:%f\n",y, x,limitA, limitB);
 	
	//printf("limA:%d limB:%d coordY:%i coordX:%i\n", limitA,limitB, coordsProjected[i],coordsProjectedX[i]);	
	if(y>=limitA && y<=limitB && x>=limitA && x<=limitB)
        {
	    cluster[membership[i]]=realloc(cluster[membership[i]], sizeof(int)*(clusterSize[membership[i]]+1));
	    cluster[membership[i]][clusterSize[membership[i]]]=coordsProjected[i];
 	    clusterSize[membership[i]]+=1;
	}
        else
	{
	    //Dependency has no cluster, added to las cluster list for extra penatilization
	    //printf("no in cluster really\n");
	    cluster[numClusters]=realloc(cluster[numClusters], sizeof(int)*(clusterSize[numClusters]+1));
	    cluster[numClusters][clusterSize[numClusters]]=coordsProjected[i];
 	    clusterSize[numClusters]+=1;
	}
 	//Evaluate number of clusters by SSE (sum of squared error)
	int  cl = membership[i];
	int yCl = clusters[cl][0];
	int dis = abs(coordsProjected[i]-yCl);	
        sse+=pow(dis,2);

	//printf("cluster num:%i with size:%i - dep in y=%i centroid in:%i dis:%i sse:%i\n", membership[i],clusterSize[membership[i]], coordsProjected[i],yCl,dis,sse );
   }		
   int skip =0;
   //LOCK FOR THREASHOLD ON CHANGE LESS THAN 20%
   if(sseBEST!=-1 && sseBEST*THH>sseBEST-sse)
   {
    //break;
    skip=1;
    }  

  
   printf("SSE for %i clusters : %i \n", numClusters, sse); 
   if((sseBEST>sse || sseBEST==-1) && skip==0){

	//free last cluster info first
	if(sseBEST!=-1){
	    int row;
	    for(row=0;row<greater+1;row++)
	    {
	      free(clusterBEST[row]);
	    }
        }
	numClustersBEST = numClusters;
	clusterSizeBEST = (int*)realloc(clusterSizeBEST,(numClusters+1)*sizeof(int));
	clusterBEST =(int**)realloc(clusterBEST,(numClusters+1)*sizeof(int*));
	int r,q;
	for(r=0;r<numClusters+1;r++)
	{
	    int ct;
	    if(r!=numClusters)
	       ct = membership[r];
	    else
	       ct = numClusters;

	    int g = clusterSize[r];
	    greater = numClusters;
	    //printf("size cluster r:%i is :%i\n",r,g);
	    clusterBEST[r]= malloc(g*sizeof(int));
	    clusterSizeBEST[r]=g;
	    for(q=0;q<g;q++)
	    {
		clusterBEST[r][q] = cluster[r][q];
	    }
	}
        sseBEST=sse;
   }

    for(row=0;row<coordsProjectedSize;row++)
    {
	free(obj[row]);
    }
    free(obj);
    
 
    free(clusters[0]);
    free(clusters);
    free(membership);
    for(row=0;row<numClusters+1;row++)
    {
	free(cluster[row]);
    }
    free(cluster);
    free(clusterSize);
    free(sortedCent);

    if(skip==1)
	break;

  }//End loop to find best k for kmenas with sse


   printf("BEST SSE for %i clusters : %i\n", numClustersBEST, sseBEST); 


  //CLUSTERING COST
  //IMPORTANT! DEPENDENCEIS OUTSIDE ANY CLUSTER ARE IN cluster[NumCluster], that is in last "cluster"
  float cost =0;
  float clusterCost;
  float depCost;
  for(i=0;i<numClustersBEST+1;i++)
  {  clusterCost=0; 

      for(j=0;j<clusterSizeBEST[i];j++)
      {
          depCost=0;
	  if(isInList(clusterBEST[i][j],buses,busesSize)==1)
	     depCost =1;
 	  else
	  {
	      //cluster[i][j] show the j depdendency, based on the coordsX,Y numeration from cluster number i
	      if((isInList(clusterBEST[i][j],clusterBEST[i],clusterSizeBEST[i]==1)) && i!=(numClustersBEST+1))
	          depCost = pow(clusterSizeBEST[i],LAMD);
  	      else
	          depCost = pow(size, LAMD);
	  }
      clusterCost+=depCost;
      }
      cost+=clusterCost;
  }


  printf("CLUTERING COST: %f\n", cost);
  ans = cost;
 
    //printf("numClusters best free :%i\n",numClustersBEST);
    for(row=0;row<numClustersBEST+1;row++)
    {
	free(clusterBEST[row]);
    }
    free(clusterBEST);
    free(clusterSizeBEST);


    printf("Clustering cost calculated. free memory...");
    free(buses);

    free(coordsX);
    free(coordsY);
    free(coordsProjected);
    free(coordsProjectedX);
    for(row=0;row<size;row++)
    {
	free(dsm[row]);
    }
    free(dsm);
    printf("done\n");
	

   return ans;	
} 
Ejemplo n.º 27
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
{
	LPTSTR cmdLine = ::GetCommandLine();
	ParamVector params;
	parseCommandLine(cmdLine, params);

	MiniDumper mdump;	//for debugging purposes.

	bool TheFirstOne = true;
	::SetLastError(NO_ERROR);
	::CreateMutex(NULL, false, TEXT("nppInstance"));
	if (::GetLastError() == ERROR_ALREADY_EXISTS)
		TheFirstOne = false;

	bool isParamePresent;
	bool showHelp = isInList(FLAG_HELP, params);
	bool isMultiInst = isInList(FLAG_MULTI_INSTANCE, params);
	
	CmdLineParams cmdLineParams;
	cmdLineParams._isNoTab = isInList(FLAG_NOTABBAR, params);
	cmdLineParams._isNoPlugin = isInList(FLAG_NO_PLUGIN, params);
	cmdLineParams._isReadOnly = isInList(FLAG_READONLY, params);
	cmdLineParams._isNoSession = isInList(FLAG_NOSESSION, params);
	cmdLineParams._isPreLaunch = isInList(FLAG_SYSTRAY, params);
	cmdLineParams._alwaysOnTop = isInList(FLAG_ALWAYS_ON_TOP, params);
	cmdLineParams._showLoadingTime = isInList(FLAG_LOADINGTIME, params);
	cmdLineParams._isSessionFile = isInList(FLAG_OPENSESSIONFILE, params);
	cmdLineParams._isRecursive = isInList(FLAG_RECURSIVE, params);
	cmdLineParams._langType = getLangTypeFromParam(params);
	cmdLineParams._localizationPath = getLocalizationPathFromParam(params);
	cmdLineParams._line2go = getNumberFromParam('n', params, isParamePresent);
    cmdLineParams._column2go = getNumberFromParam('c', params, isParamePresent);
	cmdLineParams._point.x = getNumberFromParam('x', params, cmdLineParams._isPointXValid);
	cmdLineParams._point.y = getNumberFromParam('y', params, cmdLineParams._isPointYValid);
	
	if (showHelp)
	{
		::MessageBox(NULL, COMMAND_ARG_HELP, TEXT("Notepad++ Command Argument Help"), MB_OK);
	}

	NppParameters *pNppParameters = NppParameters::getInstance();
	
	if (cmdLineParams._localizationPath != TEXT(""))
	{
		pNppParameters->setStartWithLocFileName(cmdLineParams._localizationPath);
	}
	pNppParameters->load();

	// override the settings if notepad style is present
	if (pNppParameters->asNotepadStyle())
	{
		isMultiInst = true;
		cmdLineParams._isNoTab = true;
		cmdLineParams._isNoSession = true;
	}

	// override the settings if multiInst is choosen by user in the preference dialog
	const NppGUI & nppGUI = pNppParameters->getNppGUI();
	if (nppGUI._multiInstSetting == multiInst)
	{
		isMultiInst = true;
		// Only the first launch remembers the session
		if (!TheFirstOne)
			cmdLineParams._isNoSession = true;
	}

	generic_string quotFileName = TEXT("");
    // tell the running instance the FULL path to the new files to load
	size_t nrFilesToOpen = params.size();
	const TCHAR * currentFile;
	TCHAR fullFileName[MAX_PATH];

	for(size_t i = 0; i < nrFilesToOpen; ++i)
	{
		currentFile = params.at(i);
		if (currentFile[0])
		{
			//check if relative or full path. Relative paths dont have a colon for driveletter
			BOOL isRelative = ::PathIsRelative(currentFile);
			quotFileName += TEXT("\"");
			if (isRelative)
			{
				::GetFullPathName(currentFile, MAX_PATH, fullFileName, NULL);
				quotFileName += fullFileName;
			}
			else
			{
				if ((currentFile[0] == '\\' && currentFile[1] != '\\') || currentFile[0] == '/')
				{
					quotFileName += getDriveLetter();
					quotFileName += ':';
				}
				quotFileName += currentFile;
			}
			quotFileName += TEXT("\" ");
		}
	}

	//Only after loading all the file paths set the working directory
	::SetCurrentDirectory(NppParameters::getInstance()->getNppPath().c_str());	//force working directory to path of module, preventing lock

	if ((!isMultiInst) && (!TheFirstOne))
	{
		HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
		for (int i = 0 ;!hNotepad_plus && i < 5 ; ++i)
		{
			Sleep(100);
			hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
		}

        if (hNotepad_plus)
        {
		// First of all, destroy static object NppParameters
		pNppParameters->destroyInstance();
		MainFileManager->destroyInstance();

		int sw = 0;

		if (::IsZoomed(hNotepad_plus))
			sw = SW_MAXIMIZE;
		else if (::IsIconic(hNotepad_plus))
			sw = SW_RESTORE;

/* REMOVED
		else
			sw = SW_SHOW;

		// IMPORTANT !!!
		::ShowWindow(hNotepad_plus, sw);
DEVOMER*/
/* ADDED */
		if (sw != 0)
			::ShowWindow(hNotepad_plus, sw);
/* DEDDA */
		::SetForegroundWindow(hNotepad_plus);

		if (params.size() > 0)	//if there are files to open, use the WM_COPYDATA system
		{
			COPYDATASTRUCT paramData;
			paramData.dwData = COPYDATA_PARAMS;
			paramData.lpData = &cmdLineParams;
			paramData.cbData = sizeof(cmdLineParams);

			COPYDATASTRUCT fileNamesData;
			fileNamesData.dwData = COPYDATA_FILENAMES;
			fileNamesData.lpData = (void *)quotFileName.c_str();
			fileNamesData.cbData = long(quotFileName.length() + 1)*(sizeof(TCHAR));

			::SendMessage(hNotepad_plus, WM_COPYDATA, (WPARAM)hInstance, (LPARAM)&paramData);
			::SendMessage(hNotepad_plus, WM_COPYDATA, (WPARAM)hInstance, (LPARAM)&fileNamesData);
		}
		return 0;
        }
	}

	Notepad_plus_Window notepad_plus_plus;
	
	NppGUI & nppGui = (NppGUI &)pNppParameters->getNppGUI();

	generic_string updaterDir = pNppParameters->getNppPath();
	updaterDir += TEXT("\\updater\\");

	generic_string updaterFullPath = updaterDir + TEXT("gup.exe");
 
	generic_string version = TEXT("-v");
	version += VERSION_VALUE;

	bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterFullPath.c_str()) == TRUE);

    bool doUpdate = nppGui._autoUpdateOpt._doAutoUpdate;

    if (doUpdate) // check more detail 
    {
        Date today(0);
        
        if (today < nppGui._autoUpdateOpt._nextUpdateDate)
            doUpdate = false;
    }

	if (TheFirstOne && isUpExist && doUpdate)
	{
		Process updater(updaterFullPath.c_str(), version.c_str(), updaterDir.c_str());
		updater.run();
        
        // Update next update date
        if (nppGui._autoUpdateOpt._intervalDays < 0) // Make sure interval days value is positive
            nppGui._autoUpdateOpt._intervalDays = 0 - nppGui._autoUpdateOpt._intervalDays;
        nppGui._autoUpdateOpt._nextUpdateDate = Date(nppGui._autoUpdateOpt._intervalDays);
	}

	MSG msg;
	msg.wParam = 0;
	Win32Exception::installHandler();
	try {
		notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams);

		// Tell UAC that lower integrity processes are allowed to send WM_COPYDATA messages to this process (or window)
		// This allows opening new files to already opened elevated Notepad++ process via explorer context menu.
		if(pNppParameters->getWinVersion() >= WV_VISTA)
		{
			HMODULE hDll = GetModuleHandle(TEXT("user32.dll"));
			if (hDll)
			{
				// According to MSDN ChangeWindowMessageFilter may not be supported in future versions of Windows, 
				// that is why we use ChangeWindowMessageFilterEx if it is available (windows version >= Win7).

				if(pNppParameters->getWinVersion() == WV_VISTA)
				{
					typedef BOOL (WINAPI *MESSAGEFILTERFUNC)(UINT message,DWORD dwFlag);
					const DWORD MSGFLT_ADD = 1;

					MESSAGEFILTERFUNC func = (MESSAGEFILTERFUNC)::GetProcAddress( hDll, "ChangeWindowMessageFilter" );

					if (func)
					{
						func(WM_COPYDATA, MSGFLT_ADD);
					}
				}
				else
				{
					typedef BOOL (WINAPI *MESSAGEFILTERFUNCEX)(HWND hWnd,UINT message,DWORD action,VOID* pChangeFilterStruct);
					const DWORD MSGFLT_ALLOW = 1;

					MESSAGEFILTERFUNCEX func = (MESSAGEFILTERFUNCEX)::GetProcAddress( hDll, "ChangeWindowMessageFilterEx" );

					if (func)
					{
						func(notepad_plus_plus.getHSelf(), WM_COPYDATA, MSGFLT_ALLOW, NULL );
					}
				}
			}
		}

		bool unicodeSupported = pNppParameters->getWinVersion() >= WV_NT;
		bool going = true;
		while (going)
		{
			going = (unicodeSupported?(::GetMessageW(&msg, NULL, 0, 0)):(::GetMessageA(&msg, NULL, 0, 0))) != 0;
			if (going)
			{
				// if the message doesn't belong to the notepad_plus_plus's dialog
				if (!notepad_plus_plus.isDlgsMsg(&msg, unicodeSupported))
				{
					if (::TranslateAccelerator(notepad_plus_plus.getHSelf(), notepad_plus_plus.getAccTable(), &msg) == 0)
					{
						::TranslateMessage(&msg);
						if (unicodeSupported)
							::DispatchMessageW(&msg);
						else
							::DispatchMessage(&msg);
					}
				}
			}
		}
	} catch(int i) {
		TCHAR str[50] = TEXT("God Damned Exception : ");
		TCHAR code[10];
		wsprintf(code, TEXT("%d"), i);
		::MessageBox(Notepad_plus_Window::gNppHWND, lstrcat(str, code), TEXT("Int Exception"), MB_OK);
		doException(notepad_plus_plus);
	} catch(std::runtime_error & ex) {
		::MessageBoxA(Notepad_plus_Window::gNppHWND, ex.what(), "Runtime Exception", MB_OK);
		doException(notepad_plus_plus);
	} catch (const Win32Exception & ex) {
		TCHAR message[1024];	//TODO: sane number
		wsprintf(message, TEXT("An exception occured. Notepad++ cannot recover and must be shut down.\r\nThe exception details are as follows:\r\n")
		TEXT("Code:\t0x%08X\r\nType:\t%S\r\nException address: 0x%08X"), ex.code(), ex.what(), ex.where());
		::MessageBox(Notepad_plus_Window::gNppHWND, message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
		mdump.writeDump(ex.info());
		doException(notepad_plus_plus);
	} catch(std::exception & ex) {
		::MessageBoxA(Notepad_plus_Window::gNppHWND, ex.what(), "General Exception", MB_OK);
		doException(notepad_plus_plus);
	} catch(...) {	//this shouldnt ever have to happen
		::MessageBoxA(Notepad_plus_Window::gNppHWND, "An exception that we did not yet found its name is just caught", "Unknown Exception", MB_OK);
		doException(notepad_plus_plus);
	}

	return (UINT)msg.wParam;
}
Ejemplo n.º 28
0
static inline UBool isWhiteSpace(char c) {return isInList(c, WHITE_SPACE);}
Ejemplo n.º 29
0
FUNCTION int Q4JX(obj it)
{
  if(containedBy(it) != NULL())
  {
    return(0x01);
  }
  if(!thinksItsAtHome(it))
  {
    return(0x01);
  }
  int i;
  int Q56F;
  int Q5E7;
  int Q55X = 0x02;
  int myObjType = getObjType(it);
  list Q4E5;
  list Q5JX;
  obj Q4Q1;
  loc Q4VS = loc( getLocation(it) );
  int Q60E;
  loc there;
  getContents(Q4E5, it);
  if(isInArea("alchemist", Q4VS, 0x00))
  {
    Q5JX = list( 0x0F06, 0x0F07, 0x0F08, 0x0F09, 0x0F0A, 0x0F0B, 0x0F0C, 0x0F0D, 0x0E9B );
  }
  if(isInArea("armorer", Q4VS, 0x00))
  {
    Q5JX = list( 0x13BB, 0x13C0, 0x1413, 0x1B72, 0x1B73, 0x1B74, 0x1B75, 0x1B76, 0x1B77, 0x1B7A, 0x1B7B );
  }
  if(isInArea("artisanguild", Q4VS, 0x00))
  {
    Q5JX = list( 0x0FC1, 0x0FB4, 0x13E3, 0x13E4, 0x0FBB, 0x0FBC, 0x14FB, 0x14FC, 0x14FD, 0x14FE, 0x1EB8, 0x1EB9, 0x1EBA, 0x1EBB, 0x12B3, 0x1224, 0x139A, 0x1225, 0x1226, 0x139B, 0x139C, 0x12CA, 0x12CB, 0x1545, 0x1547, 0x1F0B, 0x1F0C, 0x154B, 0x1549, 0x1F0B, 0x1F0C );
  }
  if(isInArea("baker", Q4VS, 0x00))
  {
    Q5JX = list( 0x1043, 0x1039, 0x1045, 0x103B, 0x103C, 0x098C );
  }
  if(isInArea("bard", Q4VS, 0x00))
  {
    Q5JX = list( 0x0EB2, 0x0EB3, 0x0EB4, 0x0E9C, 0x0E9D, 0x0E9E );
  }
  if(isInArea("blacksmith", Q4VS, 0x00))
  {
    Q5JX = list( 0x13E3, 0x13E4, 0x0FBB, 0x0FBC, 0x0FB4, 0x0FB5, 0x1876, 0x1877, 0x1878, 0x1879, 0x0FB6, 0x19B8, 0x19B9, 0x19BA, 0x19B7, 0x1BEF, 0x18C5, 0x0FB2, 0x106D, 0x0FB8 );
  }
  if(isInArea("blacksmith", Q4VS, 0x00))
  {
    Q5JX = list( 0x13B2, 0x13B1, 0x0F4F, 0x0F50, 0x0F3F );
  }
  if(isInArea("butcher", Q4VS, 0x00))
  {
    Q5JX = list( 0x0EC3, 0x0EC2, 0x0976, 0x0977, 0x0978, 0x0979, 0x097A, 0x097B, 0x09B7, 0x09B8, 0x09B9, 0x09BA, 0x09D3, 0x09C9, 0x1609, 0x160A, 0x09F2, 0x09F1, 0x09C0, 0x09C1, 0x1607, 0x1608 );
  }
  if((isInArea("carpenter", Q4VS, 0x00)) || (isInArea("woodworker", Q4VS, 0x00)))
  {
    Q5JX = list( 0x1026, 0x1029, 0x1028, 0x102A, 0x102B, 0x102C, 0x102D, 0x102E, 0x102F, 0x1030, 0x1031, 0x1032, 0x1033, 0x1034, 0x1035, 0x1BD7, 0x10E4, 0x1BDD, 0x10E5, 0x10E6, 0x10E7 );
  }
  if(isInArea("cemetery", Q4VS, 0x00))
  {
    Q5JX = list( 0x1CDD, 0x1CE5, 0x1CE0, 0x1CE8, 0x1CE1, 0x1CE9, 0x1CEF, 0x1CF0, 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, 0x1B11, 0x1B12, 0x1B13, 0x1B14, 0x1B15, 0x1B16, 0x1B17, 0x1B18, 0x1B19, 0x1B1A, 0x1B1B, 0x1B1C, 0x0ECA, 0x0ED2, 0x0ECB, 0x0ECC, 0x0ECD, 0x0ECE, 0x0ECF, 0x0ED0, 0x0ED1 );
  }
  if((isInArea("clothier", Q4VS, 0x00)) || (isInArea("tailor", Q4VS, 0x00)))
  {
    Q5JX = list( 0x0DF9, 0x0DF8, 0x0E1D, 0x0E1E, 0x0E1F, 0x0FA0, 0x1761, 0x1762, 0x1763, 0x1764, 0x0FA9, 0x1068, 0x1067 );
  }
  if(isInArea("cobbler", Q4VS, 0x00))
  {
    Q5JX = list( 0x170B, 0x170F, 0x1710, 0x170D, 0x170E, 0x1711 );
  }
  if(isInArea("customs", Q4VS, 0x00))
  {
    Q5JX = list( 0x00018D45, 0x00018D46, 0x00018D47, 0x00018D48, 0x00018D49, 0x00018D4A, 0x00018D4B, 0x00018D4C, 0x00018D4D, 0x00018D4E, 0x00018D4F, 0x00018D50, 0x00018D51, 0x00018D52, 0x00018D53, 0x00018D54, 0x00018D55, 0x00018D56, 0x00018D57, 0x00018D58, 0x00018D59, 0x00018D5A, 0x00018D5B, 0x00018D5C, 0x00018D5D, 0x00018D5E, 0x00018D5F, 0x00018D60 );
  }
  if(isInArea("docks", Q4VS, 0x00))
  {
    Q5JX = list( 0x0DBF, 0x0DC0, 0x0DD6, 0x0DD7, 0x09CC, 0x09CD, 0x09CE, 0x09CF );
  }
  if(isInArea("farm", Q4VS, 0x00))
  {
    Q5JX = list( 0x1517, 0x152E, 0x1516, 0x1F01, 0x1715, 0x170D, 0x170E, 0x13F8, 0x13F9, 0x0E87, 0x0E88, 0x13F5, 0x13F4, 0x0E76, 0x0DE1, 0x0C70, 0x0C6E, 0x0C61, 0x09D3, 0x0978, 0x1609, 0x0F36, 0x09F0 );
  }
  if(isInArea("fighterguild", Q4VS, 0x00))
  {
    Q5JX = list( 0x0F45, 0x0F47, 0x0F43, 0x0F49, 0x0F4B, 0x13FB, 0x13B0, 0x0F4D, 0x1403, 0x0F62, 0x1405, 0x143D, 0x13B4, 0x1407, 0x0F5C, 0x143B, 0x1439, 0x1441, 0x143F, 0x13FF, 0x0F5E, 0x0F61, 0x13B8, 0x13B9, 0x13B6, 0x13F8, 0x0E89, 0x0F51, 0x0F50, 0x1401, 0x13B2, 0x0F4F, 0x13FD, 0x13DB, 0x13E2, 0x13DA, 0x13E1, 0x13D4, 0x13DC, 0x13D5, 0x13DD, 0x1415, 0x1416, 0x1417, 0x1410, 0x1411, 0x141B, 0x1414, 0x1418, 0x1412, 0x1419, 0x13BF, 0x13C4, 0x13BE, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13EC, 0x13ED, 0x13F0, 0x13F1, 0x13EE, 0x13EF, 0x13EB, 0x13F2, 0x13D6, 0x1413, 0x1409, 0x13C7, 0x13D6, 0x13BB, 0x13C0, 0x13BF, 0x1451, 0x1412, 0x1B72, 0x1B73, 0x1B74, 0x1B75, 0x1B76, 0x1B77, 0x1B78, 0x1B79, 0x1B7A, 0x1B7B, 0x0F3F );
  }
  if((isInArea("guard", Q4VS, 0x00)) || (isInArea("paladin", Q4VS, 0x00)))
  {
    Q5JX = list( 0x0F45, 0x0F47, 0x0F43, 0x0F49, 0x0F4B, 0x13FB, 0x13B0, 0x0F4D, 0x1403, 0x0F62, 0x1405, 0x143D, 0x13B4, 0x1407, 0x0F5C, 0x143B, 0x1439, 0x1441, 0x143F, 0x13FF, 0x0F5E, 0x0F61, 0x13B8, 0x13B9, 0x13B6, 0x13F8, 0x0E89, 0x0F51, 0x0F50, 0x1401, 0x13B2, 0x0F4F, 0x13FD, 0x13DB, 0x13E2, 0x13DA, 0x13E1, 0x13D4, 0x13DC, 0x13D5, 0x13DD, 0x1415, 0x1416, 0x1417, 0x1410, 0x1411, 0x141B, 0x1414, 0x1418, 0x1412, 0x1419, 0x13BF, 0x13C4, 0x13BE, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13EC, 0x13ED, 0x13F0, 0x13F1, 0x13EE, 0x13EF, 0x13EB, 0x13F2, 0x13D6, 0x1413, 0x1409, 0x13C7, 0x13D6, 0x13BB, 0x13C0, 0x13BF, 0x1451, 0x1412, 0x1B72, 0x1B73, 0x1B74, 0x1B75, 0x1B76, 0x1B77, 0x1B78, 0x1B79, 0x1B7A, 0x1B7B, 0x0F3F );
  }
  if(isInArea("healer", Q4VS, 0x00))
  {
    Q5JX = list( 0x0EE9, 0x0E9B, 0x0F0C );
  }
  if(isInArea("herbalist", Q4VS, 0x00))
  {
    Q5JX = list( 0x0F84, 0x0F85, 0x0F86, 0x0F90, 0x0C3C, 0x0C3E, 0x0C40, 0x0C42 );
  }
  if(isInArea("inn", Q4VS, 0x00))
  {
    Q5JX = list( 0x0A1D, 0x0F64, 0x0A28 );
  }
  if(isInArea("jeweler", Q4VS, 0x00))
  {
    Q5JX = list( 0x1086, 0x108A, 0x108B, 0x1087, 0x1085, 0x1088, 0x1089, 0x0F0F, 0x0F10, 0x0F11, 0x0F13, 0x0F15, 0x0F16, 0x0F18, 0x0F25, 0x0F26 );
  }
  if(isInArea("library", Q4VS, 0x00))
  {
    Q5JX = list( 0x0FEF, 0x0FF0, 0x0FF1, 0x0FF2 );
  }
  if(isInArea("mag", Q4VS, 0x00))
  {
    Q5JX = list( 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x1F46, 0x1F47, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F45, 0x1F46, 0x1F47, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F45, 0x1F46, 0x1F47, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F45, 0x1F46, 0x1F47, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F45, 0x1F46, 0x1F47, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x1F4E, 0x1F4F, 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F4D, 0x1F4E, 0x1F4F, 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F4D, 0x1F4E, 0x1F4F, 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F4D, 0x1F4E, 0x1F4F, 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57, 0x1F58, 0x1F59, 0x1F5A, 0x1F5B, 0x1F5C, 0x1F55, 0x1F56, 0x1F57, 0x1F58, 0x1F59, 0x1F5A, 0x1F5B, 0x1F5C, 0x1F55, 0x1F56, 0x1F57, 0x1F58, 0x1F59, 0x1F5A, 0x1F5B, 0x1F5C, 0x1F55, 0x1F56, 0x1F57, 0x1F58, 0x1F59, 0x1F5A, 0x1F5B, 0x1F5C, 0x1F5D, 0x1F5E, 0x1F5F, 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F55, 0x1F56, 0x1F57, 0x1F58, 0x1F59, 0x1F5A, 0x1F5B, 0x1F5C, 0x1F5D, 0x1F5E, 0x1F5F, 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F5D, 0x1F5E, 0x1F5F, 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F65, 0x1F66, 0x1F67, 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F65, 0x1F66, 0x1F67, 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F65, 0x1F66, 0x1F67, 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA );
  }
  if(isInArea("merchant", Q4VS, 0x00))
  {
    Q5JX = list( 0x097E, 0x097D, 0x097C, 0x09B5, 0x09CC, 0x09CD, 0x09CE, 0x09CF, 0x097A, 0x097B, 0x09D0, 0x171F, 0x1720, 0x1721, 0x1722, 0x1723, 0x1724, 0x1725, 0x1726, 0x1727, 0x09D1, 0x1728, 0x1729, 0x172A, 0x172B, 0x172C, 0x172D, 0x0976, 0x0977, 0x0978, 0x0979, 0x097A, 0x097B, 0x09B7, 0x09B8, 0x09B9, 0x09BA, 0x09D3, 0x09C9, 0x1609, 0x160A, 0x09F2, 0x09F1, 0x09C0, 0x09C1, 0x1607, 0x1608, 0x0C5C, 0x0C5D, 0x0C61, 0x0C62, 0x0C63, 0x0C64, 0x0C65, 0x0C66, 0x0C67, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C70, 0x0C71, 0x0C72, 0x0C73, 0x0C74, 0x0C75, 0x0C78, 0x0C79, 0x0C7A, 0x0C7B, 0x0C7C, 0x0C7F, 0x0C80, 0x0C81, 0x0C82 );
  }
  if(isInArea("mill", Q4VS, 0x00))
  {
    Q5JX = list( 0x1039 );
  }
  if(isInArea("mine", Q4VS, 0x00))
  {
    Q5JX = list( 0x0E86, 0x0E85, 0x18C5, 0x0FB2, 0x1BEF, 0x106D, 0x0F39, 0x0F3A );
  }
  if(isInArea("observatory", Q4VS, 0x00))
  {
    Q5JX = list( 0x1058, 0x1057, 0x104B, 0x104C, 0x14F5, 0x00018D45, 0x00018D46, 0x00018D47, 0x00018D48, 0x00018D49, 0x00018D4A, 0x00018D4B, 0x00018D4C, 0x00018D4D, 0x00018D4E, 0x00018D4F, 0x00018D50, 0x00018D51, 0x00018D52, 0x00018D53, 0x00018D54, 0x00018D55, 0x00018D56, 0x00018D57, 0x00018D58, 0x00018D59, 0x00018D5A, 0x00018D5B, 0x00018D5C, 0x00018D5D, 0x00018D5E, 0x00018D5F, 0x00018D60 );
  }
  if(isInArea("painter", Q4VS, 0x00))
  {
    Q5JX = list( 0x0FC1, 0x0FBF, 0x0FC0 );
  }
  if(isInArea("provisioner", Q4VS, 0x00))
  {
    Q5JX = list( 0x097E, 0x097D, 0x097C, 0x09B5, 0x09CC, 0x09CD, 0x09CE, 0x09CF, 0x097A, 0x097B, 0x09D0, 0x171F, 0x1720, 0x1721, 0x1722, 0x1723, 0x1724, 0x1725, 0x1726, 0x1727, 0x09D1, 0x1728, 0x1729, 0x172A, 0x172B, 0x172C, 0x172D, 0x0976, 0x0977, 0x0978, 0x0979, 0x097A, 0x097B, 0x09B7, 0x09B8, 0x09B9, 0x09BA, 0x09D3, 0x09C9, 0x1609, 0x160A, 0x09F2, 0x09F1, 0x09C0, 0x09C1, 0x1607, 0x1608, 0x0C5C, 0x0C5D, 0x0C61, 0x0C62, 0x0C63, 0x0C64, 0x0C65, 0x0C66, 0x0C67, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C70, 0x0C71, 0x0C72, 0x0C73, 0x0C74, 0x0C75, 0x0C78, 0x0C79, 0x0C7A, 0x0C7B, 0x0C7C, 0x0C7F, 0x0C80, 0x0C81, 0x0C82 );
  }
  if(isInArea("ranger", Q4VS, 0x00))
  {
    Q5JX = list( 0x171A, 0x13DB, 0x13E2, 0x13DA, 0x13E1, 0x13D4, 0x13DC, 0x13D5, 0x13DD, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13C7, 0x13D6, 0x1409, 0x1716, 0x171A, 0x153F, 0x1515, 0x13F8, 0x13F9, 0x166E, 0x1711, 0x1712, 0x170B, 0x170C, 0x13B2, 0x13B1, 0x0F4F, 0x0F50, 0x13FD, 0x13FC, 0x0F3F, 0x0F3F, 0x0F3F, 0x0F3F );
  }
  if(isInArea("stables", Q4VS, 0x00))
  {
    Q5JX = list( 0x0C55, 0x0C78 );
  }
  if(isInArea("tanner", Q4VS, 0x00))
  {
    Q5JX = list( 0x171A, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13C7, 0x1068, 0x1067 );
  }
  if(isInArea("tavern", Q4VS, 0x00))
  {
    Q5JX = list( 0x099F, 0x09C7, 0x099B, 0x09C8 );
  }
  if(isInArea("thievesguild", Q4VS, 0x00))
  {
    Q5JX = list( 0x1545, 0x1547, 0x1F0B, 0x1F0C, 0x154B, 0x1549, 0x1F0B, 0x1F0C, 0x14FB );
  }
  if(isInArea("tinker", Q4VS, 0x00))
  {
    Q5JX = list( 0x14FB, 0x1011, 0x104C, 0x1050, 0x104F, 0x1051, 0x1052, 0x1054, 0x1053, 0x1056, 0x1055, 0x1025, 0x104B, 0x1058, 0x1057, 0x105A, 0x1059, 0x105C, 0x105B, 0x105E, 0x105D, 0x1EB8, 0x1EB9, 0x1EBA, 0x1EBB, 0x1EBC, 0x100E, 0x100F, 0x1010, 0x1013 );
  }
  if(isInArea("vet", Q4VS, 0x00))
  {
    Q5JX = list( 0x0EE9, 0x0E9B, 0x0F0C, 0x0C55, 0x0C78 );
  }
  if(isInArea("weapon", Q4VS, 0x00))
  {
    Q5JX = list( 0x0F45, 0x0F47, 0x0F43, 0x0F49, 0x0F4B, 0x13FB, 0x13B0, 0x0F4D, 0x1403, 0x0F62, 0x1405, 0x143D, 0x13B4, 0x1407, 0x0F5C, 0x143B, 0x1439, 0x1441, 0x143F, 0x13FF, 0x0F5E, 0x0F61, 0x13B8, 0x13B9, 0x13B6, 0x13F8, 0x0E89, 0x0F51, 0x0F50, 0x1401, 0x13B2, 0x0F4F, 0x13FD, 0x13B2, 0x13B1, 0x0F4F, 0x0F50, 0x0F3F );
  }
  if((isInArea("dungn", Q4VS, 0x00)) || (isInArea("mountain", Q4VS, 0x00)))
  {
    Q5JX = list( 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F4D, 0x1F4E, 0x1F4F, 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57, 0x1F58, 0x1F59, 0x1F5A, 0x1F5B, 0x1F5C, 0x1F5D, 0x1F5E, 0x1F5F, 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x0F45, 0x0F47, 0x0F43, 0x0F49, 0x0F4B, 0x13FB, 0x13B0, 0x0F4D, 0x1403, 0x0F62, 0x1405, 0x143D, 0x13B4, 0x1407, 0x0F5C, 0x143B, 0x1439, 0x1441, 0x143F, 0x13FF, 0x0F5E, 0x0F61, 0x13B8, 0x13B9, 0x13B6, 0x13F8, 0x0E89, 0x0F51, 0x0F50, 0x1401, 0x13B2, 0x0F4F, 0x13FD, 0x13B2, 0x13B1, 0x0F4F, 0x0F50, 0x0F3F, 0x13DB, 0x13E2, 0x13DA, 0x13E1, 0x13D4, 0x13DC, 0x13D5, 0x13DD, 0x1415, 0x1416, 0x1417, 0x1410, 0x1411, 0x141B, 0x1414, 0x1418, 0x1412, 0x1419, 0x13BF, 0x13C4, 0x13BE, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13EC, 0x13ED, 0x13F0, 0x13F1, 0x13EE, 0x13EF, 0x13EB, 0x13F2, 0x144F, 0x1452, 0x144E, 0x1455, 0x13D6, 0x1413, 0x1409, 0x13C7, 0x13D6, 0x13BB, 0x13C0, 0x13BF, 0x1451, 0x1412, 0x1B72, 0x1B73, 0x1B74, 0x1B75, 0x1B76, 0x1B77, 0x1B78, 0x1B79, 0x1B7A, 0x1B7B, 0x1086, 0x108A, 0x108B, 0x1087, 0x1085, 0x1088, 0x1089, 0x0F0F, 0x0F10, 0x0F11, 0x0F13, 0x0F15, 0x0F16, 0x0F18, 0x0F25, 0x0F26, 0x1CDD, 0x1CE5, 0x1CE0, 0x1CE8, 0x1CE1, 0x1CE9, 0x1CEF, 0x1CF0, 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, 0x1B11, 0x1B12, 0x1B13, 0x1B14, 0x1B15, 0x1B16, 0x1B17, 0x1B18, 0x1B19, 0x1B1A, 0x1B1B, 0x1B1C, 0x0ECA, 0x0ED2, 0x0ECB, 0x0ECC, 0x0ECD, 0x0ECE, 0x0ECF, 0x0ED0, 0x0ED1, 0x0F06, 0x0F07, 0x0F08, 0x0F09, 0x0F0A, 0x0F0B, 0x0F0C, 0x0F0D, 0x1545, 0x1547, 0x1F0B, 0x1F0C, 0x154B, 0x1549, 0x1F0B, 0x1F0C );
  }
  if(numInList(Q5JX) < 0x01)
  {
    return(0x00);
  }
  getContents(Q4E5, it);
  if(numInList(Q4E5) <= Q55X)
  {
    Q56F = random(0x00, ((Q55X - numInList(Q4E5)) + 0x01) * 0x02);
    for(i = 0x00; i < Q56F; i ++)
    {
      Q5E7 = random(0x00, numInList(Q5JX) - 0x01);
      Q60E = Q5JX[Q5E7];
      if(Q60E > 0x000186A0)
      {
        Q60E = Q60E - 0x000186A0;
        there = loc( getLocation(it) );
        Q4Q1 = requestCreateNPCAt(Q60E, there, 0x32);
        if(Q4Q1 != NULL())
        {
          Q60E = putObjContainer(Q4Q1, it);
        }
      }
      else
      {
        Q4Q1 = requestCreateObjectIn(Q5JX[Q5E7], it);
      }
    }
  }
  list Q5DB = list( 0x09AC, 0x09B1, 0x0E76, 0x0E77, 0x0E7F );
  if(isInList(Q5DB, getObjType(it)))
  {
    return(0x01);
  }
  int Q53L = getValue(it) / 0x05;
  if(Q53L > 0xFA)
  {
    Q53L = 0xFA;
  }
  if(Q53L < 0x64)
  {
    if(random(0x00, 0x0A) < 0x03)
    {
      return(0x00);
    }
  }
  setObjVar(it, "isLocked", Q53L);
  attachScript(it, "locked");
  return(0x00);
}
Ejemplo n.º 30
0
static inline UBool isAlphabet(char c) {return isInList(c, ALPHABET);}