annotate src/os2.cpp @ 6032:3f513357d37f draft

(svn r8755) -Fix Abbreviate GetAirport(st->airport_type) to st->Airport()
author tron <tron@openttd.org>
date Fri, 16 Feb 2007 09:38:43 +0000
parents cf00a1ba52bc
children 1d99c3541c11
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1 /* $Id$ */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
3 #include "stdafx.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
4 #include "openttd.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
5 #include "variables.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
6 #include "string.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
7 #include "table/strings.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
8 #include "gfx.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
9 #include "gui.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
10 #include "functions.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
11 #include "macros.h"
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
12 #include "fios.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
13
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
14 #include <dirent.h>
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
15 #include <unistd.h>
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
16 #include <sys/stat.h>
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
17 #include <stdlib.h>
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
18 #include <time.h>
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
19 #ifndef __INNOTEK_LIBC__
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
20 #include <dos.h>
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
21 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
22
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
23 #define INCL_WIN
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
24 #define INCL_WINCLIPBOARD
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
25
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
26 #include <os2.h>
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
27 #ifndef __INNOTEK_LIBC__
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
28 #include <i86.h>
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
29 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
30
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
31 bool FiosIsRoot(const char *file)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
32 {
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
33 return file[3] == '\0';
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
34 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
35
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
36 void FiosGetDrives(void)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
37 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
38 unsigned disk, disk2, save, total;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
39
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
40 #ifndef __INNOTEK_LIBC__
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
41 _dos_getdrive(&save); // save original drive
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
42 #else
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
43 save = _getdrive(); // save original drive
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
44 total = 'z';
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
45 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
46
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
47 /* get an available drive letter */
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
48 #ifndef __INNOTEK_LIBC__
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
49 for (disk = 1;; disk++) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
50 _dos_setdrive(disk, &total);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
51 #else
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
52 for (disk = 'A';; disk++) {
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
53 _chdrive(disk);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
54 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
55 if (disk >= total) return;
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
56
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
57 #ifndef __INNOTEK_LIBC__
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
58 _dos_getdrive(&disk2);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
59 #else
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
60 disk2 = _getdrive();
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
61 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
62
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
63 if (disk == disk2) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
64 FiosItem *fios = FiosAlloc();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
65 fios->type = FIOS_TYPE_DRIVE;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
66 fios->mtime = 0;
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
67 #ifndef __INNOTEK_LIBC__
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
68 snprintf(fios->name, lengthof(fios->name), "%c:", 'A' + disk - 1);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
69 #else
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
70 snprintf(fios->name, lengthof(fios->name), "%c:", disk);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
71 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
72 ttd_strlcpy(fios->title, fios->name, lengthof(fios->title));
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
73 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
74 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
75
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
76 /* Restore the original drive */
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
77 #ifndef __INNOTEK_LIBC__
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
78 _dos_setdrive(save, &total);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
79 #else
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
80 _chdrive(save);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
81 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
82 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
83
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
84 bool FiosGetDiskFreeSpace(const char *path, uint32 *tot)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
85 {
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
86 #ifndef __INNOTEK_LIBC__
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
87 struct diskfree_t free;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
88 char drive = path[0] - 'A' + 1;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
89
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
90 if (tot != NULL && _getdiskfree(drive, &free) == 0) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
91 *tot = free.avail_clusters * free.sectors_per_cluster * free.bytes_per_sector;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
92 return true;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
93 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
94
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
95 return false;
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
96 #else
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
97 uint32 free = 0;
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
98
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
99 #ifdef HAS_STATVFS
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
100 {
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
101 struct statvfs s;
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
102
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
103 if (statvfs(path, &s) != 0) return false;
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
104 free = (uint64)s.f_frsize * s.f_bavail >> 20;
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
105 }
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
106 #endif
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
107 if (tot != NULL) *tot = free;
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
108 return true;
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
109 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
110 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
111
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
112 bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
113 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
114 char filename[MAX_PATH];
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
115
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
116 snprintf(filename, lengthof(filename), "%s" PATHSEP "%s", path, ent->d_name);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
117 if (stat(filename, sb) != 0) return false;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
118
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
119 return (ent->d_name[0] != '.'); // hidden file
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
120 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
121
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
122 static void ChangeWorkingDirectory(char *exe)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
123 {
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
124 char *s = strrchr(exe, PATHSEPCHAR);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
125
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
126 if (s != NULL) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
127 *s = '\0';
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
128 chdir(exe);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
129 *s = PATHSEPCHAR;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
130 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
131 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
132
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
133 void ShowInfo(const unsigned char *str)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
134 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
135 HAB hab;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
136 HMQ hmq;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
137 ULONG rc;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
138
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
139 // init PM env.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
140 hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
141
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
142 // display the box
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
143 rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, (const unsigned char *)"OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_INFORMATION);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
144
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
145 // terminate PM env.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
146 WinDestroyMsgQueue(hmq);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
147 WinTerminate(hab);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
148 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
149
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
150 void ShowOSErrorBox(const unsigned char *buf)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
151 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
152 HAB hab;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
153 HMQ hmq;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
154 ULONG rc;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
155
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
156 // init PM env.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
157 hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
158
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
159 // display the box
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
160 rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, (const unsigned char *)"OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_ERROR);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
161
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
162 // terminate PM env.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
163 WinDestroyMsgQueue(hmq);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
164 WinTerminate(hab);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
165 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
166
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
167 int CDECL main(int argc, char* argv[])
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
168 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
169 // change the working directory to enable doubleclicking in UIs
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
170 ChangeWorkingDirectory(argv[0]);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
171
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
172 _random_seeds[1][1] = _random_seeds[1][0] = _random_seeds[0][1] = _random_seeds[0][0] = time(NULL);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
173
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
174 return ttd_main(argc, argv);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
175 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
176
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
177 void DeterminePaths(void)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
178 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
179 char *s;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
180
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
181 _paths.game_data_dir = (char *)malloc(MAX_PATH);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
182 ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
183 #if defined SECOND_DATA_DIR
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
184 _paths.second_data_dir = malloc(MAX_PATH);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
185 ttd_strlcpy(_paths.second_data_dir, SECOND_DATA_DIR, MAX_PATH);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
186 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
187
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
188 #if defined(USE_HOMEDIR)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
189 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
190 const char *homedir = getenv("HOME");
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
191
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
192 if (homedir == NULL) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
193 const struct passwd *pw = getpwuid(getuid());
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
194 if (pw != NULL) homedir = pw->pw_dir;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
195 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
196
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
197 _paths.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
198 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
199
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
200 #else /* not defined(USE_HOMEDIR) */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
201
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
202 _paths.personal_dir = (char *)malloc(MAX_PATH);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
203 ttd_strlcpy(_paths.personal_dir, PERSONAL_DIR, MAX_PATH);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
204
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
205 // check if absolute or relative path
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
206 s = strchr(_paths.personal_dir, PATHSEPCHAR);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
207
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
208 // add absolute path
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
209 if (s == NULL || _paths.personal_dir != s) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
210 getcwd(_paths.personal_dir, MAX_PATH);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
211 s = strchr(_paths.personal_dir, 0);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
212 *s++ = PATHSEPCHAR;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
213 ttd_strlcpy(s, PERSONAL_DIR, MAX_PATH);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
214 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
215
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
216 #endif /* defined(USE_HOMEDIR) */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
217
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
218 s = strchr(_paths.personal_dir, 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
219
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
220 // append a / ?
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
221 if (s[-1] != PATHSEPCHAR) strcpy(s, PATHSEP);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
222
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
223 _paths.save_dir = str_fmt("%ssave", _paths.personal_dir);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
224 _paths.autosave_dir = str_fmt("%s" PATHSEP "autosave", _paths.save_dir);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
225 _paths.scenario_dir = str_fmt("%sscenario", _paths.personal_dir);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
226 _paths.heightmap_dir = str_fmt("%sscenario" PATHSEP "heightmap", _paths.personal_dir);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
227 _paths.gm_dir = str_fmt("%sgm" PATHSEP, _paths.game_data_dir);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
228 _paths.data_dir = str_fmt("%sdata" PATHSEP, _paths.game_data_dir);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
229
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
230 if (_config_file == NULL)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
231 _config_file = str_fmt("%sopenttd.cfg", _paths.personal_dir);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
232
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
233 _highscore_file = str_fmt("%shs.dat", _paths.personal_dir);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
234 _log_file = str_fmt("%sopenttd.log", _paths.personal_dir);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
235
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
236 #if defined CUSTOM_LANG_DIR
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
237 // sets the search path for lng files to the custom one
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
238 _paths.lang_dir = malloc( MAX_PATH );
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
239 ttd_strlcpy( _paths.lang_dir, CUSTOM_LANG_DIR, MAX_PATH);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
240 #else
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
241 _paths.lang_dir = str_fmt("%slang" PATHSEP, _paths.game_data_dir);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
242 #endif
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
243
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
244 // create necessary folders
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
245 #ifndef __INNOTEK_LIBC__
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
246 mkdir(_paths.personal_dir);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
247 mkdir(_paths.save_dir);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
248 mkdir(_paths.autosave_dir);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
249 mkdir(_paths.scenario_dir);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
250 mkdir(_paths.heightmap_dir);
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
251 #else
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
252 mkdir(_paths.personal_dir, 0755);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
253 mkdir(_paths.save_dir, 0755);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
254 mkdir(_paths.autosave_dir, 0755);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
255 mkdir(_paths.scenario_dir, 0755);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
256 mkdir(_paths.heightmap_dir, 0755);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
257 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
258 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
259
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
260 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
261 * Insert a chunk of text from the clipboard onto the textbuffer. Get TEXT clipboard
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
262 * and append this up to the maximum length (either absolute or screenlength). If maxlength
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
263 * is zero, we don't care about the screenlength but only about the physical length of the string
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
264 * @param tb @Textbuf type to be changed
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
265 * @return Return true on successfull change of Textbuf, or false otherwise
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
266 */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
267 bool InsertTextBufferClipboard(Textbuf *tb)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
268 {
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
269 /* XXX -- Currently no clipboard support implemented with GCC */
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
270 #ifndef __INNOTEK_LIBC__
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
271 HAB hab = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
272
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
273 if (WinOpenClipbrd(hab))
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
274 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
275 const char* text = (const char*)WinQueryClipbrdData(hab, CF_TEXT);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
276
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
277 if (text != NULL)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
278 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
279 uint length = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
280 uint width = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
281 const char* i;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
282
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
283 for (i = text; IsValidAsciiChar(*i); i++)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
284 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
285 uint w;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
286
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
287 if (tb->length + length >= tb->maxlength - 1) break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
288
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
289 w = GetCharacterWidth(FS_NORMAL, (byte)*i);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
290 if (tb->maxwidth != 0 && width + tb->width + w > tb->maxwidth) break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
291
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
292 width += w;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
293 length++;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
294 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
295
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
296 memmove(tb->buf + tb->caretpos + length, tb->buf + tb->caretpos, tb->length - tb->caretpos + 1);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
297 memcpy(tb->buf + tb->caretpos, text, length);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
298 tb->width += width;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
299 tb->caretxoffs += width;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
300 tb->length += length;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
301 tb->caretpos += length;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
302
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
303 WinCloseClipbrd(hab);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
304 return true;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
305 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
306
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
307 WinCloseClipbrd(hab);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
308 }
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
309 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
310 return false;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
311 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
312
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
313
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
314 void CSleep(int milliseconds)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
315 {
5591
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
316 #ifndef __INNOTEK_LIBC__
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
317 delay(milliseconds);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
318 #else
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
319 usleep(milliseconds * 1000);
cf00a1ba52bc (svn r8042) - Fix: OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for their help)
orudge <orudge@openttd.org>
parents: 5584
diff changeset
320 #endif
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
321 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
322
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
323 const char *FS2OTTD(const char *name) {return name;}
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
324 const char *OTTD2FS(const char *name) {return name;}