src/main.c

changeset 55
54ea19938d57
parent 52
26707039d5a6
child 69
c8f2c280cff7
equal deleted inserted replaced
54:eef745ba3774 55:54ea19938d57
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2014 Mike Becker. All rights reserved. 4 * Copyright 2016 Mike Becker. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
144 } 144 }
145 145
146 return 0; 146 return 0;
147 } 147 }
148 148
149 Settings default_settings() { 149 static Settings default_settings() {
150 Settings settings; 150 Settings settings;
151 memset(&settings, 0, sizeof(Settings)); 151 memset(&settings, 0, sizeof(Settings));
152 settings.gameinfo.servercolor = WHITE; 152 settings.gameinfo.servercolor = WHITE;
153 settings.port = "27015"; 153 settings.port = "27015";
154 return settings; 154 return settings;
192 } 192 }
193 } 193 }
194 refresh(); 194 refresh();
195 } 195 }
196 196
197 void leavescr() {
198 endwin();
199 }
200
201 int main(int argc, char **argv) { 197 int main(int argc, char **argv) {
202 srand(time(NULL)); 198 srand(time(NULL));
203 199
204 Settings settings = default_settings(); 200 Settings settings = default_settings();
205 if (get_settings(argc, argv, &settings)) { 201 if (get_settings(argc, argv, &settings)) {
216 } else { 212 } else {
217 fprintf(stderr, "Non-colored terminals are not supported yet."); 213 fprintf(stderr, "Non-colored terminals are not supported yet.");
218 endwin(); 214 endwin();
219 return EXIT_FAILURE; 215 return EXIT_FAILURE;
220 } 216 }
221 atexit(leavescr); 217 atexit((void(*)())endwin);
222 218
223 int exitcode; 219 int exitcode;
224 if (settings.singlemachine) { 220 if (settings.singlemachine) {
225 game_start_singlemachine(&settings); 221 game_start_singlemachine(&settings);
226 exitcode = EXIT_SUCCESS; 222 exitcode = EXIT_SUCCESS;

mercurial