Squashed commit of the following: [reprs_and_member_names]
Closes #22 Closes #23 Closes #24 Closes #25 Closes #31 Closes #56 commit43fac8f4f3Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 20 18:32:52 2024 -0400 Typo in UIFrame repr commit3fd5ad93e2Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 20 18:32:30 2024 -0400 Add UIGridPoint and UIGridPointState repr commit03376897b8Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 20 18:32:17 2024 -0400 Add UIGrid repr commit48af072a33Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 20 18:32:05 2024 -0400 Add UIEntity repr
This commit is contained in:
parent
c2de9b08d6
commit
232105a893
7 changed files with 76 additions and 5 deletions
|
|
@ -98,6 +98,19 @@ PyGetSetDef UIGridPoint::getsetters[] = {
|
|||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
PyObject* UIGridPoint::repr(PyUIGridPointObject* self) {
|
||||
std::ostringstream ss;
|
||||
if (!self->data) ss << "<GridPoint (invalid internal object)>";
|
||||
else {
|
||||
auto gp = self->data;
|
||||
ss << "<GridPoint (walkable=" << (gp->walkable ? "True" : "False") << ", transparent=" << (gp->transparent ? "True" : "False") <<
|
||||
", tilesprite=" << gp->tilesprite << ", tile_overlay=" << gp->tile_overlay << ", uisprite=" << gp->uisprite <<
|
||||
")>";
|
||||
}
|
||||
std::string repr_str = ss.str();
|
||||
return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace");
|
||||
}
|
||||
|
||||
PyObject* UIGridPointState::get_bool_member(PyUIGridPointStateObject* self, void* closure) {
|
||||
if (reinterpret_cast<long>(closure) == 0) { // visible
|
||||
return PyBool_FromLong(self->data->visible);
|
||||
|
|
@ -132,3 +145,14 @@ PyGetSetDef UIGridPointState::getsetters[] = {
|
|||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
PyObject* UIGridPointState::repr(PyUIGridPointStateObject* self) {
|
||||
std::ostringstream ss;
|
||||
if (!self->data) ss << "<GridPointState (invalid internal object)>";
|
||||
else {
|
||||
auto gps = self->data;
|
||||
ss << "<GridPointState (visible=" << (gps->visible ? "True" : "False") << ", discovered=" << (gps->discovered ? "True" : "False") <<
|
||||
")>";
|
||||
}
|
||||
std::string repr_str = ss.str();
|
||||
return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue