summaryrefslogtreecommitdiff
path: root/variables.h
diff options
context:
space:
mode:
authorludde <ludde@openttd.org>2005-07-14 09:43:59 +0000
committerludde <ludde@openttd.org>2005-07-14 09:43:59 +0000
commit3e62457107457c8295076370425e9a1df44fa58c (patch)
treef6981bd89e076320ae37ab99f9dbf0619bca554c /variables.h
parent1a046ff4c6f0295328ccc0cd6a4cd7a491f7ddbf (diff)
downloadopenttd-3e62457107457c8295076370425e9a1df44fa58c.tar.xz
(svn r2564) Fix: Fixed conceptual issue in network_gui.c. AllocateName is not meant to be used by GUI-code, because it modifies the "game-state".
Added a way to bind a C-string to an openttd string which doesn't modify the game state.
Diffstat (limited to 'variables.h')
-rw-r--r--variables.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/variables.h b/variables.h
index 3514ad54f..985390095 100644
--- a/variables.h
+++ b/variables.h
@@ -424,6 +424,16 @@ static inline uint32 GetDParam(uint n)
return _decode_parameters[n];
}
+// Used to bind a C string name to a dparam number.
+// NOTE: This has a short lifetime. You can't
+// use this string much later or it will be gone.
+void SetDParamStr(uint n, const char *str);
+
+// This function takes a C-string and allocates a temporary string ID.
+// The duration of the bound string is valid only until the next acll to GetString,
+// so be careful.
+StringID BindCString(const char *str);
+
#define COPY_IN_DPARAM(offs,src,num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num))
#define COPY_OUT_DPARAM(dst,offs,num) memcpy(dst,_decode_parameters + offs, sizeof(uint32) * (num))