bugFreeciv - Bugs: bug #20831, Problems in...

 
 
Show feedback again

bug #20831: Problems in server/generator/mapgen.c: Part 3, start positions

Submitted by:  Micke <mss_8734>
Submitted on:  Sun 19 May 2013 05:34:57 PM UTC  
 
Category: generalSeverity: 3 - Normal
Priority: 5 - NormalStatus: None
Assigned to: NoneOpen/Closed: Open
Release: 2.6Operating System: Any
Planned Release: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 19 May 2013 05:34:57 PM UTC, original submission:

First, the start position data one has to supply make_island() with is not
used for anything but a check that it is >= 0.
Second, there is no other way to pass any start position data except the desired distribution method to create_start_positions; one cannot supply any information about on which islands one wants start positions.

One can sort of overcome this by calling create_start_positions() in between creating the islands on which one wants start positions and creating the rest, but there is no guarantee that the right amount are placed on the different islands.

This brings me to a couple of problems in server/generator/startpos.c:
Third, create_start_positions will change distribution method internally if it thinks the supplied islands are the wrong number or have the wrong terrain and still return true. This cannot be tracked by the generator which called it without searching for the information in the log (one can make an educated guess by keeping a list of intentions and comparing to the resulting map, but that cannot be considered completely reliable), although a roundabout way to affect the outcome would be to temporarily fill every tile that can have them on islands intented for start positions with resources to make them valuable enough; I fear without trying, however, that this would instead make them considered good enough for more players than intended for any distribution method other than single and all, at least as long as they are considered large enough.
Back in mapgen.c, map_fractal_generate (which is normally the only one to call create_start_positions, once the map is otherwise finished) then uses its own switch to try different distribution methods if the first one it tried fails. I have no idea what the intention behind this double change is...
Fourth, create_start_positions does a qsort on its island list, so even the roundabout way of looking at the (quite sparse, although this, at least, is easy enough to change without risk of breaking anything) log output does not really help much in tracking what goes where.

I can solve most, perhaps even all, of this by writing some cloned functions to bypass the offending ones for the generator I am working on (and generic enough to be useable by other generators - I have two more in mind myself). On the one hand random heaps of parallel code tend to make programmes rather bloated, but on the other hand, if I produce something functional without mucking about in and breaking existing code someone involved in maintaining (or perhaps even creating) the current map generators might be able to merge those heaps into something better.

Micke <mss_8734>

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mss_8734 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup