… | |
… | |
27 | #include <sounds.h> |
27 | #include <sounds.h> |
28 | #include <living.h> |
28 | #include <living.h> |
29 | #include <object.h> |
29 | #include <object.h> |
30 | #include <spells.h> |
30 | #include <spells.h> |
31 | #include <skills.h> |
31 | #include <skills.h> |
32 | #include <newclient.h> |
|
|
33 | |
32 | |
34 | #ifdef COZY_SERVER |
33 | #ifdef COZY_SERVER |
35 | extern int same_party (partylist *a, partylist *b); |
34 | extern int same_party (partylist *a, partylist *b); |
36 | #endif |
35 | #endif |
37 | |
36 | |
… | |
… | |
83 | int comp; |
82 | int comp; |
84 | int size; |
83 | int size; |
85 | |
84 | |
86 | sprintf (buf, "%s/%s", settings.confdir, settings.motd); |
85 | sprintf (buf, "%s/%s", settings.confdir, settings.motd); |
87 | if ((fp = open_and_uncompress (buf, 0, &comp)) == NULL) |
86 | if ((fp = open_and_uncompress (buf, 0, &comp)) == NULL) |
88 | { |
|
|
89 | return; |
87 | return; |
90 | } |
88 | |
91 | motd[0] = '\0'; |
89 | motd[0] = '\0'; |
92 | size = 0; |
90 | size = 0; |
|
|
91 | |
93 | while (fgets (buf, MAX_BUF, fp) != NULL) |
92 | while (fgets (buf, MAX_BUF, fp) != NULL) |
94 | { |
93 | { |
95 | if (*buf == '#') |
94 | if (*buf == '#') |
96 | continue; |
95 | continue; |
|
|
96 | |
97 | strncat (motd + size, buf, HUGE_BUF - size); |
97 | strncat (motd + size, buf, HUGE_BUF - size); |
98 | size += strlen (buf); |
98 | size += strlen (buf); |
99 | } |
99 | } |
|
|
100 | |
100 | draw_ext_info (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_MOTD, MSG_SUBTYPE_NONE, motd, NULL); |
101 | draw_ext_info (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_MOTD, MSG_SUBTYPE_NONE, motd, NULL); |
101 | close_and_delete (fp, comp); |
102 | close_and_delete (fp, comp); |
102 | } |
103 | } |
103 | |
104 | |
104 | void |
105 | void |
… | |
… | |
110 | int comp; |
111 | int comp; |
111 | int size; |
112 | int size; |
112 | |
113 | |
113 | sprintf (buf, "%s/%s", settings.confdir, settings.rules); |
114 | sprintf (buf, "%s/%s", settings.confdir, settings.rules); |
114 | if ((fp = open_and_uncompress (buf, 0, &comp)) == NULL) |
115 | if ((fp = open_and_uncompress (buf, 0, &comp)) == NULL) |
115 | { |
|
|
116 | return; |
116 | return; |
117 | } |
117 | |
118 | rules[0] = '\0'; |
118 | rules[0] = '\0'; |
119 | size = 0; |
119 | size = 0; |
|
|
120 | |
120 | while (fgets (buf, MAX_BUF, fp) != NULL) |
121 | while (fgets (buf, MAX_BUF, fp) != NULL) |
121 | { |
122 | { |
122 | if (*buf == '#') |
123 | if (*buf == '#') |
123 | continue; |
124 | continue; |
|
|
125 | |
124 | if (size + strlen (buf) >= HUGE_BUF) |
126 | if (size + strlen (buf) >= HUGE_BUF) |
125 | { |
127 | { |
126 | LOG (llevDebug, "Warning, rules size is > %d bytes.\n", HUGE_BUF); |
128 | LOG (llevDebug, "Warning, rules size is > %d bytes.\n", HUGE_BUF); |
127 | break; |
129 | break; |
128 | } |
130 | } |
|
|
131 | |
129 | strncat (rules + size, buf, HUGE_BUF - size); |
132 | strncat (rules + size, buf, HUGE_BUF - size); |
130 | size += strlen (buf); |
133 | size += strlen (buf); |
131 | } |
134 | } |
|
|
135 | |
132 | draw_ext_info (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_RULES, rules, NULL); |
136 | draw_ext_info (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_RULES, rules, NULL); |
133 | close_and_delete (fp, comp); |
137 | close_and_delete (fp, comp); |
134 | } |
138 | } |
135 | |
139 | |
136 | void |
140 | void |
… | |
… | |
144 | int size; |
148 | int size; |
145 | |
149 | |
146 | sprintf (buf, "%s/%s", settings.confdir, settings.news); |
150 | sprintf (buf, "%s/%s", settings.confdir, settings.news); |
147 | if ((fp = open_and_uncompress (buf, 0, &comp)) == NULL) |
151 | if ((fp = open_and_uncompress (buf, 0, &comp)) == NULL) |
148 | return; |
152 | return; |
|
|
153 | |
149 | news[0] = '\0'; |
154 | news[0] = '\0'; |
150 | subject[0] = '\0'; |
155 | subject[0] = '\0'; |
151 | size = 0; |
156 | size = 0; |
|
|
157 | |
152 | while (fgets (buf, MAX_BUF, fp) != NULL) |
158 | while (fgets (buf, MAX_BUF, fp) != NULL) |
153 | { |
159 | { |
154 | if (*buf == '#') |
160 | if (*buf == '#') |
155 | continue; |
161 | continue; |
|
|
162 | |
156 | if (*buf == '%') |
163 | if (*buf == '%') |
157 | { /* send one news */ |
164 | { /* send one news */ |
158 | if (size > 0) |
165 | if (size > 0) |
159 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", "%s\n%s", subject, news); /*send previously read news */ |
166 | draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", "%s\n%s", subject, news); /*send previously read news */ |
160 | strcpy (subject, buf + 1); |
167 | strcpy (subject, buf + 1); |
… | |
… | |
187 | return 0; |
194 | return 0; |
188 | |
195 | |
189 | for (; *cp != '\0'; cp++) |
196 | for (; *cp != '\0'; cp++) |
190 | if (!((*cp >= 'a' && *cp <= 'z') || (*cp >= 'A' && *cp <= 'Z')) && *cp != '-' && *cp != '_') |
197 | if (!((*cp >= 'a' && *cp <= 'z') || (*cp >= 'A' && *cp <= 'Z')) && *cp != '-' && *cp != '_') |
191 | return 0; |
198 | return 0; |
|
|
199 | |
192 | return 1; |
200 | return 1; |
193 | } |
201 | } |
194 | |
202 | |
195 | /* This no longer sets the player map. Also, it now updates |
203 | /* This no longer sets the player map. Also, it now updates |
196 | * all the pointers so the caller doesn't need to do that. |
204 | * all the pointers so the caller doesn't need to do that. |
… | |
… | |
234 | op->speed_left = 0.5; |
242 | op->speed_left = 0.5; |
235 | op->speed = 1.0; |
243 | op->speed = 1.0; |
236 | op->direction = 5; /* So player faces south */ |
244 | op->direction = 5; /* So player faces south */ |
237 | op->stats.wc = 2; |
245 | op->stats.wc = 2; |
238 | op->run_away = 25; /* Then we panick... */ |
246 | op->run_away = 25; /* Then we panick... */ |
|
|
247 | |
|
|
248 | { |
|
|
249 | int oldmon = p->socket->monitor_spells; // what a hack |
239 | p->socket->monitor_spells = 0; /* Needed because esrv_update_spells( ) gets called by roll_stats */ |
250 | p->socket->monitor_spells = 0; /* Needed because esrv_update_spells( ) gets called by roll_stats */ |
240 | |
|
|
241 | roll_stats (op); |
251 | roll_stats (op); |
|
|
252 | p->socket->monitor_spells = oldmon; |
|
|
253 | } |
242 | p->state = ST_ROLL_STAT; |
254 | p->state = ST_ROLL_STAT; |
243 | clear_los (op); |
255 | clear_los (op); |
244 | |
256 | |
245 | p->gen_sp_armour = 10; |
257 | p->gen_sp_armour = 10; |
246 | p->last_speed = -1; |
258 | p->last_speed = -1; |
… | |
… | |
251 | p->usekeys = containers; |
263 | p->usekeys = containers; |
252 | p->last_weapon_sp = -1; |
264 | p->last_weapon_sp = -1; |
253 | p->peaceful = 1; /* default peaceful */ |
265 | p->peaceful = 1; /* default peaceful */ |
254 | p->do_los = 1; |
266 | p->do_los = 1; |
255 | p->explore = 0; |
267 | p->explore = 0; |
256 | p->no_shout = 0; /* default can shout */ |
|
|
257 | |
268 | |
258 | assign (p->title, op->arch->clone.name); |
269 | assign (p->title, op->arch->clone.name); |
259 | op->race = op->arch->clone.race; |
270 | op->race = op->arch->clone.race; |
260 | |
271 | |
261 | CLEAR_FLAG (op, FLAG_READY_SKILL); |
272 | CLEAR_FLAG (op, FLAG_READY_SKILL); |
… | |
… | |
288 | set_first_map (object *op) |
299 | set_first_map (object *op) |
289 | { |
300 | { |
290 | strcpy (op->contr->maplevel, first_map_path); |
301 | strcpy (op->contr->maplevel, first_map_path); |
291 | op->x = -1; |
302 | op->x = -1; |
292 | op->y = -1; |
303 | op->y = -1; |
293 | enter_exit (op, NULL); |
304 | enter_exit (op, 0); |
294 | } |
305 | } |
295 | |
306 | |
296 | /* Tries to add player on the connection passwd in ns. |
307 | /* Tries to add player on the connection passwd in ns. |
297 | * All we can really get in this is some settings like host and display |
308 | * All we can really get in this is some settings like host and display |
298 | * mode. |
309 | * mode. |
299 | */ |
310 | */ |
300 | |
311 | |
301 | int |
312 | int |
302 | add_player (client_socket *ns) |
313 | add_player (client *ns) |
303 | { |
314 | { |
304 | player *p = new player; |
315 | player *p = new player; |
305 | |
316 | |
306 | p->socket = ns; |
317 | p->socket = ns; |
307 | ns->pl = p; |
318 | ns->pl = p; |
… | |
… | |
337 | { |
348 | { |
338 | if (at == NULL || at->next == NULL) |
349 | if (at == NULL || at->next == NULL) |
339 | at = first_archetype; |
350 | at = first_archetype; |
340 | else |
351 | else |
341 | at = at->next; |
352 | at = at->next; |
|
|
353 | |
342 | if (at->clone.type == PLAYER) |
354 | if (at->clone.type == PLAYER) |
343 | return at; |
355 | return at; |
|
|
356 | |
344 | if (at == start) |
357 | if (at == start) |
345 | { |
358 | { |
346 | LOG (llevError, "No Player archetypes\n"); |
359 | LOG (llevError, "No Player archetypes\n"); |
347 | exit (-1); |
360 | exit (-1); |
348 | } |
361 | } |
349 | } |
362 | } |
350 | } |
363 | } |
351 | |
|
|
352 | |
364 | |
353 | object * |
365 | object * |
354 | get_nearest_player (object *mon) |
366 | get_nearest_player (object *mon) |
355 | { |
367 | { |
356 | object *op = NULL; |
368 | object *op = NULL; |
… | |
… | |
1080 | * if the map isn't there, then stay on the |
1092 | * if the map isn't there, then stay on the |
1081 | * default initial map */ |
1093 | * default initial map */ |
1082 | tmp->destroy (); |
1094 | tmp->destroy (); |
1083 | } |
1095 | } |
1084 | else |
1096 | else |
1085 | { |
|
|
1086 | LOG (llevDebug, "first_map_ext_path not set\n"); |
1097 | LOG (llevDebug, "first_map_ext_path not set\n"); |
1087 | } |
1098 | |
1088 | return 0; |
1099 | return 0; |
1089 | } |
1100 | } |
1090 | |
1101 | |
1091 | /* Following actually changes the race - this is the default command |
1102 | /* Following actually changes the race - this is the default command |
1092 | * if we don't match with one of the options above. |
1103 | * if we don't match with one of the options above. |
… | |
… | |
1789 | if (!dir) |
1800 | if (!dir) |
1790 | { |
1801 | { |
1791 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1802 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1792 | return 0; |
1803 | return 0; |
1793 | } |
1804 | } |
|
|
1805 | |
1794 | if (op->type == PLAYER) |
1806 | if (op->type == PLAYER) |
1795 | bow = op->contr->ranges[range_bow]; |
1807 | bow = op->contr->ranges[range_bow]; |
1796 | else |
1808 | else |
1797 | { |
1809 | { |
1798 | for (bow = op->inv; bow; bow = bow->below) |
1810 | for (bow = op->inv; bow; bow = bow->below) |
… | |
… | |
1806 | { |
1818 | { |
1807 | LOG (llevError, "Range: bow without activated bow (%s).\n", &op->name); |
1819 | LOG (llevError, "Range: bow without activated bow (%s).\n", &op->name); |
1808 | return 0; |
1820 | return 0; |
1809 | } |
1821 | } |
1810 | } |
1822 | } |
|
|
1823 | |
1811 | if (!bow->race || !bow->skill) |
1824 | if (!bow->race || !bow->skill) |
1812 | { |
1825 | { |
1813 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s is broken.", &bow->name); |
1826 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s is broken.", &bow->name); |
1814 | return 0; |
1827 | return 0; |
1815 | } |
1828 | } |
… | |
… | |
1817 | bowspeed = bow->stats.sp + dex_bonus[op->stats.Dex]; |
1830 | bowspeed = bow->stats.sp + dex_bonus[op->stats.Dex]; |
1818 | |
1831 | |
1819 | /* penalize ROF for bestarrow */ |
1832 | /* penalize ROF for bestarrow */ |
1820 | if (op->type == PLAYER && op->contr->bowtype == bow_bestarrow) |
1833 | if (op->type == PLAYER && op->contr->bowtype == bow_bestarrow) |
1821 | bowspeed -= dex_bonus[op->stats.Dex] + 5; |
1834 | bowspeed -= dex_bonus[op->stats.Dex] + 5; |
|
|
1835 | |
1822 | if (bowspeed < 1) |
1836 | if (bowspeed < 1) |
1823 | bowspeed = 1; |
1837 | bowspeed = 1; |
1824 | |
1838 | |
1825 | if (arrow == NULL) |
1839 | if (arrow == NULL) |
1826 | { |
1840 | { |
… | |
… | |
1832 | else |
1846 | else |
1833 | CLEAR_FLAG (op, FLAG_READY_BOW); |
1847 | CLEAR_FLAG (op, FLAG_READY_BOW); |
1834 | return 0; |
1848 | return 0; |
1835 | } |
1849 | } |
1836 | } |
1850 | } |
|
|
1851 | |
1837 | mflags = get_map_flags (op->map, &m, sx, sy, &sx, &sy); |
1852 | mflags = get_map_flags (op->map, &m, sx, sy, &sx, &sy); |
1838 | if (mflags & P_OUT_OF_MAP) |
1853 | if (mflags & P_OUT_OF_MAP) |
1839 | { |
|
|
1840 | return 0; |
1854 | return 0; |
1841 | } |
1855 | |
1842 | if (GET_MAP_MOVE_BLOCK (m, sx, sy) == MOVE_FLY_LOW) |
1856 | if (GET_MAP_MOVE_BLOCK (m, sx, sy) == MOVE_FLY_LOW) |
1843 | { |
1857 | { |
1844 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
1858 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
1845 | return 0; |
1859 | return 0; |
1846 | } |
1860 | } |
… | |
… | |
1852 | return 0; |
1866 | return 0; |
1853 | } |
1867 | } |
1854 | |
1868 | |
1855 | left = arrow; /* these are arrows left to the player */ |
1869 | left = arrow; /* these are arrows left to the player */ |
1856 | arrow = get_split_ob (arrow, 1); |
1870 | arrow = get_split_ob (arrow, 1); |
1857 | if (arrow == NULL) |
1871 | if (!arrow) |
1858 | { |
1872 | { |
1859 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1873 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1860 | return 0; |
1874 | return 0; |
1861 | } |
1875 | } |
|
|
1876 | |
1862 | arrow->set_owner (op); |
1877 | arrow->set_owner (op); |
1863 | arrow->skill = bow->skill; |
1878 | arrow->skill = bow->skill; |
1864 | |
1879 | |
1865 | arrow->direction = dir; |
1880 | arrow->direction = dir; |
1866 | arrow->x = sx; |
1881 | arrow->x = sx; |
… | |
… | |
1875 | SET_ANIMATION (arrow, arrow->direction); |
1890 | SET_ANIMATION (arrow, arrow->direction); |
1876 | arrow->stats.sp = arrow->stats.wc; /* save original wc and dam */ |
1891 | arrow->stats.sp = arrow->stats.wc; /* save original wc and dam */ |
1877 | arrow->stats.hp = arrow->stats.dam; |
1892 | arrow->stats.hp = arrow->stats.dam; |
1878 | arrow->stats.grace = arrow->attacktype; |
1893 | arrow->stats.grace = arrow->attacktype; |
1879 | if (arrow->slaying != NULL) |
1894 | if (arrow->slaying != NULL) |
1880 | arrow->spellarg = strdup_local (arrow->slaying); |
1895 | arrow->spellarg = strdup (arrow->slaying); |
1881 | |
1896 | |
1882 | /* Note that this was different for monsters - they got their level |
1897 | /* Note that this was different for monsters - they got their level |
1883 | * added to the damage. I think the strength bonus is more proper. |
1898 | * added to the damage. I think the strength bonus is more proper. |
1884 | */ |
1899 | */ |
1885 | |
1900 | |
… | |
… | |
1909 | } |
1924 | } |
1910 | |
1925 | |
1911 | if (arrow->attacktype == AT_PHYSICAL) |
1926 | if (arrow->attacktype == AT_PHYSICAL) |
1912 | arrow->attacktype |= bow->attacktype; |
1927 | arrow->attacktype |= bow->attacktype; |
1913 | |
1928 | |
1914 | if (bow->slaying != NULL) |
1929 | if (bow->slaying) |
1915 | arrow->slaying = bow->slaying; |
1930 | arrow->slaying = bow->slaying; |
1916 | |
1931 | |
1917 | arrow->map = m; |
1932 | arrow->map = m; |
1918 | arrow->move_type = MOVE_FLY_LOW; |
1933 | arrow->move_type = MOVE_FLY_LOW; |
1919 | arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; |
1934 | arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; |
… | |
… | |
2541 | |
2556 | |
2542 | /* call this here - we also will call this in do_ericserver, but |
2557 | /* call this here - we also will call this in do_ericserver, but |
2543 | * the players time has been increased when doericserver has been |
2558 | * the players time has been increased when doericserver has been |
2544 | * called, so we recheck it here. |
2559 | * called, so we recheck it here. |
2545 | */ |
2560 | */ |
2546 | HandleClient (op->contr->socket, op->contr); |
2561 | //TODO: better than handling 8 commands, use some more intelligent rate-limiting |
|
|
2562 | for (int rep = 8; --rep && op->contr->socket->handle_command (); ) |
|
|
2563 | ; |
|
|
2564 | |
2547 | if (op->speed_left < 0) |
2565 | if (op->speed_left < 0) |
2548 | return 0; |
2566 | return 0; |
2549 | |
2567 | |
2550 | if (op->direction && (op->contr->run_on || op->contr->fire_on)) |
2568 | if (op->direction && (op->contr->run_on || op->contr->fire_on)) |
2551 | { |
2569 | { |
… | |
… | |
2560 | if (op->speed_left > 0) |
2578 | if (op->speed_left > 0) |
2561 | return 1; |
2579 | return 1; |
2562 | else |
2580 | else |
2563 | return 0; |
2581 | return 0; |
2564 | } |
2582 | } |
|
|
2583 | |
2565 | return 0; |
2584 | return 0; |
2566 | } |
2585 | } |
2567 | |
2586 | |
2568 | int |
2587 | int |
2569 | save_life (object *op) |
2588 | save_life (object *op) |
2570 | { |
2589 | { |
2571 | object *tmp; |
|
|
2572 | |
|
|
2573 | if (!QUERY_FLAG (op, FLAG_LIFESAVE)) |
2590 | if (!QUERY_FLAG (op, FLAG_LIFESAVE)) |
2574 | return 0; |
2591 | return 0; |
2575 | |
2592 | |
2576 | for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
2593 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
2577 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) |
2594 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) |
2578 | { |
2595 | { |
2579 | play_sound_map (op->map, op->x, op->y, SOUND_OB_EVAPORATE); |
2596 | play_sound_map (op->map, op->x, op->y, SOUND_OB_EVAPORATE); |
2580 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); |
2597 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); |
2581 | |
2598 | |
… | |
… | |
2592 | op->stats.food = 999; |
2609 | op->stats.food = 999; |
2593 | |
2610 | |
2594 | fix_player (op); |
2611 | fix_player (op); |
2595 | return 1; |
2612 | return 1; |
2596 | } |
2613 | } |
|
|
2614 | |
2597 | LOG (llevError, "Error: LIFESAVE set without applied object.\n"); |
2615 | LOG (llevError, "Error: LIFESAVE set without applied object.\n"); |
2598 | CLEAR_FLAG (op, FLAG_LIFESAVE); |
2616 | CLEAR_FLAG (op, FLAG_LIFESAVE); |
2599 | enter_player_savebed (op); /* bring him home. */ |
2617 | enter_player_savebed (op); /* bring him home. */ |
2600 | return 0; |
2618 | return 0; |
2601 | } |
2619 | } |
… | |
… | |
2624 | esrv_del_item (env->contr, op->count); |
2642 | esrv_del_item (env->contr, op->count); |
2625 | insert_ob_in_map (op, env->map, NULL, 0); |
2643 | insert_ob_in_map (op, env->map, NULL, 0); |
2626 | } |
2644 | } |
2627 | else if (op->inv) |
2645 | else if (op->inv) |
2628 | remove_unpaid_objects (op->inv, env); |
2646 | remove_unpaid_objects (op->inv, env); |
|
|
2647 | |
2629 | op = next; |
2648 | op = next; |
2630 | } |
2649 | } |
2631 | } |
2650 | } |
2632 | |
2651 | |
2633 | |
2652 | |
… | |
… | |
2648 | strcpy (buf2, " R.I.P.\n\n"); |
2667 | strcpy (buf2, " R.I.P.\n\n"); |
2649 | if (op->type == PLAYER) |
2668 | if (op->type == PLAYER) |
2650 | sprintf (buf, "%s the %s\n", &op->name, op->contr->title); |
2669 | sprintf (buf, "%s the %s\n", &op->name, op->contr->title); |
2651 | else |
2670 | else |
2652 | sprintf (buf, "%s\n", &op->name); |
2671 | sprintf (buf, "%s\n", &op->name); |
|
|
2672 | |
2653 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
2673 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
2654 | strcat (buf2, buf); |
2674 | strcat (buf2, buf); |
2655 | if (op->type == PLAYER) |
2675 | if (op->type == PLAYER) |
2656 | sprintf (buf, "who was in level %d when killed\n", op->level); |
2676 | sprintf (buf, "who was in level %d when killed\n", op->level); |
2657 | else |
2677 | else |
2658 | sprintf (buf, "who was in level %d when died.\n\n", op->level); |
2678 | sprintf (buf, "who was in level %d when died.\n\n", op->level); |
|
|
2679 | |
2659 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
2680 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
2660 | strcat (buf2, buf); |
2681 | strcat (buf2, buf); |
2661 | if (op->type == PLAYER) |
2682 | if (op->type == PLAYER) |
2662 | { |
2683 | { |
2663 | sprintf (buf, "by %s.\n\n", op->contr->killer); |
2684 | sprintf (buf, "by %s.\n\n", op->contr->killer); |
2664 | strncat (buf2, " ", 21 - strlen (buf) / 2); |
2685 | strncat (buf2, " ", 21 - strlen (buf) / 2); |
2665 | strcat (buf2, buf); |
2686 | strcat (buf2, buf); |
2666 | } |
2687 | } |
|
|
2688 | |
2667 | strftime (buf, MAX_BUF, "%b %d %Y\n", localtime (&now)); |
2689 | strftime (buf, MAX_BUF, "%b %d %Y\n", localtime (&now)); |
2668 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
2690 | strncat (buf2, " ", 20 - strlen (buf) / 2); |
2669 | strcat (buf2, buf); |
2691 | strcat (buf2, buf); |
|
|
2692 | |
2670 | return buf2; |
2693 | return buf2; |
2671 | } |
2694 | } |
2672 | |
2695 | |
2673 | |
2696 | |
2674 | |
2697 | |