ttd.c
changeset 1317 f382f1b439c7
parent 1314 d6a253cf92c3
child 1329 a8a0d60b0a8e
equal deleted inserted replaced
1316:a7352de83a2b 1317:f382f1b439c7
     1 #include "stdafx.h"
     1 #include "stdafx.h"
       
     2 #include "string.h"
     2 #include "table/strings.h"
     3 #include "table/strings.h"
     3 #include "debug.h"
     4 #include "debug.h"
     4 #include "strings.h"
     5 #include "strings.h"
     5 #include "map.h"
     6 #include "map.h"
     6 #include "tile.h"
     7 #include "tile.h"
   195 		}
   196 		}
   196 	} while ((++dd)->name);
   197 	} while ((++dd)->name);
   197 	return best;
   198 	return best;
   198 }
   199 }
   199 
   200 
   200 void ttd_strlcpy(char *dst, const char *src, size_t size)
       
   201 {
       
   202 	assert(size > 0);
       
   203 	while (--size > 0 && *src != '\0') *dst++ = *src++;
       
   204 	*dst = '\0';
       
   205 }
       
   206 
       
   207 void ttd_strlcat(char *dst, const char *src, size_t size)
       
   208 {
       
   209 	assert(size > 0);
       
   210 	for (; size > 0 && *dst != '\0'; --size, ++dst) {}
       
   211 	assert(size > 0);
       
   212 	while (--size > 0 && *src != '\0') *dst++ = *src++;
       
   213 	*dst = '\0';
       
   214 }
       
   215 
       
   216 static char *strecpy(char *dst, const char *src)
       
   217 {
       
   218 	while ( (*dst++ = *src++) != 0) {}
       
   219 	return dst - 1;
       
   220 }
       
   221 
   201 
   222 void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize)
   202 void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize)
   223 {
   203 {
   224 	FILE *in;
   204 	FILE *in;
   225 	byte *mem;
   205 	byte *mem;
   316 		"  -D                  = Start dedicated server\n"
   296 		"  -D                  = Start dedicated server\n"
   317 		#if !defined(__MORPHOS__) && !defined(__AMIGA__)
   297 		#if !defined(__MORPHOS__) && !defined(__AMIGA__)
   318 		"  -f                  = Fork into the background (dedicated only)\n"
   298 		"  -f                  = Fork into the background (dedicated only)\n"
   319 		#endif
   299 		#endif
   320 		"  -i                  = Force to use the DOS palette (use this if you see a lot of pink)\n"
   300 		"  -i                  = Force to use the DOS palette (use this if you see a lot of pink)\n"
   321 		"  -p #player          = Player as #player (deprecated) (network only)\n"
   301 		"  -p #player          = Player as #player (deprecated) (network only)\n",
       
   302 		lastof(buf)
   322 	);
   303 	);
   323 
   304 
   324 	for(i=0; i!=lengthof(_driver_classes); i++,dc++) {
   305 	for(i=0; i!=lengthof(_driver_classes); i++,dc++) {
   325 		p += sprintf(p, "List of %s drivers:\n", dc->name);
   306 		p += sprintf(p, "List of %s drivers:\n", dc->name);
   326 		dd = dc->descs;
   307 		dd = dc->descs;