diff options
author | frosch <frosch@openttd.org> | 2012-10-27 15:26:17 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-10-27 15:26:17 +0000 |
commit | 2d550a7579841adc0d0fe6664bee0375363e6066 (patch) | |
tree | e59dac0923f3b89aa8feca8abd357ff50151d79a /src/stringfilter.cpp | |
parent | 716014c4103add88e92a59e6e0f87d3bbbab8e21 (diff) | |
download | openttd-2d550a7579841adc0d0fe6664bee0375363e6066.tar.xz |
(svn r24632) -Feature: Add text filtering to advanced settings.
Diffstat (limited to 'src/stringfilter.cpp')
-rw-r--r-- | src/stringfilter.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/stringfilter.cpp b/src/stringfilter.cpp index 616fd9854..e021c57b5 100644 --- a/src/stringfilter.cpp +++ b/src/stringfilter.cpp @@ -11,7 +11,9 @@ #include "stdafx.h" #include "string_func.h" +#include "strings_func.h" #include "stringfilter_type.h" +#include "gfx_func.h" static const WChar STATE_WHITESPACE = ' '; static const WChar STATE_WORD = 'w'; @@ -117,4 +119,17 @@ void StringFilter::AddLine(const char *str) } } - +/** + * Pass another text line from the current item to the filter. + * + * You can call this multiple times for a single item, if the filter shall apply to multiple things. + * Before processing the next item you have to call ResetState(). + * + * @param str Another line from the item. + */ +void StringFilter::AddLine(StringID str) +{ + char buffer[DRAW_STRING_BUFFER]; + GetString(buffer, str, lastof(buffer)); + AddLine(buffer); +} |