/* OreGen - MineCraft Ore Generator */ /* Copyright (C) 2011 by Justin Aquadro Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "oregen.h" #include "replace.h" #include "chunk.h" // Returns an interior reference to the same object! const char * basename (const char *path) { int i; for (i = strlen(path); i >= 0; i--) { if (path[i] == '\\' || path[i] == '/') { return &path[i+1]; } } return path; } void print_usage (const char *name) { fprintf(stderr, "Usage: %s [options]\n", basename(name)); fprintf(stderr, "Available tools:\n"); fprintf(stderr, " list : List chunks that match search criteria\n"); fprintf(stderr, " oregen : Generate new ore deposits\n"); fprintf(stderr, " prune : Delete chunks matching search criteria\n"); fprintf(stderr, " replace : Replace one block type with another\n\n"); fprintf(stderr, "Usage and options for 'oregen':\n"); fprintf(stderr, " %s oregen [options]\n\n", basename(name)); fprintf(stderr, " Ore IDs:\n"); fprintf(stderr, " 16 = Coal, 15 = Iron, 14 = Gold, 73 = Redstone, 56 = Diamond, 21 = Lapis\n"); fprintf(stderr, " Options:\n"); fprintf(stderr, " -r : Number of rounds ore is generated per chunk\n"); fprintf(stderr, " -mn : Minimum depth ore is generated (0-127)\n"); fprintf(stderr, " -mx : Maximum depth ore is generated (0-127)\n"); fprintf(stderr, " -s : Size of ore deposit (0-63) -- Defaults:\n"); fprintf(stderr, " Coal = 16, Iron/Gold = 8, Redstone/Diamond/Lapis = 7\n"); fprintf(stderr, " -oo : Take precedence over all existing ores\n"); fprintf(stderr, " -ob : Take precedence over all existing blocks (excluding air)\n"); fprintf(stderr, " -oa : Take precedence over all existing blocks (including air)\n"); fprintf(stderr, " -oi : Take precedence over a specific block type\n\n"); fprintf(stderr, "Usage and options for 'replace':\n"); fprintf(stderr, " %s replace [options]\n\n", basename(name)); fprintf(stderr, " Options:\n"); fprintf(stderr, " -mn : Minimum depth blocks are replaced (0-127)\n"); fprintf(stderr, " -mx : Maximum height blocks are replaced (0-127)\n"); fprintf(stderr, " -p : Probability that an individual block is replaced (0.0-1.0)\n"); fprintf(stderr, "Common Options:\n"); /*fprintf(stderr, " -cb