ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/lowlevel.C
(Generate patch)

Comparing deliantra/server/socket/lowlevel.C (file contents):
Revision 1.74 by root, Wed Nov 11 04:45:23 2009 UTC vs.
Revision 1.78 by root, Fri Apr 30 20:43:18 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * 5 *
6 * Deliantra is free software: you can redistribute it and/or modify it under 6 * Deliantra is free software: you can redistribute it and/or modify it under
7 * the terms of the Affero GNU General Public License as published by the 7 * the terms of the Affero GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your 8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version. 9 * option) any later version.
157 157
158// SocketCommand, PlayingCommand, should not exist with those ugly casts 158// SocketCommand, PlayingCommand, should not exist with those ugly casts
159#define SC(cb) (void *)static_cast<void (*)(char *, int, client *)>(cb), 159#define SC(cb) (void *)static_cast<void (*)(char *, int, client *)>(cb),
160#define PC(cb) (void *)static_cast<void (*)(char *, int, player *)>(cb), PF_PLAYER | 160#define PC(cb) (void *)static_cast<void (*)(char *, int, player *)>(cb), PF_PLAYER |
161 161
162static void
163NopCmd (char *, int, client *)
164{
165 // do nothing
166}
167
162/** 168/**
163 * Dispatch table for the server. 169 * Dispatch table for the server.
164 */ 170 */
165static struct packet_type packets[] = { 171static struct packet_type packets[] = {
166 {"ncom", PC(NewPlayerCmd) PF_PLAYING | PF_COMMAND6 }, 172 {"ncom", PC(NewPlayerCmd) PF_PLAYING | PF_COMMAND6 },
171 {"apply", PC(ApplyCmd) PF_PLAYING }, 177 {"apply", PC(ApplyCmd) PF_PLAYING },
172 {"lookat", PC(LookAt) PF_PLAYING }, 178 {"lookat", PC(LookAt) PF_PLAYING },
173 {"lock", PC(LockItem) PF_PLAYING }, 179 {"lock", PC(LockItem) PF_PLAYING },
174 {"mark", PC(MarkItem) PF_PLAYING }, 180 {"mark", PC(MarkItem) PF_PLAYING },
175 {"move", PC(MoveCmd) PF_PLAYING }, 181 {"move", PC(MoveCmd) PF_PLAYING },
176 {"ext", PC(ExtCmd) 0 }, // CF+ 182 {"ext", PC(ExtCmd) 0 }, // CF+/Deliantra
177 {"mapredraw", PC(MapRedrawCmd) 0 }, 183 {"mapredraw", PC(MapRedrawCmd) 0 },
178 {"mapinfo", PC(MapInfoCmd) 0 }, // CF+ 184 {"mapinfo", PC(MapInfoCmd) 0 }, // CF+/Deliantra
179 185
180 {"reply", SC(ReplyCmd) 0 }, 186 {"reply", SC(ReplyCmd) 0 },
181 {"exti", SC(ExtiCmd) 0 }, // CF+ 187 {"exti", SC(ExtiCmd) 0 }, // CF+/Deliantra
182 {"addme", SC(AddMeCmd) 0 }, 188 {"addme", SC(AddMeCmd) 0 },
183 {"askface", SC(AskFaceCmd) 0 }, 189 {"askface", SC(AskFaceCmd) 0 },
184 {"requestinfo", SC(RequestInfo) 0 }, 190 {"requestinfo", SC(RequestInfo) 0 },
185 {"setsound", SC(SetSound) 0 }, 191 {"setsound", SC(SetSound) 0 },
186 {"setup", SC(SetUp) 0 }, 192 {"setup", SC(SetUp) 0 },
187 {"version", SC(VersionCmd) 0 }, 193 {"version", SC(VersionCmd) 0 },
188 {"toggleextendedtext", SC(ToggleExtendedText) 0 }, /*Added: tchize */ 194
195 {"toggleextendedtext", SC(NopCmd) 0 }, // deliantra: disabled
189}; 196};
190 197
191bool 198bool
192client::may_execute (const packet_type *pkt) const 199client::may_execute (const packet_type *pkt) const
193{ 200{
279 { 286 {
280 data = (char *)inbuf + 2; // better read garbage than segfault 287 data = (char *)inbuf + 2; // better read garbage than segfault
281 datalen = 0; 288 datalen = 0;
282 } 289 }
283 290
284 for (packet_type *pkt = packets; pkt < packets + (sizeof (packets) / sizeof (packets[0])); ++pkt) 291 for (packet_type *pkt = packets; pkt < packets + array_length (packets); ++pkt)
285 if (!strcmp ((char *)inbuf + 2, pkt->name)) 292 if (!strcmp ((char *)inbuf + 2, pkt->name))
286 { 293 {
287 if (pkt->flags & PF_PLAYER && !always_immediate (this, pkt, data, datalen)) 294 if (pkt->flags & PF_PLAYER && !always_immediate (this, pkt, data, datalen))
288 queue_command (pkt, data, datalen); 295 queue_command (pkt, data, datalen);
289 else 296 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines