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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.279 by root, Sun May 9 23:03:24 2010 UTC vs.
Revision 1.286 by root, Wed May 4 19:04:45 2011 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
22 * 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>
23 */ 23 */
24 24
25//+GPL 25//+GPL
26 26
27#include <algorithm>
28#include <functional>
29
27#include <global.h> 30#include <global.h>
28#include <sproto.h> 31#include <sproto.h>
29#include <sounds.h> 32#include <sounds.h>
30#include <living.h> 33#include <living.h>
31#include <object.h> 34#include <object.h>
32#include <spells.h> 35#include <spells.h>
33#include <skills.h> 36#include <skills.h>
34
35#include <algorithm>
36#include <functional>
37 37
38playervec players; 38playervec players;
39 39
40/* This loads the first map an puts the player on it. */ 40/* This loads the first map an puts the player on it. */
41static void 41static void
1867 || mon->flag [FLAG_CAN_ROLL]) 1867 || mon->flag [FLAG_CAN_ROLL])
1868 && mon != op) 1868 && mon != op)
1869 break; 1869 break;
1870 } 1870 }
1871 1871
1872 if (!mon) /* This happens anytime the player tries to move */ 1872 /* no monster == player tries to move into a wall or so */
1873 return false; /* into a wall */ 1873 if (!mon)
1874 {
1875 for (object *ob = m->at (nx, ny).top; ob; ob = ob->below)
1876 if (op->move_type & ob->move_block)
1877 {
1878 if (ob->move_block == MOVE_ALL)
1879 move_into_wall (op, ob);
1880 else
1881 {
1882 if (op->contr->ns->bumpmsg)
1883 {
1884 op->play_sound (sound_find ("blocked_move"));
1885
1886 op->statusmsg (ob->invisible
1887 ? "Something blocks you."
1888 : format ("Something blocks you from entering the %s.", query_name (ob))
1889 );
1890 }
1891 }
1892
1893 break;
1894 }
1895
1896 return false;
1897 }
1874 1898
1875 mon = mon->head_ (); 1899 mon = mon->head_ ();
1876 1900
1877 if ((mon->type == DOOR && mon->stats.hp >= 0) || (mon->type == LOCKED_DOOR)) 1901 if ((mon->type == DOOR && mon->stats.hp >= 0) || (mon->type == LOCKED_DOOR))
1878 if (op->contr->weapon_sp_left > 0.f) 1902 if (op->contr->weapon_sp_left > 0.f)
1993} 2017}
1994 2018
1995bool 2019bool
1996move_player (object *op, int dir) 2020move_player (object *op, int dir)
1997{ 2021{
1998 if (!op->map || op->map->in_memory != MAP_ACTIVE) 2022 if (!op->map || op->map->state != MAP_ACTIVE)
1999 return 0; 2023 return 0;
2000 2024
2001 /* Sanity check: make sure dir is valid */ 2025 /* Sanity check: make sure dir is valid */
2002 if (dir < 0 || dir > 8) 2026 if (dir < 0 || dir > 8)
2003 { 2027 {
2159 op->invisible = 1000; 2183 op->invisible = 1000;
2160 /* the socket code flashes the player visible/invisible 2184 /* the socket code flashes the player visible/invisible
2161 * depending on the value of invisible, so we need to 2185 * depending on the value of invisible, so we need to
2162 * alternate it here for it to work correctly. 2186 * alternate it here for it to work correctly.
2163 */ 2187 */
2164 if (pticks & 2) 2188 if (server_tick & 2)
2165 op->invisible--; 2189 op->invisible--;
2166 } 2190 }
2167 else if (op->invisible && !(op->flag [FLAG_MAKE_INVIS])) 2191 else if (op->invisible && !(op->flag [FLAG_MAKE_INVIS]))
2168 { 2192 {
2169 if (!op->invisible--) 2193 if (!op->invisible--)
2658 if (will_kill_again) 2682 if (will_kill_again)
2659 { 2683 {
2660 object *force; 2684 object *force;
2661 int at; 2685 int at;
2662 2686
2663 force = get_archetype (FORCE_NAME); 2687 force = archetype::get (FORCE_NAME);
2664 /* 50 ticks should be enough time for the spell to abate */ 2688 /* 50 ticks should be enough time for the spell to abate */
2665 force->speed_left = -5.f; 2689 force->speed_left = -5.f;
2666 force->set_speed (0.1f); 2690 force->set_speed (0.1f);
2667 force->set_flag (FLAG_APPLIED); 2691 force->set_flag (FLAG_APPLIED);
2668 2692

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines