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,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * |
5 | * |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * the terms of the Affero GNU General Public License as published by the |
7 | * the terms of the Affero GNU General Public License as published by the |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * option) any later version. |
9 | * option) any later version. |
10 | * |
10 | * |
11 | * This program is distributed in the hope that it will be useful, |
11 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. |
14 | * GNU General Public License for more details. |
15 | * |
15 | * |
16 | * You should have received a copy of the Affero GNU General Public License |
16 | * You should have received a copy of the Affero GNU General Public License |
17 | * and the GNU General Public License along with this program. If not, see |
17 | * and the GNU General Public License along with this program. If not, see |
18 | * <http://www.gnu.org/licenses/>. |
18 | * <http://www.gnu.org/licenses/>. |
19 | * |
19 | * |
20 | * The authors can be reached via e-mail to <support@deliantra.net> |
20 | * The authors can be reached via e-mail to <support@deliantra.net> |
21 | */ |
21 | */ |
22 | |
22 | |
23 | /** |
23 | /** |
24 | * \file |
24 | * \file |
… | |
… | |
113 | } |
113 | } |
114 | |
114 | |
115 | void |
115 | void |
116 | client::tick () |
116 | client::tick () |
117 | { |
117 | { |
118 | if (!pl || destroyed ()) |
118 | if (destroyed ()) |
119 | return; |
119 | return; |
120 | |
120 | |
|
|
121 | if (pl) |
|
|
122 | { |
121 | pl->dirty = true; |
123 | pl->dirty = true; |
122 | |
124 | |
123 | /* Update the players stats once per tick. More efficient than |
125 | /* Update the players stats once per tick. More efficient than |
124 | * sending them whenever they change, and probably just as useful |
126 | * sending them whenever they change, and probably just as useful |
125 | */ |
127 | */ |
126 | pl->need_updated_stats (); |
128 | pl->need_updated_stats (); |
127 | esrv_update_stats (pl); |
129 | esrv_update_stats (pl); |
128 | |
130 | |
129 | if (pl->ns->update_spells) |
131 | if (pl->ns->update_spells) |
130 | esrv_update_spells (pl); |
132 | esrv_update_spells (pl); |
131 | |
133 | |
132 | sint32 weight = pl->ob->client_weight (); |
134 | sint32 weight = pl->ob->client_weight (); |
133 | |
135 | |
134 | if (last_weight != weight) |
136 | if (last_weight != weight) |
135 | { |
137 | { |
136 | pl->ob->update_stats (); |
138 | pl->ob->update_stats (); |
137 | esrv_update_item (UPD_WEIGHT, pl->ob, pl->ob); |
139 | esrv_update_item (UPD_WEIGHT, pl->ob, pl->ob); |
138 | } |
140 | } |
139 | |
141 | |
140 | draw_client_map (pl); |
142 | draw_client_map (pl); |
141 | |
143 | |
142 | if (update_look) |
144 | if (update_look) |
143 | esrv_draw_look (pl); |
145 | esrv_draw_look (pl); |
144 | |
146 | |
145 | mapinfo_queue_run (); |
147 | mapinfo_queue_run (); |
|
|
148 | } |
146 | |
149 | |
147 | #if HAVE_TCP_INFO |
150 | #if HAVE_TCP_INFO |
148 | // check time of last ack, and, if too old, kill connection |
151 | // check time of last ack, and, if too old, kill connection |
149 | socklen_t len = sizeof (tcpi); |
152 | socklen_t len = sizeof (tcpi); |
150 | |
153 | |