Re: Creating a REAL map with real geography and cities
Posted: 18 Oct 2013 11:29
if locale is really the problem, it might expect "O" instead of "E"
The place to talk about Transport Tycoon
https://www.tt-forums.net/
Code: Select all
if (sscanf(buf, "%lg%c,%lg%c,%lg%c,%lg%c",
&top.latitude, &top.lat_dir, &top.longitude, &top.long_dir, &bottom.latitude, &bottom.lat_dir, &bottom.longitude, &bottom.long_dir) != 8) {
IConsolePrintF(CC_ERROR, "Error reading edge coordinates at %s:%d: you're doing it wrong", argv[1], line);
return true;
I've made some comments on your patch in case you will want to make it better comply with the OpenTTD coding standards. (Look for "Zuu" in the attached patch file)Zydeco wrote:When I was making a few maps from heightmaps a few years ago, I made a patch that would read towns and coordinates from a CSV file, and place them automatically, or place a sign if the towns failed to found.
I've updated it for the current version, and tried with your data (although I set all the town sizes to small, it would require manually growing them.
It also fails to place a few, because my edge coordinates are a bit off, but it saves lots of work finding where to place towns.
I've uploaded the patch, heightmap and the towns file I made by rearranging yours into the format needed by my patch, and the heightmap resulting from running the import_towns path/to/towns-pt.txt command in the editor, without doing any further adjustments
So "if (sscanf(buf, "%lg%c,%lg%c,%lg%c,%lg%c"..." looks at the data, sees a number followed by E and doesn't recognize that E as a char, because that's how floating point numbers roll. Now I'm extremely puzzled, why this only happened on my systemA series of decimal digits, optionally containing a decimal point, optionally preceeded by a sign (+ or -) and optionally followed by the e or E character and a decimal integer (or some of the other sequences supported by strtod). Implementations complying with C99 also support hexadecimal floating-point format when preceded by 0x or 0X.
Code: Select all
Error reading edge coordinates at towns-pt.txt:1: you're doing it wrong
You can filter them out with column [NT] - filtering "N" get rid of all alternative names.moki wrote:there are many duplicate entries in the files. Most bigger towns are listed several times - once with their current name and then with different historical, local (like gaelic names for Ireland) and international (Warszawa is also Warsaw) naming variants.
Extended version of this patch, with not only cities but also another objects (industry, water, trees, rocks, signs etc) with 4096x4096 support is here:Lordmwa wrote:Apologies for the digging but I am creating a 2048x4096 new UK scenario for a project and this patch would be incredibly useful. Unfortunately the latest binaries are before 4096 was supported - Could anyone possibly create a version of this using current trunk?