summaryrefslogtreecommitdiff
path: root/misc_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-01-12 11:21:28 +0000
committertruelight <truelight@openttd.org>2005-01-12 11:21:28 +0000
commita243285af4aa15923c5f2905a01a101603f72517 (patch)
tree23a6d3557feb58903656bb5447653052cda86af7 /misc_cmd.c
parentff23795f5be95d273c2168d71cbc25fa7fff1c3e (diff)
downloadopenttd-a243285af4aa15923c5f2905a01a101603f72517.tar.xz
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
dynamic arrays
Diffstat (limited to 'misc_cmd.c')
-rw-r--r--misc_cmd.c119
1 files changed, 0 insertions, 119 deletions
diff --git a/misc_cmd.c b/misc_cmd.c
index 714a22b5e..6d26c1d5c 100644
--- a/misc_cmd.c
+++ b/misc_cmd.c
@@ -172,89 +172,6 @@ int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
-static void UpdateSignVirtCoords(SignStruct *ss)
-{
- Point pt = RemapCoords(ss->x, ss->y, ss->z);
- SetDParam(0, ss->str);
- UpdateViewportSignPos(&ss->sign, pt.x, pt.y - 6, STR_2806);
-}
-
-void UpdateAllSignVirtCoords()
-{
- SignStruct *ss;
- for(ss=_sign_list; ss != endof(_sign_list); ss++)
- if (ss->str != 0)
- UpdateSignVirtCoords(ss);
-
-}
-
-static void MarkSignDirty(SignStruct *ss)
-{
- MarkAllViewportsDirty(
- ss->sign.left-6,
- ss->sign.top-3,
- ss->sign.left+ss->sign.width_1*4+12,
- ss->sign.top + 45
- );
-}
-
-
-int32 CmdPlaceSign(int x, int y, uint32 flags, uint32 p1, uint32 p2)
-{
- SignStruct *ss;
-
- for(ss=_sign_list; ss != endof(_sign_list); ss++) {
- if (ss->str == 0) {
- if (flags & DC_EXEC) {
- ss->str = STR_280A_SIGN;
- ss->x = x;
- ss->y = y;
- ss->z = GetSlopeZ(x,y);
- UpdateSignVirtCoords(ss);
- MarkSignDirty(ss);
- _new_sign_struct = ss;
- }
- return 0;
- }
- }
-
- return_cmd_error(STR_2808_TOO_MANY_SIGNS);
-}
-
-// p1 = sign index
-// p2: 1 -> remove sign
-int32 CmdRenameSign(int x, int y, uint32 flags, uint32 p1, uint32 p2)
-{
- StringID str,old_str;
- SignStruct *ss;
-
- if (_decode_parameters[0] != 0 && !p2) {
- str = AllocateNameUnique((byte*)_decode_parameters, 0);
- if (str == 0)
- return CMD_ERROR;
-
- if (flags & DC_EXEC) {
- ss = &_sign_list[p1];
- MarkSignDirty(ss);
- DeleteName(ss->str);
- ss->str = str;
- UpdateSignVirtCoords(ss);
- MarkSignDirty(ss);
- } else {
- DeleteName(str);
- }
- } else {
- if (flags & DC_EXEC) {
- ss = &_sign_list[p1];
- old_str = ss->str;
- ss->str = 0;
- DeleteName(old_str);
- MarkSignDirty(ss);
- }
- }
- return 0;
-}
-
// p1 = 0 decrease pause counter
// p1 = 1 increase pause counter
int32 CmdPause(int x, int y, uint32 flags, uint32 p1, uint32 p2)
@@ -318,39 +235,3 @@ int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
return 0;
}
-
-static const byte _sign_desc[] = {
- SLE_VAR(SignStruct,str, SLE_UINT16),
- SLE_CONDVAR(SignStruct,x, SLE_FILE_I16 | SLE_VAR_I32, 0, 4),
- SLE_CONDVAR(SignStruct,y, SLE_FILE_I16 | SLE_VAR_I32, 0, 4),
- SLE_CONDVAR(SignStruct,x, SLE_INT32, 5, 255),
- SLE_CONDVAR(SignStruct,y, SLE_INT32, 5, 255),
- SLE_VAR(SignStruct,z, SLE_UINT8),
- SLE_END()
-};
-
-static void Save_SIGN()
-{
- SignStruct *s;
- int i;
- for(i=0,s=_sign_list; i!=lengthof(_sign_list); i++,s++) {
- if (s->str != 0) {
- SlSetArrayIndex(i);
- SlObject(s, _sign_desc);
- }
- }
-}
-
-static void Load_SIGN()
-{
- int index;
- while ((index = SlIterateArray()) != -1) {
- SlObject(&_sign_list[index], _sign_desc);
- }
-}
-
-const ChunkHandler _sign_chunk_handlers[] = {
- { 'SIGN', Save_SIGN, Load_SIGN, CH_ARRAY | CH_LAST},
-};
-
-