occupation callback for 'A' */
| 2897 | |
| 2898 | /* occupation callback for 'A' */ |
| 2899 | staticfn int |
| 2900 | take_off(void) |
| 2901 | { |
| 2902 | int i; |
| 2903 | struct obj *otmp; |
| 2904 | struct takeoff_info *doff = &svc.context.takeoff; |
| 2905 | |
| 2906 | if (doff->what) { |
| 2907 | if (doff->delay > 0) { |
| 2908 | doff->delay--; |
| 2909 | return 1; /* still busy */ |
| 2910 | } |
| 2911 | if ((otmp = do_takeoff()) != 0) |
| 2912 | off_msg(otmp); |
| 2913 | doff->mask &= ~doff->what; |
| 2914 | doff->what = 0L; |
| 2915 | } |
| 2916 | |
| 2917 | for (i = 0; takeoff_order[i]; i++) |
| 2918 | if (doff->mask & takeoff_order[i]) { |
| 2919 | doff->what = takeoff_order[i]; |
| 2920 | break; |
| 2921 | } |
| 2922 | |
| 2923 | otmp = (struct obj *) 0; |
| 2924 | doff->delay = 0; |
| 2925 | |
| 2926 | if (doff->what == 0L) { |
| 2927 | You("finish %s.", doff->disrobing); |
| 2928 | return 0; |
| 2929 | } else if (doff->what == W_WEP) { |
| 2930 | doff->delay = 1; |
| 2931 | } else if (doff->what == W_SWAPWEP) { |
| 2932 | doff->delay = 1; |
| 2933 | } else if (doff->what == W_QUIVER) { |
| 2934 | doff->delay = 1; |
| 2935 | } else if (doff->what == WORN_ARMOR) { |
| 2936 | otmp = uarm; |
| 2937 | /* If a cloak is being worn, add the time to take it off and put |
| 2938 | * it back on again. Kludge alert! since that time is 0 for all |
| 2939 | * known cloaks, add 1 so that it actually matters... |
| 2940 | */ |
| 2941 | if (uarmc) |
| 2942 | doff->delay += 2 * objects[uarmc->otyp].oc_delay + 1; |
| 2943 | } else if (doff->what == WORN_CLOAK) { |
| 2944 | otmp = uarmc; |
| 2945 | } else if (doff->what == WORN_BOOTS) { |
| 2946 | otmp = uarmf; |
| 2947 | } else if (doff->what == WORN_GLOVES) { |
| 2948 | otmp = uarmg; |
| 2949 | } else if (doff->what == WORN_HELMET) { |
| 2950 | otmp = uarmh; |
| 2951 | } else if (doff->what == WORN_SHIELD) { |
| 2952 | otmp = uarms; |
| 2953 | } else if (doff->what == WORN_SHIRT) { |
| 2954 | otmp = uarmu; |
| 2955 | /* add the time to take off and put back on armor and/or cloak */ |
| 2956 | if (uarm) |
no test coverage detected