Add: Overlay cargo icon in vehicle/depot list when holding shift+ctrl. (#12938)
[openttd-github.git] / src / os / macosx / osx_main.cpp
blob7d8a7994e949d1316dc97c2daa0b5d9f14c87b1a
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file unix_main.cpp Main entry for Mac OSX. */
10 #include "../../stdafx.h"
11 #include "../../openttd.h"
12 #include "../../crashlog.h"
13 #include "../../core/random_func.hpp"
14 #include "../../string_func.h"
16 #include <time.h>
17 #include <signal.h>
19 #include "macos.h"
21 #include "../../safeguards.h"
23 void CocoaSetupAutoreleasePool();
24 void CocoaReleaseAutoreleasePool();
26 int CDECL main(int argc, char *argv[])
28 /* Make sure our arguments contain only valid UTF-8 characters. */
29 for (int i = 0; i < argc; i++) StrMakeValidInPlace(argv[i]);
31 CocoaSetupAutoreleasePool();
32 /* This is passed if we are launched by double-clicking */
33 if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) {
34 argv[1] = nullptr;
35 argc = 1;
38 CrashLog::InitialiseCrashLog();
40 SetRandomSeed(time(nullptr));
42 signal(SIGPIPE, SIG_IGN);
44 int ret = openttd_main(std::span(argv, argc));
46 CocoaReleaseAutoreleasePool();
48 return ret;