So I checked out the code last night in an attempt to make it run more smoothly on native Linux. Didn't really get very far before I ran into some issues, though:
cScreenBuildingManagement.cpp:301
blocks[i].bevel_t = get_id(
string("BevelTop") + istr, false
);
blocks[i].bevel_b = get_id(
string("BevelBottom") + istr, false
);
blocks[i].bevel_r = get_id(
string("BevelRight") + istr, false
);
blocks[i].bevel_l = get_id(
string("BevelLeft") + istr, false
);
This cause compilation errors; looking through the Git history it looks like the get_id method was changed fairly recently. I'm guessing the correct syntax at the moment would be to replace the false
with "*Unused*"
to get the same behavior; at the very least, that 's what I did and it doesn't seem to have caused any other irregularities.
cRival.cpp:711:
// use or sell items
if (curr->m_NumInventory > 0)
{
for (int i = 0; i < MAXNUM_RIVAL_INVENTORY; i++)
{
sInventoryItem* temp = curr->m_Inventory[i];
if (temp && g_Dice.percent(50))
{
if (g_Dice.percent(50)) income += (temp->m_Cost / 2);
RemoveRivalInvByNumber(curr, i);
}
}
}
This is what really had me scratching my head. Crashed every week, and the last thing I could find in the logs was always related to the weekly gang updates, without indication that it had moved on to rival handling. Had to start messing with GDB to figure out where exactly it was crashing, and the culprit was here:
if (g_Dice.percent(50)) income += (temp->m_Cost / 2);
Basically, we can look at a rival's inventory all we want, and set items in it to null at will. But if you actually try reading any part of an individual item's struct? Cannot access memory, segfault, die. Given that this code hasn't changed in over a year, I'm guessing the problem's just a symptom caused by some other change in how inventories or items are handled, but fuck if I don't hate C++ and its memory management. Dunno why it's causing issues on Linux either if .06.03.07 is running fine on Windows, unless it's the fault of a g++ optimization or some bit of Linux-specific code somewhere else. Doesn't seem to affect player/shop/girl inventory management. Guess I'll do more digging tonight.
EDIT: Rival inventories didn't work because they weren't properly initialized anywhere. Tossed in a few lines to zero out their inventories during creation and it seems to work fine. Weird that the MS compiler seems to know to zero-initialize when g++ and clang wouldn't.