示例#1
0
std::string Item::disp()
{
    return "Nom : " + this->m_name + ", Classe : " + getStringClass(this->getClassType()) +
        ", Emplacement : " + getStringTypeItem(this->getTypeItem()) + ", Caracteristiques :\n"
        "Vitalite : " + typeToString<int>(this->m_stat.life) +
        "\t\t| Mana : " + typeToString<int>(this->m_stat.mana) +
        "\nAttaque Phys : " + typeToString<int>(this->m_stat.physicalAtt) +
        "\t| Defense Phys : " + typeToString<int>(this->m_stat.physicalDef) +
        "\nAttaque Magique : " + typeToString<int>(this->m_stat.magicalAtt) +
        "\t| Defense Magique : " + typeToString<int>(this->m_stat.magicalDef);

}
示例#2
0
jmethodID getGetBytesId(JNIEnv *jenv) {
	if(getBytesId == 0) {
		getBytesId = jenv->GetMethodID(getStringClass(jenv), "getBytes", "()[B");
	}
	return getBytesId;
}
示例#3
0
int main(int argc, char *argv[])
{
    // expects no arguments because we are using a particular class file
    if (argc != 1)
    {
        fprintf(stderr, "Usage: heapTest\n");
        exit(-1);
    }

    // initialize: need to use a class with a user class that has at least
    // four fields
    initializeVM(10000, "userClass.class");

    // okay, begin the testing...

    Class A = getIthClass(4);

    Reference objectRef = allocateObject(getObjectClass());
    Reference integerRef = allocateObject(getIntegerClass());
    Reference aRef = allocateObject(A);
    Reference stringRef = allocateString("abcdefghijklmnopqrstuvwxyz");

    if (getObjectClass() != getClass(objectRef))
    {
        fprintf(stderr, "FAIL: getClass from objectRef\n");
    }

    if (getIntegerClass() != getClass(integerRef))
    {
        fprintf(stderr, "FAIL: getClass from integerRef\n");
    }

    if (getStringClass() != getClass(stringRef))
    {
        fprintf(stderr, "FAIL: getClass from stringRef\n");
    }

    if (A != getClass(aRef))
    {
        fprintf(stderr, "FAIL: getClass from aRef\n");
    }

    if (strcmp(getStringValue(stringRef), "abcdefghijklmnopqrstuvwxyz"))
    {
        fprintf(stderr, "FAIL: getStringValue\n");
    }

    putIntegerValue(integerRef, 1066);
    if (getIntegerValue(integerRef) != 1066)
    {
        fprintf(stderr, "FAIL: getIntegerValue\n");
    }

    putField(aRef, 0, integerRef);
    if (getField(aRef, 0) != integerRef)
    {
        fprintf(stderr, "FAIL: getField 0\n");
    }

    putField(aRef, 3, objectRef);
    if (getField(aRef, 3) != objectRef)
    {
        fprintf(stderr, "FAIL: getField 3\n");
    }

    printf("testing complete.\n");

    return 0;
}