8 #include "gb/creator/makeuniv.h" 14 #include "gb/GB_server.h" 15 #include "gb/buffers.h" 17 #include "gb/creator/makestar.h" 18 #include "gb/creator/namegen.h" 20 #include "gb/files_shl.h" 21 #include "gb/globals.h" 25 #include "gb/sql/sql.h" 26 #include "gb/tweakables.h" 27 #include "gb/utils/fileutils.h" 28 #include "gb/utils/rand.h" 42 int main(
int argc,
char *argv[]) {
49 bzero(&Sdata,
sizeof(Sdata));
51 NameGenerator *star_name_gen =
nullptr;
52 NameGenerator *planet_name_gen =
nullptr;
56 for (i = 1; i < argc; i++)
57 if (argv[i][0] !=
'-')
96 printf(
"Unknown option \"%s\".\n", argv[i]);
100 "Usage: makeuniv [-a] [-b] [-e E] [-l MIN] [-m MAX] [-s N] [-v] " 102 printf(
" -a Autoload star names.\n");
103 printf(
" -b Autoload planet names.\n");
104 printf(
" -d Use all defauls and autoloaded names.\n");
105 printf(
" -e E Make E%% of stars have no planets.\n");
106 printf(
" -l MIN Other systems will have at least MIN planets.\n");
107 printf(
" -m MAX Other systems will have at most MAX planets.\n");
108 printf(
" -s S The universe will have S stars.\n");
109 printf(
" -v Print info and map of planets generated.\n");
110 printf(
" -w Print info on stars generated.\n");
118 printf(
"\nDo you wish to use the file \"%s\" for star names? [y/n]> ",
125 printf(
"\nDo you wish to use the file \"%s\" for planet names? [y/n]> ",
132 printf(
"Number of stars [1-%d]:",
NUMSTARS - 1);
136 printf(
"Minimum number of planets per system [1-%d]: ",
MAXPLANETS);
140 printf(
"Maximum number of planets per system [%d-%d]: ",
minplanets,
152 for (starnum_t star = 0; star <
nstars; star++) {
162 for (i=0; i<CREAT_UNIV_ITERAT; i++)
163 for (star=0; star<Sdata.numstars; star++) {
164 for (x=0; x<Sdata.numstars; x++)
167 att = 10*UNIVSIZE / Distsq(Stars[star]->xpos, Stars[star]->ypos, Stars[x]->xpos, Stars[x]->ypos);
168 xspeed[star] += att * (Stars[star]->xpos - Stars[x]->xpos);
169 if (Stars[star]->xpos>UNIVSIZE || Stars[star]->xpos< -UNIVSIZE)
171 yspeed[star] += att * (Stars[star]->ypos - Stars[x]->ypos);
172 if (Stars[star]->ypos>UNIVSIZE || Stars[star]->ypos< -UNIVSIZE)
175 Stars[star]->xpos += xspeed[star];
176 Stars[star]->ypos += yspeed[star];
181 for (starnum_t star = 0; star < Sdata.numstars; star++)
194 bzero((
char *)p,
sizeof(p));
195 InitFile(
POWFL, p,
sizeof(p));
200 bzero((
char *)p,
sizeof(p));
209 for (i=1; i<MAXPLAYERS; i++) {
210 sprintf(str,
"%s.%d", TELEGRAMFL, i );
int main(int argc, char *argv[])
static int occupied[100][100]
void putstar(startype *s, starnum_t snum)
void place_star(startype *)
static int planetlesschance
void putsdata(struct stardata *S)