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

Comparing deliantra/server/server/time.C (file contents):
Revision 1.85 by elmex, Mon Jan 12 00:17:23 2009 UTC vs.
Revision 1.95 by root, Mon Oct 26 11:31:39 2009 UTC

3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24/* 25/*
599 600
600 // restore original wc, dam, attacktype and slaying 601 // restore original wc, dam, attacktype and slaying
601 op->stats.wc = op->stats.sp; 602 op->stats.wc = op->stats.sp;
602 op->stats.dam = op->stats.hp; 603 op->stats.dam = op->stats.hp;
603 op->attacktype = op->stats.grace; 604 op->attacktype = op->stats.grace;
605 op->slaying = op->custom_name;
604 606
605 if (op->spellarg)
606 {
607 op->slaying = op->spellarg;
608 free (op->spellarg);
609 op->spellarg = 0;
610 }
611 else
612 op->slaying = 0;
613
614 /* Reset these to zero, so that object::can_merge will work properly */ 607 /* Reset these to defaults, so that object::can_merge will work properly */
615 op->spellarg = NULL; 608 op->custom_name = 0;
616 op->stats.sp = 0; 609 op->stats.sp = 0;
617 op->stats.hp = 0; 610 op->stats.hp = 0;
618 op->stats.grace = 0; 611 op->stats.grace = 0;
619 op->level = 0; 612 op->level = 0;
620 op->face = op->arch->face; 613 op->face = op->arch->face;
621 op->owner = NULL; /* So that stopped arrows will be saved */ 614 op->owner = 0;
615
622 update_object (op, UP_OBJ_CHANGE); 616 update_object (op, UP_OBJ_CHANGE);
617
623 return op; 618 return op;
624} 619}
625 620
626/* stop_arrow() - what to do when a non-living flying object 621/* stop_arrow() - what to do when a non-living flying object
627 * has to stop. Sept 96 - I added in thrown object code in 622 * has to stop. Sept 96 - I added in thrown object code in
816 return; 811 return;
817 } 812 }
818 813
819 /* update object image for new facing */ 814 /* update object image for new facing */
820 /* many thrown objects *don't* have more than one face */ 815 /* many thrown objects *don't* have more than one face */
821 if (GET_ANIM_ID (op)) 816 if (op->has_anim ())
822 SET_ANIMATION (op, op->direction); 817 op->set_anim_frame (op->direction);
823 } /* object is reflected */ 818 } /* object is reflected */
824 } /* object ran into a wall */ 819 } /* object ran into a wall */
825 820
826 /* decrease the speed as it flies. 0.05 means a standard bow will shoot 821 /* decrease the speed as it flies. 0.05 means a standard bow will shoot
827 * about 17 squares. Tune as needed. 822 * about 17 squares. Tune as needed.
1235 { 1230 {
1236 /* remove an old force with a slaying field == op->name */ 1231 /* remove an old force with a slaying field == op->name */
1237 if (object *force = tmp->force_find (op->name)) 1232 if (object *force = tmp->force_find (op->name))
1238 force->destroy (); 1233 force->destroy ();
1239 1234
1240 if (!tmp->force_find (op->slaying)) 1235 if (op->slaying && !tmp->force_find (op->slaying))
1241 { 1236 {
1242 tmp->force_add (op->slaying, op->stats.food); 1237 tmp->force_add (op->slaying, op->stats.food);
1243 1238
1244 if (op->msg) 1239 if (op->msg)
1245 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg); 1240 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg);
1274 if (!op->glow_radius) 1269 if (!op->glow_radius)
1275 { 1270 {
1276 op->set_speed (0); 1271 op->set_speed (0);
1277 return; 1272 return;
1278 } 1273 }
1274 else
1275 {
1276 // check whether the face might need to be updated
1277 // (currently this is needed to have already switched on torches
1278 // on maps, as they just set the glow_radius in the archetype)
1279 if (op->other_arch
1280 && (
1281 (op->flag [FLAG_ANIMATE] != op->other_arch->flag [FLAG_ANIMATE])
1282 || (op->flag [FLAG_ANIMATE]
1283 ? (op->animation_id != op->other_arch->animation_id)
1284 : (op->face != op->other_arch->face))
1285 ))
1286 get_animation_from_arch (op, op->other_arch);
1287 }
1279 1288
1280 // lamps and torches auf maps don't use up their fuel 1289 // lamps and torches on maps don't use up their fuel
1281 if (op->is_on_map ()) 1290 if (op->is_on_map ())
1282 return; 1291 return;
1283 1292
1284 if (op->stats.food > 0) 1293 if (op->stats.food > 0)
1285 { 1294 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines