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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.47 by elmex, Tue Dec 19 20:32:35 2006 UTC vs.
Revision 1.48 by root, Wed Dec 20 09:14:22 2006 UTC

195apply_potion (object *op, object *tmp) 195apply_potion (object *op, object *tmp)
196{ 196{
197 int got_one = 0, i; 197 int got_one = 0, i;
198 object *force = 0, *floor = 0; 198 object *force = 0, *floor = 0;
199 199
200 floor = get_map_ob (op->map, op->x, op->y); 200 floor = GET_MAP_OB (op->map, op->x, op->y);
201 201
202 if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) 202 if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE)
203 { 203 {
204 if (op->type == PLAYER) 204 if (op->type == PLAYER)
205 new_draw_info (NDI_UNIQUE, 0, op, "Gods prevent you from using this here, it's sacred ground!"); 205 new_draw_info (NDI_UNIQUE, 0, op, "Gods prevent you from using this here, it's sacred ground!");
1046 if (op->container != sack) 1046 if (op->container != sack)
1047 { 1047 {
1048 /* it's closed OR some player has opened it */ 1048 /* it's closed OR some player has opened it */
1049 if (QUERY_FLAG (sack, FLAG_APPLIED)) 1049 if (QUERY_FLAG (sack, FLAG_APPLIED))
1050 { 1050 {
1051 for (tmp = get_map_ob (sack->map, sack->x, sack->y); tmp && tmp->container != sack; tmp = tmp->above); 1051 for (tmp = GET_MAP_OB (sack->map, sack->x, sack->y); tmp && tmp->container != sack; tmp = tmp->above);
1052 if (tmp) 1052 if (tmp)
1053 { 1053 {
1054 /* some other player have opened it */ 1054 /* some other player have opened it */
1055 new_draw_info_format (NDI_UNIQUE, 0, op, "%s is already occupied.", query_name (sack)); 1055 new_draw_info_format (NDI_UNIQUE, 0, op, "%s is already occupied.", query_name (sack));
1056 return 1; 1056 return 1;
1120 tmp = find_key (op, op, sack); 1120 tmp = find_key (op, op, sack);
1121 if (tmp) 1121 if (tmp)
1122 { 1122 {
1123 sprintf (buf, "You unlock %s with %s.", query_name (sack), query_name (tmp)); 1123 sprintf (buf, "You unlock %s with %s.", query_name (sack), query_name (tmp));
1124 SET_FLAG (sack, FLAG_APPLIED); 1124 SET_FLAG (sack, FLAG_APPLIED);
1125
1125 if (sack->env == NULL) 1126 if (sack->env == NULL)
1126 { /* if it's on ground,open it also */ 1127 { /* if it's on ground,open it also */
1127 new_draw_info (NDI_UNIQUE, 0, op, buf); 1128 new_draw_info (NDI_UNIQUE, 0, op, buf);
1128 apply_container (op, sack); 1129 apply_container (op, sack);
1129 return 1; 1130 return 1;
1130 } 1131 }
1131 } 1132 }
1132 else 1133 else
1133 {
1134 sprintf (buf, "You don't have the key to unlock %s.", query_name (sack)); 1134 sprintf (buf, "You don't have the key to unlock %s.", query_name (sack));
1135 }
1136 } 1135 }
1137 else 1136 else
1138 { 1137 {
1139 sprintf (buf, "You readied %s.", query_name (sack)); 1138 sprintf (buf, "You readied %s.", query_name (sack));
1140 SET_FLAG (sack, FLAG_APPLIED); 1139 SET_FLAG (sack, FLAG_APPLIED);
1140
1141 if (sack->env == NULL) 1141 if (sack->env == NULL)
1142 { /* if it's on ground,open it also */ 1142 { /* if it's on ground,open it also */
1143 new_draw_info (NDI_UNIQUE, 0, op, buf); 1143 new_draw_info (NDI_UNIQUE, 0, op, buf);
1144 apply_container (op, sack); 1144 apply_container (op, sack);
1145 return 1; 1145 return 1;
2476 exitmap = ready_map_name (EXIT_PATH (exit), MAP_PLAYER_UNIQUE); 2476 exitmap = ready_map_name (EXIT_PATH (exit), MAP_PLAYER_UNIQUE);
2477 else 2477 else
2478 exitmap = ready_map_name (EXIT_PATH (exit), 0); 2478 exitmap = ready_map_name (EXIT_PATH (exit), 0);
2479 if (exitmap) 2479 if (exitmap)
2480 { 2480 {
2481 tmp = get_map_ob (exitmap, EXIT_X (exit), EXIT_Y (exit)); 2481 tmp = GET_MAP_OB (exitmap, EXIT_X (exit), EXIT_Y (exit));
2482 if (!tmp) 2482 if (!tmp)
2483 return 0; 2483 return 0;
2484 for ((tmp = get_map_ob (exitmap, EXIT_X (exit), EXIT_Y (exit))); tmp; tmp = tmp->above) 2484 for ((tmp = GET_MAP_OB (exitmap, EXIT_X (exit), EXIT_Y (exit))); tmp; tmp = tmp->above)
2485 { 2485 {
2486 if (tmp->type != EXIT) 2486 if (tmp->type != EXIT)
2487 continue; /*Not an exit */ 2487 continue; /*Not an exit */
2488 if (!EXIT_PATH (tmp)) 2488 if (!EXIT_PATH (tmp))
2489 continue; /*Not a valid exit */ 2489 continue; /*Not a valid exit */
3727 if (m == NULL) 3727 if (m == NULL)
3728 return; 3728 return;
3729 3729
3730 for (x = 0; x < MAP_WIDTH (m); x++) 3730 for (x = 0; x < MAP_WIDTH (m); x++)
3731 for (y = 0; y < MAP_HEIGHT (m); y++) 3731 for (y = 0; y < MAP_HEIGHT (m); y++)
3732 for (tmp = get_map_ob (m, x, y); tmp != NULL; tmp = above) 3732 for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = above)
3733 { 3733 {
3734 above = tmp->above; 3734 above = tmp->above;
3735 3735
3736 if (tmp->inv) 3736 if (tmp->inv)
3737 { 3737 {
3810 } 3810 }
3811 } 3811 }
3812 3812
3813 for (x = 0; x < MAP_WIDTH (m); x++) 3813 for (x = 0; x < MAP_WIDTH (m); x++)
3814 for (y = 0; y < MAP_HEIGHT (m); y++) 3814 for (y = 0; y < MAP_HEIGHT (m); y++)
3815 for (tmp = get_map_ob (m, x, y); tmp != NULL; tmp = tmp->above) 3815 for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above)
3816 if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL)) 3816 if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL))
3817 check_trigger (tmp, tmp->above); 3817 check_trigger (tmp, tmp->above);
3818} 3818}
3819 3819
3820/** 3820/**
3913void 3913void
3914apply_lighter (object *who, object *lighter) 3914apply_lighter (object *who, object *lighter)
3915{ 3915{
3916 object *item; 3916 object *item;
3917 int is_player_env = 0; 3917 int is_player_env = 0;
3918 char item_name[MAX_BUF];
3919 3918
3920 item = find_marked_object (who); 3919 item = find_marked_object (who);
3921 if (item) 3920 if (item)
3922 { 3921 {
3923 if (lighter->last_eat && lighter->stats.food) 3922 if (lighter->last_eat && lighter->stats.food)
3941 else if (lighter->last_eat) 3940 else if (lighter->last_eat)
3942 { /* no charges left in lighter */ 3941 { /* no charges left in lighter */
3943 new_draw_info_format (NDI_UNIQUE, 0, who, "You attempt to light the %s with a used up %s.", &item->name, &lighter->name); 3942 new_draw_info_format (NDI_UNIQUE, 0, who, "You attempt to light the %s with a used up %s.", &item->name, &lighter->name);
3944 return; 3943 return;
3945 } 3944 }
3945
3946 /* Perhaps we should split what we are trying to light on fire? 3946 /* Perhaps we should split what we are trying to light on fire?
3947 * I can't see many times when you would want to light multiple 3947 * I can't see many times when you would want to light multiple
3948 * objects at once. 3948 * objects at once.
3949 */ 3949 */
3950 /* If the item is destroyed, we don't have a valid pointer to the 3950
3951 * name object, so make a copy so the message we print out makes
3952 * some sense.
3953 */
3954 strcpy (item_name, item->name);
3955 if (who == is_player_inv (item)) 3951 if (who == item->in_player ())
3956 is_player_env = 1; 3952 is_player_env = 1;
3957 3953
3958 save_throw_object (item, AT_FIRE, who); 3954 save_throw_object (item, AT_FIRE, who);
3959 /* Change to check count and not freed, since the object pointer 3955
3960 * may have gotten recycled
3961 */
3962 if (item->destroyed ()) 3956 if (!item->destroyed ())
3963 { 3957 {
3964 new_draw_info_format (NDI_UNIQUE, 0, who, "You light the %s with the %s.", &item_name, &lighter->name); 3958 new_draw_info_format (NDI_UNIQUE, 0, who, "You light the %s with the %s.", &item->name, &lighter->name);
3965 /* Need to update the player so that the players glow radius 3959 /* Need to update the player so that the players glow radius
3966 * gets changed. 3960 * gets changed.
3967 */ 3961 */
3968 if (is_player_env) 3962 if (is_player_env)
3969 fix_player (who); 3963 fix_player (who);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines