2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2005-02-06 13:41:02 +00:00
|
|
|
#ifndef STRING_H
|
|
|
|
#define STRING_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* dst: destination buffer
|
|
|
|
* src: string to copy/concatenate
|
|
|
|
* size: size of the destination buffer
|
|
|
|
* usage: ttd_strlcpy(dst, src, lengthof(dst));
|
|
|
|
*/
|
|
|
|
void ttd_strlcat(char *dst, const char *src, size_t size);
|
|
|
|
void ttd_strlcpy(char *dst, const char *src, size_t size);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* dst: destination buffer
|
|
|
|
* src: string to copy
|
|
|
|
* last: pointer to the last element in the dst array
|
|
|
|
* if NULL no boundary check is performed
|
|
|
|
* returns a pointer to the terminating \0 in the destination buffer
|
|
|
|
* usage: strecpy(dst, src, lastof(dst));
|
|
|
|
*/
|
|
|
|
char* strecat(char* dst, const char* src, const char* last);
|
|
|
|
char* strecpy(char* dst, const char* src, const char* last);
|
|
|
|
|
2005-07-29 21:52:20 +00:00
|
|
|
char* CDECL str_fmt(const char* str, ...);
|
|
|
|
|
2005-12-20 20:52:05 +00:00
|
|
|
/** Scans the string for valid characters and if it finds invalid ones,
|
|
|
|
* replaces them with a question mark '?' */
|
|
|
|
void str_validate(char *str);
|
|
|
|
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
/**
|
|
|
|
* Valid filter types for IsValidAsciiChar.
|
|
|
|
*/
|
|
|
|
typedef enum CharSetFilter {
|
|
|
|
CS_ALPHANUMERAL, //! Both numeric and alphabetic and spaces and stuff
|
|
|
|
CS_NUMERAL, //! Only numeric ones
|
|
|
|
CS_ALPHA, //! Only alphabetic values
|
2006-08-19 09:31:22 +00:00
|
|
|
} CharSetFilter;
|
|
|
|
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
/**
|
|
|
|
* Only allow certain keys. You can define the filter to be used. This makes
|
|
|
|
* sure no invalid keys can get into an editbox, like BELL.
|
2005-12-20 20:52:05 +00:00
|
|
|
* @param key character to be checked
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
* @param afilter the filter to use
|
|
|
|
* @return true or false depending if the character is printable/valid or not
|
|
|
|
*/
|
2006-08-19 09:31:22 +00:00
|
|
|
bool IsValidAsciiChar(byte key, CharSetFilter afilter);
|
2005-12-20 20:52:05 +00:00
|
|
|
|
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
- Load heightmaps (either BMP or PNG)
- Progress dialog while generating worlds (no longer a 'hanging' screen)
- New dialogs for NewGame, Create Scenario and Play Heightmap
- Easier to configure your landscape
- More things to configure (tree-placer, ..)
- Speedup of world generation
- New console command 'restart': restart the map EXACTLY as it was when you
first started it (needs a game made after or with this commit)
- New console command 'getseed': get the seed of your map and share it with
others (of course only works with generated maps)
- Many new, world generation related, things
- Many internal cleanups and rewrites
Many tnx to those people who helped making this:
Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
Many tnx to those who helped testing:
Arnau, Bjarni, and tokai (alfabetic)
And to all other people who helped testing and sending comments / bugs
Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
|
|
|
/** Convert the given string to lowercase */
|
|
|
|
void strtolower(char *str);
|
|
|
|
|
2005-09-18 20:56:44 +00:00
|
|
|
#endif /* STRING_H */
|