(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.
This commit is contained in:
ludde
2005-07-14 09:43:59 +00:00
parent 1a046ff4c6
commit 3e62457107
9 changed files with 68 additions and 78 deletions

View File

@@ -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))