Galaxy sortgroups fixed (Linux) From: arma@netcom.com (Arma) Date: Mon, 07 Aug 1995 00:00:00 +0000 I sat down today to port Blind Galaxy v2.43 to Linux, because several people had expressed complaints about a bug in the sortgroups function (and because I intend to move my Galaxy Herald to my Linux box once I get settled at MIT in a couple weeks). After some fiddling and chomping at the Makefile to configure it for my system, I successfully compiled all three executables. The New-game executable seg faulted during the "C" (create galaxy) command, and I tracked it to a line in new-game.c: p3 = alloc(sizeof(p)); This is in the swap_planet function, after the initial main while loop. Anyway, apparently p is of type "planet *", and planet is of type struct planetstruct, so all of this combines so that sizeof(p)==4, the size of a pointer. When I changed it to sizeof(*p) it became 184, a much more reasonable size for a full set of planet data. So after that was finished, I checked the rest of the code for similar occurrences of the sizeof() bug, and I found identical calls in 662 and 669 of turn.c -- where the "sortgroups" function does its magic. From the gpdg-list galaxy mailing list, it seems that this bug is not just limited to Linux -- it has been reported for SunOS and Ultrix as well. And, of course, there have been terrible rumours flying around here about Galaxy games on Linux machines that mysteriously halted because of software crashes. So all in all, I figured there'd be a lot of people here who would be interested in the bug. The fix? Change references of sizeof(p) to sizeof(planet *) (and the sizeof(group) in turn.c to sizeof(group *), et cetera). Grep for 'sizeof' and 'alloc' to make sure you get them all. I will be going out of town on Tuesday for a week, and will be happy to answer any questions when I get back -- I can be reached at arma@netcom.com. --Roger, Blind Galaxy GM of Test/Herald (used to be roger@bimcore.emory.edu). BTW, since my machine will be actually on the net soon, I'll be starting up as many as a dozen more games in the near future -- I'll post again later on. Also BTW, I will be posting this to the galaxy-list as well. If somebody could take care of getting it on the blindwork-list (I can't seem to get a response from the blindwork-request server) and any other lists it needs to be on, I would be grateful. Referenced By Up