summaryrefslogtreecommitdiff
path: root/src/strings_func.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-01-12 17:59:43 +0000
committerfrosch <frosch@openttd.org>2014-01-12 17:59:43 +0000
commit5ab39cc65176bc150625995a6a639625a7b1f579 (patch)
treed6cafd199e6c10aa6e3f75dd610c00d6f2173be3 /src/strings_func.h
parentbc86bf9b12ba513e33aeab8a5ff7203009ba2d87 (diff)
downloadopenttd-5ab39cc65176bc150625995a6a639625a7b1f579.tar.xz
(svn r26238) -Codechange: Use StringParameters::GetDataLeft to check for left space in the param array.
Diffstat (limited to 'src/strings_func.h')
-rw-r--r--src/strings_func.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/strings_func.h b/src/strings_func.h
index 67a26a1b8..2c7809d02 100644
--- a/src/strings_func.h
+++ b/src/strings_func.h
@@ -56,7 +56,7 @@ public:
offset(0),
num_param(size)
{
- assert(size <= parent.num_param - parent.offset);
+ assert(size <= parent.GetDataLeft());
if (parent.type == NULL) {
this->type = NULL;
} else {
@@ -89,6 +89,12 @@ public:
return &this->data[this->offset];
}
+ /** Return the amount of elements which can still be read. */
+ uint GetDataLeft() const
+ {
+ return this->num_param - this->offset;
+ }
+
/** Get a pointer to a specific element in the data array. */
uint64 *GetPointerToOffset(uint offset) const
{