Exemple #1
0
void Being::setName(const std::string &name)
{
    if (getType() == NPC)
    {
        mName = name.substr(0, name.find('#', 0));
        showName();
    }
    else
    {
        mName = name;

        if (getType() == PLAYER && getShowName())
            showName();
    }
}
Exemple #2
0
void RFile::touch(const vec3 & colour) {
    if(forced_removal) return;

    fade_start = -1.0f;
    
    //fprintf(stderr, "touch %s\n", fullpath.c_str());

    last_action = elapsed;
    touch_colour = colour;

    //un expire file
    if(expired) {
        for(std::vector<RFile*>::iterator it = gGourceRemovedFiles.begin(); it != gGourceRemovedFiles.end(); it++) {
            if((*it) == this) {
                gGourceRemovedFiles.erase(it);
                break;
            }
        }
        expired=false;
    }

    showName();
    setHidden(false);
    dir->fileUpdated(true);
}
Exemple #3
0
void PlayerBox::resizeEvent(QResizeEvent* e)
{
  QGroupBox::resizeEvent(e);

  showCash();
  showName();
}
Exemple #4
0
void Menu::init(SerialUI * suidrv, PGM_P name, uint8_t num_items_hint, Menu * parent) {


	sui_driver = suidrv;
	menu_name = name;
	parent_menu = parent;
	num_menu_items = 0;
#ifdef SUI_DYNAMIC_MEMORY_ALLOCATION_ENABLE
	max_menu_items = 0;
#else
	max_menu_items = SUI_STATIC_MEMORY_NUM_ITEMS_MAXIMUM;
#endif

	expand_list_amount = SUI_MENU_EXPANDITEMLIST_AMOUNT_DEFAULT;
	item_list = NULL;


	// set our max_key_len to hold *at least*
	// the available built-in commands
	if (max_key_len < 1)
	{
		// max_key_len is now a class-level var, so
		// we only need to do this once.  It will
		// eventually hold the max key length for the
		// largest key in the whole menu system.
#ifdef SUI_ENABLE_MODES
		max_key_len = strlen_P(key_mode_program);
#else
		max_key_len = strlen_P(help_key);
		if (strlen_P(exit_key) > max_key_len)
		{
			max_key_len = strlen_P(exit_key);
		}
#endif
	}

#ifdef SUI_INCLUDE_EXTRA_SAFETYCHECKS
	if (strlen_P(menu_name) > SUI_MENU_PROGMEM_STRING_ABS_MAXLEN) {
		returnMessage(PSTR(SUI_ERRORMSG_MENUNAME_TOOLONG));
	}
#endif

#ifdef SUI_INCLUDE_DEBUG
	if (parent_menu)
	{
		// can't start doing output before SerialUI is initialized
		// so we only do this stuff for sub-menus
		SUI_MENU_DEBUG_OUTPUT("Initializing Menu ");
		showName();
		sui_driver->println(" ");
	}
#endif

	expandItemList(num_items_hint);
}
Exemple #5
0
    static void dumpClassNames() {
	for (VregsSpecsInfo::iterator iter = VregsSpecsInfo::specsBegin();
	     iter != VregsSpecsInfo::specsEnd(); ++iter) {
	    VregsSpecInfo* specp = iter;
	    firstCol(specp->name()); COUT<<":"<<endl;

	    for (int i=0; i<specp->numClassNames(); i++) {
		showName(specp->classNames()[i]);
	    }
	}
    }
Exemple #6
0
static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
        const SkPathOp shapeOp, const char* testName, ExpectSuccess expectSuccess,
        SkipAssert skipAssert, ExpectMatch expectMatch) {
#if 0 && DEBUG_SHOW_TEST_NAME
    showName(a, b, shapeOp);
#endif
    SkPath out;
    if (!OpDebug(a, b, shapeOp, &out  SkDEBUGPARAMS(SkipAssert::kYes == skipAssert)
            SkDEBUGPARAMS(testName))) {
        if (ExpectSuccess::kYes == expectSuccess) {
            SkDebugf("%s %s did not expect failure\n", __FUNCTION__, testName);
            REPORTER_ASSERT(reporter, 0);
        }
        return false;
    } else {
        if (ExpectSuccess::kNo == expectSuccess) {
                SkDebugf("%s %s unexpected success\n", __FUNCTION__, testName);
                REPORTER_ASSERT(reporter, 0);
        }
    }
    if (!reporter->verbose()) {
        return true;
    }
    SkPath pathOut, scaledPathOut;
    SkRegion rgnA, rgnB, openClip, rgnOut;
    openClip.setRect(-16000, -16000, 16000, 16000);
    rgnA.setPath(a, openClip);
    rgnB.setPath(b, openClip);
    rgnOut.op(rgnA, rgnB, (SkRegion::Op) shapeOp);
    rgnOut.getBoundaryPath(&pathOut);

    SkMatrix scale;
    scaleMatrix(a, b, scale);
    SkRegion scaledRgnA, scaledRgnB, scaledRgnOut;
    SkPath scaledA, scaledB;
    scaledA.addPath(a, scale);
    scaledA.setFillType(a.getFillType());
    scaledB.addPath(b, scale);
    scaledB.setFillType(b.getFillType());
    scaledRgnA.setPath(scaledA, openClip);
    scaledRgnB.setPath(scaledB, openClip);
    scaledRgnOut.op(scaledRgnA, scaledRgnB, (SkRegion::Op) shapeOp);
    scaledRgnOut.getBoundaryPath(&scaledPathOut);
    SkBitmap bitmap;
    SkPath scaledOut;
    scaledOut.addPath(out, scale);
    scaledOut.setFillType(out.getFillType());
    int result = comparePaths(reporter, testName, pathOut, scaledPathOut, out, scaledOut, bitmap,
            a, b, shapeOp, scale, ExpectMatch::kYes == expectMatch);
    reporter->bumpTestCount();
    return result == 0;
}
bool testPathFailOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
                 const SkPathOp shapeOp, const char* testName) {
#if DEBUG_SHOW_TEST_NAME
    showName(a, b, shapeOp);
#endif
    SkPath out;
    if (Op(a, b, shapeOp, &out) ) {
        SkDebugf("%s test is expected to fail\n", __FUNCTION__);
        REPORTER_ASSERT(reporter, 0);
        return false;
    }
    return true;
}
Exemple #8
0
void Being::setShowName(bool doShowName)
{
    if (mShowName == doShowName)
        return;

    mShowName = doShowName;

    if (doShowName)
        showName();
    else
    {
        delete mDispName;
        mDispName = 0;
    }
}
static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
                 const SkPathOp shapeOp, const char* testName, bool threaded) {
#if DEBUG_SHOW_TEST_NAME
    showName(a, b, shapeOp);
#endif
    SkPath out;
    if (!Op(a, b, shapeOp, &out) ) {
        SkDebugf("%s did not expect failure\n", __FUNCTION__);
        REPORTER_ASSERT(reporter, 0);
        return false;
    }
    if (threaded && !reporter->verbose()) {
        return true;
    }
    SkPath pathOut, scaledPathOut;
    SkRegion rgnA, rgnB, openClip, rgnOut;
    openClip.setRect(-16000, -16000, 16000, 16000);
    rgnA.setPath(a, openClip);
    rgnB.setPath(b, openClip);
    rgnOut.op(rgnA, rgnB, (SkRegion::Op) shapeOp);
    rgnOut.getBoundaryPath(&pathOut);

    SkMatrix scale;
    scaleMatrix(a, b, scale);
    SkRegion scaledRgnA, scaledRgnB, scaledRgnOut;
    SkPath scaledA, scaledB;
    scaledA.addPath(a, scale);
    scaledA.setFillType(a.getFillType());
    scaledB.addPath(b, scale);
    scaledB.setFillType(b.getFillType());
    scaledRgnA.setPath(scaledA, openClip);
    scaledRgnB.setPath(scaledB, openClip);
    scaledRgnOut.op(scaledRgnA, scaledRgnB, (SkRegion::Op) shapeOp);
    scaledRgnOut.getBoundaryPath(&scaledPathOut);
    SkBitmap bitmap;
    SkPath scaledOut;
    scaledOut.addPath(out, scale);
    scaledOut.setFillType(out.getFillType());
    int result = comparePaths(reporter, testName, pathOut, scaledPathOut, out, scaledOut, bitmap,
            a, b, shapeOp, scale);
    if (result && gPathStrAssert) {
        REPORTER_ASSERT(reporter, 0);
    }
    reporter->bumpTestCount();
    return result == 0;
}
Exemple #10
0
void Being::updateName()
{
    if (mShowName)
        showName();
}
Exemple #11
0
void Pawn::setMouseOver(bool over) {
    showName();
    this->mouseover = over;
}
Exemple #12
0
void Pawn::setHidden(bool hidden) {
    showName();
    this->hidden = false;
}
Exemple #13
0
bool Menu::expandItemList(uint8_t by_amount) {

#ifdef SUI_DYNAMIC_MEMORY_ALLOCATION_ENABLE
	// using dynamic memory allocations
	int menuitm_size = sizeof(MenuItem);
	MenuItem * new_list = NULL;

	if (!by_amount) {
		// set optional param to default value
		by_amount = expand_list_amount;
	}


	if (item_list) {
		// we've already got a list in hand... we want to expand it a bit
		new_list = (MenuItem*) realloc(item_list,
				menuitm_size * (num_menu_items + by_amount));


 #ifdef SUI_INCLUDE_DEBUG

		if (parent_menu)
		{
			// can't start doing output before SerialUI is initialized
			// so we only do this stuff for sub-menus
			SUI_MENU_DEBUG_OUTPUT("Dynamically expanding list of menu items for ");
			showName();
			sui_driver->println(" ");

			sui_driver->showFreeRAM();
		}
 #endif


	} else {
		// no list yet, malloc one please:
		new_list = (MenuItem*) malloc(menuitm_size * by_amount);

 #ifdef SUI_INCLUDE_DEBUG
		if (parent_menu)
		{
			// can't start doing output before SerialUI is initialized
			// so we only do this stuff for sub-menus
			SUI_MENU_DEBUG_OUTPUT("Allocating list of menu items for ");
			showName();
			sui_driver->println(" ");

			sui_driver->showFreeRAM();
		}
 #endif
	}


	if (new_list != NULL) {
		// we gots a new list, huzzah.

		// make note of our new space...
		max_menu_items += by_amount;


		// zero the newly allocated memory
		MENUMEMSET(&(new_list[num_menu_items]), 0, menuitm_size * by_amount);

		// keep that pointer
		item_list = new_list;

		// success!
		return true;
	}


	// abject failure...

 #ifdef SUI_SERIALUI_ECHO_WARNINGS
	returnMessage(error_cantalloc_menuitem);
 #endif

#endif
	// either there was an error, or we aren't using
	// dynamic memory allocations... in both cases:
	return false;

}