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 (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001 Mark Wedel |
6 | * Copyright (©) 2001 Mark Wedel |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
8 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * 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 |
10 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
77 | ix.idx = idx; |
78 | ix.idx = idx; |
78 | ix.ofs = size; |
79 | ix.ofs = size; |
79 | ix.data = (uint8 *)data; |
80 | ix.data = (uint8 *)data; |
80 | ix.data_sv = SvREFCNT_inc (data_sv); |
81 | ix.data_sv = SvREFCNT_inc (data_sv); |
81 | |
82 | |
82 | auto (pos, ixface.end ()); |
83 | auto pos = ixface.end (); |
83 | |
84 | |
84 | // the by far most common case will be to insert |
85 | // the by far most common case will be to insert |
85 | // near the end, so little looping. |
86 | // near the end, so little looping. |
86 | while (pos != ixface.begin ()) |
87 | while (pos != ixface.begin ()) |
87 | { |
88 | { |
… | |
… | |
96 | } |
97 | } |
97 | |
98 | |
98 | ixface.insert (pos, ix); |
99 | ixface.insert (pos, ix); |
99 | |
100 | |
100 | #if 0 |
101 | #if 0 |
101 | for (auto (i, ixface.begin ()); i != ixface.end (); ++i) |
102 | for (auto &&i : ixface) |
102 | fprintf (stderr, "<%d,%d> ", i->pri, i->ofs); |
103 | fprintf (stderr, "<%d,%d> ", i.pri, i.ofs); |
103 | fprintf (stderr, "\n"); |
104 | fprintf (stderr, "\n"); |
104 | #endif |
105 | #endif |
105 | } |
106 | } |
106 | |
107 | |
107 | void |
108 | void |
… | |
… | |
257 | } |
258 | } |
258 | |
259 | |
259 | void |
260 | void |
260 | client::invalidate_face (faceidx idx) |
261 | client::invalidate_face (faceidx idx) |
261 | { |
262 | { |
|
|
263 | if (!faces_sent [idx]) |
|
|
264 | return; |
|
|
265 | |
262 | faces_sent [idx] = false; |
266 | faces_sent [idx] = false; |
263 | force_newmap = true; |
267 | send_face (idx); |
|
|
268 | //TODO: check for active ix and abort it. |
264 | } |
269 | } |
265 | |
270 | |
266 | void |
271 | void |
267 | client::invalidate_all_faces () |
272 | client::invalidate_all_faces () |
268 | { |
273 | { |
269 | faces_sent.reset (); |
274 | for (faceidx i = 0; i < faces_sent.size (); ++i) |
270 | force_newmap = true; |
275 | invalidate_face (i); |
271 | } |
276 | } |
272 | |
277 | |