1 | /* |
1 | /* |
2 | * static char *rcsid_apply_c = |
2 | * static char *rcsid_apply_c = |
3 | * "$Id: apply.C,v 1.4 2006/08/15 16:19:55 elmex Exp $"; |
3 | * "$Id: apply.C,v 1.9 2006/08/25 17:11:53 root Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
… | |
… | |
63 | */ |
63 | */ |
64 | int apply_transport(object *pl, object *transport, int aflag) { |
64 | int apply_transport(object *pl, object *transport, int aflag) { |
65 | |
65 | |
66 | /* Only players can use transports right now */ |
66 | /* Only players can use transports right now */ |
67 | if (pl->type != PLAYER) return 0; |
67 | if (pl->type != PLAYER) return 0; |
|
|
68 | |
|
|
69 | // due to brokenness of transports disable them until a working alternative |
|
|
70 | // has been found... :( |
|
|
71 | // - elmex |
|
|
72 | new_draw_info (NDI_UNIQUE, 0, pl, "This transport is out of order!"); |
|
|
73 | return 1; |
68 | |
74 | |
69 | /* If player is currently on a transport but not this transport, they need |
75 | /* If player is currently on a transport but not this transport, they need |
70 | * to exit first. Perhaps transport to transport transfers should be |
76 | * to exit first. Perhaps transport to transport transfers should be |
71 | * allowed. |
77 | * allowed. |
72 | */ |
78 | */ |
… | |
… | |
338 | int got_one = 0, i; |
344 | int got_one = 0, i; |
339 | object *force = 0, *floor = 0; |
345 | object *force = 0, *floor = 0; |
340 | |
346 | |
341 | floor = get_map_ob (op->map, op->x, op->y); |
347 | floor = get_map_ob (op->map, op->x, op->y); |
342 | |
348 | |
343 | if (get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE_MAP) |
349 | if (get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) |
344 | { |
350 | { |
345 | if (op->type == PLAYER) |
351 | if (op->type == PLAYER) |
346 | new_draw_info (NDI_UNIQUE, 0, op, |
352 | new_draw_info (NDI_UNIQUE, 0, op, |
347 | "Gods prevent you from using this here, it's sacred ground!" |
353 | "Gods prevent you from using this here, it's sacred ground!" |
348 | ); |
354 | ); |
… | |
… | |
1490 | } else { |
1496 | } else { |
1491 | remove_ob (op); |
1497 | remove_ob (op); |
1492 | op->x += freearr_x[i]; |
1498 | op->x += freearr_x[i]; |
1493 | op->y += freearr_y[i]; |
1499 | op->y += freearr_y[i]; |
1494 | rv = insert_ob_in_map (op, op->map, shop_mat,0) == NULL; |
1500 | rv = insert_ob_in_map (op, op->map, shop_mat,0) == NULL; |
1495 | esrv_map_scroll(&op->contr->socket, freearr_x[i],freearr_y[i]); |
|
|
1496 | op->contr->socket.update_look=1; |
|
|
1497 | op->contr->socket.look_position=0; |
|
|
1498 | } |
1501 | } |
1499 | } |
1502 | } |
1500 | CLEAR_FLAG (op, FLAG_NO_APPLY); |
1503 | CLEAR_FLAG (op, FLAG_NO_APPLY); |
1501 | return rv; |
1504 | return rv; |
1502 | } |
1505 | } |
… | |
… | |
1821 | else |
1824 | else |
1822 | new_draw_info(NDI_UNIQUE, 0,op,"This book is totally beyond your comprehension."); |
1825 | new_draw_info(NDI_UNIQUE, 0,op,"This book is totally beyond your comprehension."); |
1823 | return; |
1826 | return; |
1824 | } |
1827 | } |
1825 | |
1828 | |
1826 | |
|
|
1827 | /* Lauwenmark: Handle for plugin book event */ |
|
|
1828 | /*printf("Book apply: %s\n", tmp->name); |
|
|
1829 | execute_event(tmp, EVENT_APPLY,op,NULL,SCRIPT_FIX_ALL); |
|
|
1830 | printf("Book applied: %s\n", tmp->name);*/ |
|
|
1831 | /*if ((evt = find_event(tmp, EVENT_APPLY)) != NULL) |
|
|
1832 | { |
|
|
1833 | CFParm CFP; |
|
|
1834 | int k, l, m; |
|
|
1835 | uint32 n; |
|
|
1836 | new_draw_info_format (NDI_UNIQUE, 0, op, |
|
|
1837 | "You open the %s and start reading.", tmp->name); |
|
|
1838 | k = EVENT_APPLY; |
|
|
1839 | l = SCRIPT_FIX_ALL; |
|
|
1840 | m = 0; |
|
|
1841 | n = 0; |
|
|
1842 | CFP.Value[0] = &k; |
|
|
1843 | CFP.Value[1] = op; |
|
|
1844 | CFP.Value[2] = tmp; |
|
|
1845 | CFP.Value[3] = NULL; |
|
|
1846 | CFP.Value[4] = NULL; |
|
|
1847 | CFP.Value[5] = &n; |
|
|
1848 | CFP.Value[6] = &m; |
|
|
1849 | CFP.Value[7] = &m; |
|
|
1850 | CFP.Value[8] = &l; |
|
|
1851 | CFP.Value[9] = (void*)evt->hook; |
|
|
1852 | CFP.Value[10]= (void*)evt->options; |
|
|
1853 | if (findPlugin(evt->plugin)>=0) |
|
|
1854 | ((PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP)); |
|
|
1855 | } |
|
|
1856 | else*/{ |
|
|
1857 | readable_message_type* msgType = get_readable_message_type(tmp); |
1829 | readable_message_type* msgType = get_readable_message_type(tmp); |
1858 | draw_ext_info_format(NDI_UNIQUE | NDI_NAVY, 0, op, |
1830 | draw_ext_info_format(NDI_UNIQUE | NDI_NAVY, 0, op, |
1859 | msgType->message_type, msgType->message_subtype, |
1831 | msgType->message_type, msgType->message_subtype, |
1860 | "You open the %s and start reading.\n%s", |
1832 | "You open the %s and start reading.\n%s", |
1861 | "%s\n%s", |
1833 | "%s\n%s", |
1862 | long_desc(tmp,op), tmp->msg); |
1834 | long_desc(tmp,op), tmp->msg); |
1863 | } |
|
|
1864 | |
1835 | |
1865 | /* gain xp from reading */ |
1836 | /* gain xp from reading */ |
1866 | if(!QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT)) { /* only if not read before */ |
1837 | if(!QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT)) { /* only if not read before */ |
1867 | int exp_gain=calc_skill_exp(op,tmp, skill_ob); |
1838 | int exp_gain=calc_skill_exp(op,tmp, skill_ob); |
1868 | if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED)) { |
1839 | if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED)) { |
… | |
… | |
2577 | } |
2548 | } |
2578 | } |
2549 | } |
2579 | |
2550 | |
2580 | |
2551 | |
2581 | /* Lauwenmark: Handle for plugin apply event */ |
2552 | /* Lauwenmark: Handle for plugin apply event */ |
|
|
2553 | //TODO: remove |
2582 | if (execute_event(tmp, EVENT_APPLY,op,NULL,NULL,SCRIPT_FIX_ALL)!=0) |
2554 | if (execute_event(tmp, EVENT_APPLY,op,NULL,NULL,SCRIPT_FIX_ALL)!=0) |
|
|
2555 | return 1; |
|
|
2556 | |
|
|
2557 | if (INVOKE_OBJECT (APPLY, tmp, ARG_OBJECT (op))) |
2583 | return 1; |
2558 | return 1; |
2584 | |
2559 | |
2585 | switch (tmp->type) { |
2560 | switch (tmp->type) { |
2586 | |
2561 | |
2587 | case TRANSPORT: |
2562 | case TRANSPORT: |