|
Post by celebaglar on Sept 28, 2004 15:13:46 GMT
In game 87 - Enola Fey - I have searched quite a lot and so far have found nothing at every lith and ruin that's been visited. Could it be that under certain conditions no goodies are initially allocated to the usual places at all?
Waters of life seem fine though.
|
|
|
Post by sparrowhawk on Sept 28, 2004 15:17:54 GMT
Hi Bill,
This is a known bug ( I think that it's been raised twice before? Not sure exactly).
I'm pretty sure that the goodies get created correctly, so it must be in the seeking code.
|
|
|
Post by celebaglar on Sept 28, 2004 15:41:16 GMT
Yes, I raised the last one I seem to remember...
However, there is a difference. While on that occasion there were quite a few empty liths, this time every lith and ruin seems empty, over 8 days and more than 10 searches.
I'll happily close this thread if it's a duplicate though.
|
|
|
Post by sparrowhawk on Sept 28, 2004 21:36:02 GMT
I was wrong - I just checked and you are quite correct, there are no goodies at ANY liths in this game There ARE goodies at: Lakes Henges Caverns Snowhalls Villages So Ruins are also not getting their goodies-allocation. Any terrain type that I've missed? (Towers work in a different way) It's gone straight to the top of my to do list. Hopefully have it resolved by tomorrow.
|
|
|
Post by sparrowhawk on Sept 29, 2004 9:45:40 GMT
OK, I need some help from fellow MySQL people out there. It's not just ruins and liths, it's any terrain where more than 1 type of goodie might appear. So only Villages and Snowhalls are guranteed to work ok, as they have a 100% probablity of shelter. INSERT INTO MSI_MapSpecialItems(MSI_GAM_ID, MSI_TTY_ID, MSI_Row, MSI_Column, MSI_SIT_ID) SELECT $gameID, MPD_TTY_ID, MPD_Row, MPD_Column, TSI_SIT_ID FROM MPD_MapDescriptions INNER JOIN TSI_TerrainSpecialItems ON TSI_TTY_ID = MPD_TTY_ID WHERE (CEILING( RAND() * 100) BETWEEN TSI_LowerBoundary AND TSI_UpperBoundary) AND MPD_SCN_ID = $scenarioID GROUP BY MPD_ID //This avoids duplicates
The culprit is the first WHERE clause, with the random number. It's identifying a record in the TSI table where the random number falls within the range set by two fields. If I replace the CEILING( RAND() * 100) with a fixed number, say 25, then all liths for example get COD. With 55, they all get BOC. So the SQL is logically correct, but the fact that I am using a random number function to return an integer between 1 and 100 fails, whereas a hard coded value works Can anyone shed any light onto this? The TSI table and it's contents are as follows, if that helps (apologies for lack of formatting):
|
|
Natmus
Morkin Admin
Fight the power!
Posts: 4,518
|
Post by Natmus on Sept 29, 2004 10:00:24 GMT
If I replace the CEILING( RAND() * 100) with a fixed number, say 25, then all liths for example get COD. With 55, they all get BOC. So the SQL is logically correct, but the fact that I am using a random number function to return an integer between 1 and 100 fails, whereas a hard coded value works Can anyone shed any light onto this? I'm not really into MySQL, but have you checked a list of numbers generated by the "CEILING( RAND() * 100)" function. What exactly do the "CEILING" bit do?
|
|
Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Sept 29, 2004 10:07:34 GMT
Hmmm, strange. Try replacing WHERE with AND?
|
|
|
Post by sparrowhawk on Sept 29, 2004 11:15:57 GMT
I'm not really into MySQL, but have you checked a list of numbers generated by the "CEILING( RAND() * 100)" function. What exactly do the "CEILING" bit do? Yes, I've tried that and it's generating a correct range of numbers between 1 and 100. The ceiling function takes a real number and converts it to the nearest highest integer (so 1.23 become 2, -1.23 become 1).
|
|
|
Post by sparrowhawk on Sept 29, 2004 11:16:30 GMT
Hmmm, strange. Try replacing WHERE with AND? You need a WHERE to tell the SQL where the conditions are starting. All very puzzling.
|
|
|
Post by sparrowhawk on Sept 29, 2004 11:17:49 GMT
I have solved the problem by changing the code to use 2 queries instead of one, although this does mean that the second one gets called numerous times within the loop of the first's result set. So slower. This does not explain WHY the original does not work though
|
|
Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Sept 29, 2004 12:48:09 GMT
You need a WHERE to tell the SQL where the conditions are starting. All very puzzling. By changing where to and I meant that you try to add the condition to inner join's ON clause.
|
|
|
Post by sparrowhawk on Sept 29, 2004 13:13:48 GMT
Aha! Sorry, misunderstood you.
Yes, I'd already tried that, and had exactly the same result.
|
|
|
Post by sparrowhawk on Sept 30, 2004 9:18:41 GMT
Anyway, this should now be fixed (I had to change the processing to use 2 queries instead of 1). Please could you report back after you have played NEW games (ie those started since the 0.2f upload)
|
|
|
Post by sparrowhawk on Sept 30, 2004 15:06:31 GMT
I've created a few test games and done some spot checks - LOM liths = 93, populated liths = 93
The others also seem OK.
I'm going to mark this as Fixed - but let me know if you wish to reopen this bug.
|
|