1 | /* |
1 | /* |
2 | * static char *rcsid_init_c = |
2 | * static char *rcsid_init_c = |
3 | * "$Id: request.c,v 1.1.1.2 2006/02/22 18:03:29 elmex Exp $"; |
3 | * "$Id: request.c,v 1.4 2006/04/16 04:36:34 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
104 | -1, /* Internal */ |
104 | -1, /* Internal */ |
105 | -1, /* life stealing */ |
105 | -1, /* life stealing */ |
106 | -1 /* Disease - not fully done yet */ |
106 | -1 /* Disease - not fully done yet */ |
107 | }; |
107 | }; |
108 | |
108 | |
|
|
109 | /** check for map change and send new map data */ |
|
|
110 | static void |
|
|
111 | check_map_change (player *pl) |
|
|
112 | { |
|
|
113 | char buf[MAX_BUF]; /* eauugggh */ |
|
|
114 | |
|
|
115 | object *ob = pl->ob; |
|
|
116 | |
|
|
117 | if (!pl->socket.mapinfocmd) |
|
|
118 | return; |
|
|
119 | |
|
|
120 | if (pl->socket.current_map != ob->map) |
|
|
121 | { |
|
|
122 | pl->socket.current_map = ob->map; |
|
|
123 | |
|
|
124 | if (ob->map && ob->map->path [0]) |
|
|
125 | { |
|
|
126 | int flags = 0; |
|
|
127 | |
|
|
128 | if (ob->map->tile_map [0]) flags |= 1; |
|
|
129 | if (ob->map->tile_map [1]) flags |= 2; |
|
|
130 | if (ob->map->tile_map [2]) flags |= 4; |
|
|
131 | if (ob->map->tile_map [3]) flags |= 8; |
|
|
132 | |
|
|
133 | snprintf (buf, MAX_BUF, "mapinfo current %d %d %d %d %d %s", |
|
|
134 | flags, ob->x - pl->socket.mapx / 2, ob->y - pl->socket.mapy / 2, |
|
|
135 | ob->map->width, ob->map->height, ob->map->path); |
|
|
136 | } |
|
|
137 | else |
|
|
138 | snprintf (buf, MAX_BUF, "mapinfo current"); |
|
|
139 | |
|
|
140 | Write_String_To_Socket (&pl->socket, buf, strlen (buf)); |
|
|
141 | } |
|
|
142 | } |
|
|
143 | |
109 | /** This is the Setup cmd - easy first implementation */ |
144 | /** This is the Setup cmd - easy first implementation */ |
110 | void SetUp(char *buf, int len, NewSocket *ns) |
145 | void SetUp(char *buf, int len, NewSocket *ns) |
111 | { |
146 | { |
112 | int s; |
147 | int s, slen; |
113 | char *cmd, *param, cmdback[HUGE_BUF]; |
148 | char *cmd, *param, cmdback[HUGE_BUF]; |
114 | |
149 | |
115 | /* run through the cmds of setup |
150 | /* run through the cmds of setup |
116 | * syntax is setup <cmdname1> <parameter> <cmdname2> <parameter> ... |
151 | * syntax is setup <cmdname1> <parameter> <cmdname2> <parameter> ... |
117 | * |
152 | * |
… | |
… | |
137 | |
172 | |
138 | for(;buf[s] && buf[s] != ' ';s++) ; |
173 | for(;buf[s] && buf[s] != ' ';s++) ; |
139 | buf[s++]=0; |
174 | buf[s++]=0; |
140 | while (buf[s] == ' ') s++; |
175 | while (buf[s] == ' ') s++; |
141 | |
176 | |
142 | strcat(cmdback, " "); |
177 | slen = strlen(cmdback); |
143 | strcat(cmdback, cmd); |
178 | safe_strcat(cmdback, " ", &slen, HUGE_BUF); |
144 | strcat(cmdback, " "); |
179 | safe_strcat(cmdback, cmd, &slen, HUGE_BUF); |
145 | |
180 | safe_strcat(cmdback, " ", &slen, HUGE_BUF); |
146 | |
181 | |
147 | if (!strcmp(cmd,"sound")) { |
182 | if (!strcmp(cmd,"sound")) { |
148 | ns->sound = atoi(param); |
183 | ns->sound = atoi(param); |
149 | strcat(cmdback, param); |
184 | safe_strcat(cmdback, param, &slen, HUGE_BUF); |
150 | } |
185 | } |
151 | else if (!strcmp(cmd,"exp64")) { |
186 | else if (!strcmp(cmd,"exp64")) { |
152 | ns->exp64 = atoi(param); |
187 | ns->exp64 = atoi(param); |
153 | strcat(cmdback, param); |
188 | safe_strcat(cmdback, param, &slen, HUGE_BUF); |
154 | } else if (!strcmp(cmd, "spellmon")) { |
189 | } else if (!strcmp(cmd, "spellmon")) { |
155 | ns->monitor_spells = atoi(param); |
190 | ns->monitor_spells = atoi(param); |
156 | strcat(cmdback, param); |
191 | safe_strcat(cmdback, param, &slen, HUGE_BUF); |
157 | } else if (!strcmp(cmd,"darkness")) { |
192 | } else if (!strcmp(cmd,"darkness")) { |
158 | ns->darkness = atoi(param); |
193 | ns->darkness = atoi(param); |
159 | strcat(cmdback, param); |
194 | safe_strcat(cmdback, param, &slen, HUGE_BUF); |
160 | } else if (!strcmp(cmd,"map1cmd")) { |
195 | } else if (!strcmp(cmd,"map1cmd")) { |
161 | if (atoi(param)) ns->mapmode = Map1Cmd; |
196 | if (atoi(param)) ns->mapmode = Map1Cmd; |
162 | /* if beyond this size, need to use map1cmd no matter what */ |
197 | /* if beyond this size, need to use map1cmd no matter what */ |
163 | if (ns->mapx>11 || ns->mapy>11) ns->mapmode = Map1Cmd; |
198 | if (ns->mapx>11 || ns->mapy>11) ns->mapmode = Map1Cmd; |
164 | strcat(cmdback, ns->mapmode == Map1Cmd?"1":"0"); |
199 | safe_strcat(cmdback, ns->mapmode == Map1Cmd?"1":"0", &slen, HUGE_BUF); |
165 | } else if (!strcmp(cmd,"map1acmd")) { |
200 | } else if (!strcmp(cmd,"map1acmd")) { |
166 | if (atoi(param)) ns->mapmode = Map1aCmd; |
201 | if (atoi(param)) ns->mapmode = Map1aCmd; |
167 | /* if beyond this size, need to use map1acmd no matter what */ |
202 | /* if beyond this size, need to use map1acmd no matter what */ |
168 | if (ns->mapx>11 || ns->mapy>11) ns->mapmode = Map1aCmd; |
203 | if (ns->mapx>11 || ns->mapy>11) ns->mapmode = Map1aCmd; |
169 | strcat(cmdback, ns->mapmode == Map1aCmd?"1":"0"); |
204 | safe_strcat(cmdback, ns->mapmode == Map1aCmd?"1":"0", &slen, HUGE_BUF); |
170 | } else if (!strcmp(cmd,"newmapcmd")) { |
205 | } else if (!strcmp(cmd,"newmapcmd")) { |
171 | ns->newmapcmd= atoi(param); |
206 | ns->newmapcmd= atoi(param); |
172 | strcat(cmdback, param); |
207 | safe_strcat(cmdback, param, &slen, HUGE_BUF); |
|
|
208 | // } else if (!strcmp(cmd,"plugincmd")) { |
|
|
209 | // ns->plugincmd = atoi(param); |
|
|
210 | // safe_strcat(cmdback, param, &slen, HUGE_BUF); |
|
|
211 | } else if (!strcmp(cmd,"mapinfocmd")) { |
|
|
212 | ns->mapinfocmd = atoi(param); |
|
|
213 | safe_strcat(cmdback, param, &slen, HUGE_BUF); |
173 | } else if (!strcmp(cmd,"facecache")) { |
214 | } else if (!strcmp(cmd,"facecache")) { |
174 | ns->facecache = atoi(param); |
215 | ns->facecache = atoi(param); |
175 | strcat(cmdback, param); |
216 | safe_strcat(cmdback, param, &slen, HUGE_BUF); |
176 | } else if (!strcmp(cmd,"faceset")) { |
217 | } else if (!strcmp(cmd,"faceset")) { |
177 | char tmpbuf[20]; |
218 | char tmpbuf[20]; |
178 | int q = atoi(param); |
219 | int q = atoi(param); |
179 | |
220 | |
180 | if (is_valid_faceset(q)) |
221 | if (is_valid_faceset(q)) |
181 | ns->faceset=q; |
222 | ns->faceset=q; |
182 | sprintf(tmpbuf,"%d", ns->faceset); |
223 | sprintf(tmpbuf,"%d", ns->faceset); |
183 | strcat(cmdback, tmpbuf); |
224 | safe_strcat(cmdback, tmpbuf, &slen, HUGE_BUF); |
184 | /* if the client is using faceset, it knows about image2 command */ |
225 | /* if the client is using faceset, it knows about image2 command */ |
185 | ns->image2=1; |
226 | ns->image2=1; |
186 | } else if (!strcmp(cmd,"itemcmd")) { |
227 | } else if (!strcmp(cmd,"itemcmd")) { |
187 | /* Version of the item protocol command to use. Currently, |
228 | /* Version of the item protocol command to use. Currently, |
188 | * only supported versions are 1 and 2. Using a numeric |
229 | * only supported versions are 1 and 2. Using a numeric |
… | |
… | |
194 | strcpy(tmpbuf,"FALSE"); |
235 | strcpy(tmpbuf,"FALSE"); |
195 | } else { |
236 | } else { |
196 | ns->itemcmd = q; |
237 | ns->itemcmd = q; |
197 | sprintf(tmpbuf,"%d", ns->itemcmd); |
238 | sprintf(tmpbuf,"%d", ns->itemcmd); |
198 | } |
239 | } |
199 | strcat(cmdback, tmpbuf); |
240 | safe_strcat(cmdback, tmpbuf, &slen, HUGE_BUF); |
200 | } else if (!strcmp(cmd,"mapsize")) { |
241 | } else if (!strcmp(cmd,"mapsize")) { |
201 | int x, y=0; |
242 | int x, y=0; |
202 | char tmpbuf[MAX_BUF], *cp; |
243 | char tmpbuf[MAX_BUF], *cp; |
203 | |
244 | |
204 | x = atoi(param); |
245 | x = atoi(param); |
… | |
… | |
207 | y = atoi(cp+1); |
248 | y = atoi(cp+1); |
208 | break; |
249 | break; |
209 | } |
250 | } |
210 | if (x < 9 || y < 9 || x>MAP_CLIENT_X || y > MAP_CLIENT_Y) { |
251 | if (x < 9 || y < 9 || x>MAP_CLIENT_X || y > MAP_CLIENT_Y) { |
211 | sprintf(tmpbuf," %dx%d", MAP_CLIENT_X, MAP_CLIENT_Y); |
252 | sprintf(tmpbuf," %dx%d", MAP_CLIENT_X, MAP_CLIENT_Y); |
212 | strcat(cmdback, tmpbuf); |
253 | safe_strcat(cmdback, tmpbuf, &slen, HUGE_BUF); |
213 | } else { |
254 | } else { |
214 | ns->mapx = x; |
255 | ns->mapx = x; |
215 | ns->mapy = y; |
256 | ns->mapy = y; |
216 | /* better to send back what we are really using and not the |
257 | /* better to send back what we are really using and not the |
217 | * param as given to us in case it gets parsed differently. |
258 | * param as given to us in case it gets parsed differently. |
218 | */ |
259 | */ |
219 | sprintf(tmpbuf,"%dx%d", x,y); |
260 | sprintf(tmpbuf,"%dx%d", x,y); |
220 | strcat(cmdback, tmpbuf); |
261 | safe_strcat(cmdback, tmpbuf, &slen, HUGE_BUF); |
221 | /* If beyond this size and still using orig map command, need to |
262 | /* If beyond this size and still using orig map command, need to |
222 | * go to map1cmd. |
263 | * go to map1cmd. |
223 | */ |
264 | */ |
224 | if ((x>11 || y>11) && ns->mapmode == Map0Cmd) ns->mapmode = Map1Cmd; |
265 | if ((x>11 || y>11) && ns->mapmode == Map0Cmd) ns->mapmode = Map1Cmd; |
225 | } |
266 | } |
226 | } else if (!strcmp(cmd,"extendedMapInfos")) { |
267 | } else if (!strcmp(cmd,"extendedMapInfos")) { |
227 | /* Added by tchize |
268 | /* Added by tchize |
228 | * prepare to use the mapextended command |
269 | * prepare to use the mapextended command |
229 | */ |
270 | */ |
230 | char tmpbuf[20]; |
271 | char tmpbuf[20]; |
231 | ns->ext_mapinfos = (atoi(param)); |
272 | ns->ext_mapinfos = (atoi(param)); |
232 | sprintf(tmpbuf,"%d", ns->ext_mapinfos); |
273 | sprintf(tmpbuf,"%d", ns->ext_mapinfos); |
233 | strcat(cmdback, tmpbuf); |
274 | safe_strcat(cmdback, tmpbuf, &slen, HUGE_BUF); |
234 | } else if (!strcmp(cmd,"extendedTextInfos")) { |
275 | } else if (!strcmp(cmd,"extendedTextInfos")) { |
235 | /* Added by tchize |
276 | /* Added by tchize |
236 | * prepare to use the extended text commands |
277 | * prepare to use the extended text commands |
237 | * Client toggle this to non zero to get exttext |
278 | * Client toggle this to non zero to get exttext |
238 | */ |
279 | */ |
239 | char tmpbuf[20]; |
280 | char tmpbuf[20]; |
|
|
281 | |
240 | ns->has_readable_type = (atoi(param)); |
282 | ns->has_readable_type = (atoi(param)); |
241 | sprintf(tmpbuf,"%d", ns->has_readable_type); |
283 | sprintf(tmpbuf,"%d", ns->has_readable_type); |
242 | strcat(cmdback, tmpbuf); |
284 | safe_strcat(cmdback, tmpbuf, &slen, HUGE_BUF); |
243 | } else { |
285 | } else { |
244 | /* Didn't get a setup command we understood - |
286 | /* Didn't get a setup command we understood - |
245 | * report a failure to the client. |
287 | * report a failure to the client. |
246 | */ |
288 | */ |
247 | strcat(cmdback, "FALSE"); |
289 | safe_strcat(cmdback, "FALSE", &slen, HUGE_BUF); |
248 | } |
290 | } |
249 | } /* for processing all the setup commands */ |
291 | } /* for processing all the setup commands */ |
250 | LOG(llevInfo,"SendBack SetupCmd:: %s\n", cmdback); |
292 | LOG(llevInfo,"SendBack SetupCmd:: %s\n", cmdback); |
251 | Write_String_To_Socket(ns, cmdback, strlen(cmdback)); |
293 | Write_String_To_Socket(ns, cmdback, strlen(cmdback)); |
252 | } |
294 | } |
… | |
… | |
617 | LOG(llevDebug, "CS: scversion mismatch (%d,%d)\n",VERSION_SC,ns->sc_version); |
659 | LOG(llevDebug, "CS: scversion mismatch (%d,%d)\n",VERSION_SC,ns->sc_version); |
618 | #endif |
660 | #endif |
619 | } |
661 | } |
620 | cp = strchr(cp+1, ' '); |
662 | cp = strchr(cp+1, ' '); |
621 | if (cp) { |
663 | if (cp) { |
622 | LOG(llevDebug,"CS: connection from client of type <%s>\n", cp); |
664 | LOG(llevDebug,"CS: connection from client of type <%s>, ip %s\n", cp, ns->host); |
623 | |
665 | |
624 | /* This is first implementation - i skip all beta DX clients with it |
666 | /* This is first implementation - i skip all beta DX clients with it |
625 | * Add later stuff here for other clients |
667 | * Add later stuff here for other clients |
626 | */ |
668 | */ |
627 | |
669 | |
… | |
… | |
1723 | if (sl.len>startlen || pl->contr->socket.sent_scroll) { |
1765 | if (sl.len>startlen || pl->contr->socket.sent_scroll) { |
1724 | Send_With_Handling(&pl->contr->socket, &sl); |
1766 | Send_With_Handling(&pl->contr->socket, &sl); |
1725 | pl->contr->socket.sent_scroll = 0; |
1767 | pl->contr->socket.sent_scroll = 0; |
1726 | } |
1768 | } |
1727 | free(sl.buf); |
1769 | free(sl.buf); |
|
|
1770 | |
|
|
1771 | check_map_change (pl->contr); |
1728 | } |
1772 | } |
1729 | |
1773 | |
1730 | /** |
1774 | /** |
1731 | * Draws client map. |
1775 | * Draws client map. |
1732 | */ |
1776 | */ |
… | |
… | |
1845 | } |
1889 | } |
1846 | } /* Is a valid space */ |
1890 | } /* Is a valid space */ |
1847 | } |
1891 | } |
1848 | } |
1892 | } |
1849 | esrv_map_doneredraw(&pl->contr->socket, &newmap); |
1893 | esrv_map_doneredraw(&pl->contr->socket, &newmap); |
|
|
1894 | |
|
|
1895 | check_map_change (pl->contr); |
1850 | } |
1896 | } |
1851 | |
1897 | |
1852 | |
1898 | |
1853 | void esrv_map_scroll(NewSocket *ns,int dx,int dy) |
1899 | void esrv_map_scroll(NewSocket *ns,int dx,int dy) |
1854 | { |
1900 | { |
… | |
… | |
1923 | { |
1969 | { |
1924 | SockList sl; |
1970 | SockList sl; |
1925 | int i; |
1971 | int i; |
1926 | |
1972 | |
1927 | sl.buf = malloc(MAXSOCKBUF); |
1973 | sl.buf = malloc(MAXSOCKBUF); |
1928 | strcpy(sl.buf,"replyinfo skill_info\n"); |
1974 | strcpy((char*)sl.buf,"replyinfo skill_info\n"); |
1929 | for (i=1; i< NUM_SKILLS; i++) { |
1975 | for (i=1; i< NUM_SKILLS; i++) { |
1930 | sprintf(sl.buf + strlen(sl.buf), "%d:%s\n", i + CS_STAT_SKILLINFO, |
1976 | sprintf((char*)sl.buf + strlen((char*)sl.buf), "%d:%s\n", i + CS_STAT_SKILLINFO, |
1931 | skill_names[i]); |
1977 | skill_names[i]); |
1932 | } |
1978 | } |
1933 | sl.len = strlen(sl.buf); |
1979 | sl.len = strlen((char*)sl.buf); |
1934 | if (sl.len > MAXSOCKBUF) { |
1980 | if (sl.len > MAXSOCKBUF) { |
1935 | LOG(llevError,"Buffer overflow in send_skill_info!\n"); |
1981 | LOG(llevError,"Buffer overflow in send_skill_info!\n"); |
1936 | fatal(0); |
1982 | fatal(0); |
1937 | } |
1983 | } |
1938 | Send_With_Handling(ns, &sl); |
1984 | Send_With_Handling(ns, &sl); |
… | |
… | |
1946 | void send_spell_paths (NewSocket *ns, char *params) { |
1992 | void send_spell_paths (NewSocket *ns, char *params) { |
1947 | SockList sl; |
1993 | SockList sl; |
1948 | int i; |
1994 | int i; |
1949 | |
1995 | |
1950 | sl.buf = malloc(MAXSOCKBUF); |
1996 | sl.buf = malloc(MAXSOCKBUF); |
1951 | strcpy(sl.buf,"replyinfo spell_paths\n"); |
1997 | strcpy((char*)sl.buf,"replyinfo spell_paths\n"); |
1952 | for(i=0; i<NRSPELLPATHS; i++) |
1998 | for(i=0; i<NRSPELLPATHS; i++) |
1953 | sprintf(sl.buf + strlen(sl.buf), "%d:%s\n", 1<<i, spellpathnames[i]); |
1999 | sprintf((char*)sl.buf + strlen((char*)sl.buf), "%d:%s\n", 1<<i, spellpathnames[i]); |
1954 | sl.len = strlen(sl.buf); |
2000 | sl.len = strlen((char*)sl.buf); |
1955 | if (sl.len > MAXSOCKBUF) { |
2001 | if (sl.len > MAXSOCKBUF) { |
1956 | LOG(llevError,"Buffer overflow in send_spell_paths!\n"); |
2002 | LOG(llevError,"Buffer overflow in send_spell_paths!\n"); |
1957 | fatal(0); |
2003 | fatal(0); |
1958 | } |
2004 | } |
1959 | Send_With_Handling(ns, &sl); |
2005 | Send_With_Handling(ns, &sl); |
… | |
… | |
1984 | spell->last_eat = spell->stats.dam+SP_level_dam_adjust(pl->ob, spell); |
2030 | spell->last_eat = spell->stats.dam+SP_level_dam_adjust(pl->ob, spell); |
1985 | flags |= UPD_SP_DAMAGE; |
2031 | flags |= UPD_SP_DAMAGE; |
1986 | } |
2032 | } |
1987 | if (flags !=0) { |
2033 | if (flags !=0) { |
1988 | sl.buf = malloc(MAXSOCKBUF); |
2034 | sl.buf = malloc(MAXSOCKBUF); |
1989 | strcpy(sl.buf,"updspell "); |
2035 | strcpy((char*)sl.buf,"updspell "); |
1990 | sl.len=strlen((char*)sl.buf); |
2036 | sl.len=strlen((char*)sl.buf); |
1991 | SockList_AddChar(&sl, flags); |
2037 | SockList_AddChar(&sl, flags); |
1992 | SockList_AddInt(&sl, spell->count); |
2038 | SockList_AddInt(&sl, spell->count); |
1993 | if (flags & UPD_SP_MANA) SockList_AddShort(&sl, spell->last_sp); |
2039 | if (flags & UPD_SP_MANA) SockList_AddShort(&sl, spell->last_sp); |
1994 | if (flags & UPD_SP_GRACE) SockList_AddShort(&sl, spell->last_grace); |
2040 | if (flags & UPD_SP_GRACE) SockList_AddShort(&sl, spell->last_grace); |
… | |
… | |
2008 | if (!pl || !spell || spell->env != pl->ob) { |
2054 | if (!pl || !spell || spell->env != pl->ob) { |
2009 | LOG(llevError, "Invalid call to esrv_remove_spell"); |
2055 | LOG(llevError, "Invalid call to esrv_remove_spell"); |
2010 | return; |
2056 | return; |
2011 | } |
2057 | } |
2012 | sl.buf = malloc(MAXSOCKBUF); |
2058 | sl.buf = malloc(MAXSOCKBUF); |
2013 | strcpy(sl.buf,"delspell "); |
2059 | strcpy((char*)sl.buf,"delspell "); |
2014 | sl.len=strlen((char*)sl.buf); |
2060 | sl.len=strlen((char*)sl.buf); |
2015 | SockList_AddInt(&sl, spell->count); |
2061 | SockList_AddInt(&sl, spell->count); |
2016 | Send_With_Handling(&pl->socket, &sl); |
2062 | Send_With_Handling(&pl->socket, &sl); |
2017 | free(sl.buf); |
2063 | free(sl.buf); |
2018 | } |
2064 | } |
… | |
… | |
2076 | LOG(llevError, "esrv_add_spells, tried to add a spell to a NULL player"); |
2122 | LOG(llevError, "esrv_add_spells, tried to add a spell to a NULL player"); |
2077 | return; |
2123 | return; |
2078 | } |
2124 | } |
2079 | if (!pl->socket.monitor_spells) return; |
2125 | if (!pl->socket.monitor_spells) return; |
2080 | sl.buf = malloc(MAXSOCKBUF); |
2126 | sl.buf = malloc(MAXSOCKBUF); |
2081 | strcpy(sl.buf,"addspell "); |
2127 | strcpy((char*)sl.buf,"addspell "); |
2082 | sl.len=strlen((char*)sl.buf); |
2128 | sl.len=strlen((char*)sl.buf); |
2083 | if (!spell) { |
2129 | if (!spell) { |
2084 | for (spell=pl->ob->inv; spell!=NULL; spell=spell->below) { |
2130 | for (spell=pl->ob->inv; spell!=NULL; spell=spell->below) { |
2085 | /* were we to simply keep appending data here, we could exceed |
2131 | /* were we to simply keep appending data here, we could exceed |
2086 | * MAXSOCKBUF if the player has enough spells to add, we know that |
2132 | * MAXSOCKBUF if the player has enough spells to add, we know that |
… | |
… | |
2097 | */ |
2143 | */ |
2098 | if (spell->type != SPELL) continue; |
2144 | if (spell->type != SPELL) continue; |
2099 | if (sl.len > (MAXSOCKBUF - (26 + strlen(spell->name) + |
2145 | if (sl.len > (MAXSOCKBUF - (26 + strlen(spell->name) + |
2100 | (spell->msg?strlen(spell->msg):0)))) { |
2146 | (spell->msg?strlen(spell->msg):0)))) { |
2101 | Send_With_Handling(&pl->socket, &sl); |
2147 | Send_With_Handling(&pl->socket, &sl); |
2102 | strcpy(sl.buf,"addspell "); |
2148 | strcpy((char*)sl.buf,"addspell "); |
2103 | sl.len=strlen((char*)sl.buf); |
2149 | sl.len=strlen((char*)sl.buf); |
2104 | } |
2150 | } |
2105 | append_spell(pl, &sl, spell); |
2151 | append_spell(pl, &sl, spell); |
2106 | } |
2152 | } |
2107 | } |
2153 | } |