static int pyVariableEventData_setName(pyVariableEventData* self, PyObject* value, void*) {
    if (value == NULL || !PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "name should be a string");
        return -1;
    }
    self->fThis->setName(PyStr_To_PlStr(value));
    return 0;
}
Exemple #2
0
static int pyAGAnimBink_setSubtitleId(pyAGAnimBink* self, PyObject* value, void*) {
    if (value == NULL || !PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "subtitleId should be a string");
        return -1;
    }
    self->fThis->setSubtitleId(PyStr_To_PlStr(value));
    return 0;
}
static int pyAGApplicator_setChannelName(pyAGApplicator* self, PyObject* value, void*) {
    if (value == NULL || !PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "channelName should be a string");
        return -1;
    }
    IConvertApplicator(self)->setChannelName(PyStr_To_PlStr(value));
    return 0;
}
Exemple #4
0
static int pyAnimCmdMsg_setLoopName(pyAnimCmdMsg* self, PyObject* value, void*) {
    if (value == NULL || !PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "loopName expects a string");
        return -1;
    }
    self->fThis->setLoopName(PyStr_To_PlStr(value));
    return 0;
}
Exemple #5
0
static int pyAgeGlobalAnim_setGlobalVarName(pyAgeGlobalAnim* self, PyObject* value, void*) {
    if (value == NULL || !PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "globalVarName should be a string");
        return -1;
    }
    self->fThis->setVarName(PyStr_To_PlStr(value));
    return 0;
}
Exemple #6
0
static int pyAgeInfoStruct_setAgeInstanceName(pyAgeInfoStruct* self, PyObject* value, void*) {
    if (value == NULL || !PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "ageInstanceName should be a string");
        return -1;
    }
    self->fThis->setAgeInstanceName(PyStr_To_PlStr(value));
    return -1;
}
Exemple #7
0
static int pyLayerSDLAnimation_setVarName(pyLayerSDLAnimation* self, PyObject* value, void*) {
    if (value == NULL || !PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "varName should be a string");
        return -1;
    }
    self->fThis->setVarName(PyStr_To_PlStr(value));
    return 0;
}
Exemple #8
0
static PyObject* pyDynamicCamMap_addVisRegionName(pyDynamicCamMap* self, PyObject* args) {
    PyObject* name;
    if (!(PyArg_ParseTuple(args, "O", &name) && PyAnyStr_Check(name))) {
        PyErr_SetString(PyExc_TypeError, "addVisRegionName expects a string");
        return NULL;
    }
    self->fThis->addVisRegionName(PyStr_To_PlStr(name));
    Py_INCREF(Py_None);
    return Py_None;
}
Exemple #9
0
static int pyClothingItem_setItemName(pyClothingItem* self, PyObject* value, void* closure) {
    if (value == NULL) {
        self->fThis->setItemName("");
    } else {
        if (!PyAnyStr_Check(value)) {
            PyErr_SetString(PyExc_TypeError, "itemName must be a string");
            return -1;
        }
        self->fThis->setItemName(PyStr_To_PlStr(value));
    }
    return 0;
}
Exemple #10
0
static int pyOneShotMod_setAnimName(pyOneShotMod* self, PyObject* value, void*) {
    if (value == NULL) {
        self->fThis->setAnimName("");
        return 0;
    }
    if (!PyAnyStr_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "animName should be a string");
        return -1;
    }
    self->fThis->setAnimName(PyStr_To_PlStr(value));
    return 0;
}
Exemple #11
0
static int pyPageInfo_setPage(pyPageInfo* self, PyObject* value, void*) {
    if (value == NULL) {
        self->fThis->setPage("");
    } else {
        if (!PyAnyStr_Check(value)) {
            PyErr_SetString(PyExc_TypeError, "page must be a string");
            return -1;
        }
        self->fThis->setPage(PyStr_To_PlStr(value));
    }
    return 0;
}
Exemple #12
0
static PyObject* pyBitVector_Subscript(pyBitVector* self, PyObject* key) {
    if (PyAnyStr_Check(key)) {
        Py_INCREF(key);
        plString name = PyStr_To_PlStr(key);
        int idx = (int)self->fThis->getValue(name);
        Py_DECREF(key);
        bool v = self->fThis->get(idx);
        return PyBool_FromLong(v ? 1 : 0);
    } else if (PyInt_Check(key)) {
        int idx = PyInt_AsLong(key);
        bool v = self->fThis->get(idx);
        return PyBool_FromLong(v ? 1 : 0);
    } else {
        PyErr_SetString(PyExc_TypeError, "Invalid subscript");
        return NULL;
    }
}
Exemple #13
0
static int pySynchedObject_setExcludes(pySynchedObject* self, PyObject* value, void*) {
    if (value == NULL) {
        plSynchedObject::Convert(IConvert((pyCreatable*)self))->clearExcludes();
        return 0;
    } else if (PyList_Check(value)) {
        size_t count = PyList_Size(value);
        for (size_t i=0; i<count; i++) {
            if (!PyAnyStr_Check(PyList_GetItem(value, i))) {
                PyErr_SetString(PyExc_TypeError, "excludes should be a list of strings");
                return -1;
            }
            plSynchedObject::Convert(IConvert((pyCreatable*)self))->setExclude(PyStr_To_PlStr(PyList_GetItem(value, i)));
        }
        return 0;
    } else {
        PyErr_SetString(PyExc_TypeError, "excludes should be a list of strings");
        return -1;
    }
}
Exemple #14
0
static int pyBitVector_AssSubscript(pyBitVector* self, PyObject* key, PyObject* value) {
    if (!PyInt_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "BitVector bits should be bools");
        return -1;
    }
    bool b = (PyInt_AsLong(value) != 0);

    if (PyAnyStr_Check(key)) {
        Py_INCREF(key);
        plString name = PyStr_To_PlStr(key);
        int idx = (int)self->fThis->getValue(name);
        Py_DECREF(key);
        self->fThis->set(idx, b);
        return 0;
    } else if (PyInt_Check(key)) {
        int idx = PyInt_AsLong(key);
        self->fThis->set(idx, b);
        return 0;
    } else {
        PyErr_SetString(PyExc_TypeError, "Invalid subscript");
        return -1;
    }
}