On removing any factory, either by it closing down automatically or being bulldozed by the public player, I get an access violation in slist_tpl_t, which is caused by the following code:
if(plan) {
// we need a copy, since the verbinde fabriken is modifying the list
halthandle_t list[48];
const uint8 count = plan->get_haltlist_count();
assert(count<48);
memcpy( list, plan->get_haltlist(), count*sizeof(nearby_halt_t) );
for( uint8 i=0; i<count; i++ ) {
// first remove all the tiles that do not connect
plan->remove_from_haltlist( this, list[i] );
// then reconnect
list[i]->verbinde_fabriken();
}
in simworld.cc calling list[i]->verbinde_fabriken();
when list[i]
is an invalid (but not null) pointer.
Very interesting. Factory deletion is working fine for me on the mail-revenue branch. Please try the ncn-devel branch; I suspect it is working there too. I am getting crashes on the dinglist-cleanup branch...
The dinglist changes are very tricky and I want to understand them better before merging them. I did not want you to merge my dinglist-cleanup branch, but you merged it by accident because I failed to upload dinglist-cleanup-light.
I strongly suggest that you rebranch -- start a new working branch -- from the point *before* you merged my dinglist-cleanup branch. Then
(1) merge my ncn-devel branch, which is in relatively good shape apart from the bugs in the ticker display.
(2) cherry-pick any individual fixes which you made (you can go through them in the "network" graph on the github website).
We can merge dinglist-cleanup after we better understand the problem.
I have fixed this - it was actually a simpler problem than first anticipated: the dud pointers came from a halthandle, which can be bounds checked, and also appeared in versions other than dingliste-cleanup.