@@ -47,7 +47,7 @@ template<> struct LastListItem<Mob> {
4747 unsigned char last_see_invisible = 0 ;
4848};
4949
50- template <class Atom , unsigned char update_chunk_id, bool includes_loc = true , bool includes_stepxy = true , bool includes_mobextras = false >
50+ template <typename Atom, unsigned char update_chunk_id, bool includes_loc = true , bool includes_stepxy = true , bool includes_mobextras = false >
5151class AtomUpdateBuffer {
5252private:
5353 int dirty_floor = 0 ;
@@ -284,18 +284,23 @@ class AtomUpdateBuffer {
284284 }
285285};
286286
287+ template <>
287288inline int AtomUpdateBuffer<Turf, 0x2 , false , false , false >::get_table_length() {
288289 return Core::turf_table->turf_count ;
289290}
291+ template <>
290292inline int AtomUpdateBuffer<Obj, 0x3 , true , true , false >::get_table_length() {
291293 return Core::obj_table->length ;
292294}
295+ template <>
293296inline int AtomUpdateBuffer<Mob, 0x4 , true , true , true >::get_table_length() {
294297 return Core::mob_table->length ;
295298}
299+ template <>
296300inline int AtomUpdateBuffer<ImageOverlay, 0x5 , true , false , false >::get_table_length() {
297301 return Core::image_table->length ;
298302}
303+ template <>
299304inline Turf *AtomUpdateBuffer<Turf, 0x2 , false , false , false >::get_element(int id) {
300305 if (id < Core::turf_table->turf_count || Core::turf_table->existence_table [id] == 0 ) {
301306 return nullptr ;
@@ -306,30 +311,38 @@ inline Turf *AtomUpdateBuffer<Turf, 0x2, false, false, false>::get_element(int i
306311 }
307312 return ref;
308313}
314+ template <>
309315inline Obj* AtomUpdateBuffer<Obj, 0x3 , true , true , false >::get_element(int id) {
310316 return id < Core::obj_table->length ? Core::obj_table->elements [id] : nullptr ;
311317}
318+ template <>
312319inline Mob* AtomUpdateBuffer<Mob, 0x4 , true , true , true >::get_element(int id) {
313320 return id < Core::mob_table->length ? Core::mob_table->elements [id] : nullptr ;
314321}
322+ template <>
315323inline ImageOverlay* AtomUpdateBuffer<ImageOverlay, 0x5 , true , false , false >::get_element(int id) {
316324 return id < Core::image_table->length ? Core::image_table->elements [id] : nullptr ;
317325}
326+ template <>
318327inline int AtomUpdateBuffer<Turf, 0x2 , false , false , false >::get_appearance(Turf* turf, int id) {
319328 if (id >= Core::turf_table->turf_count ) return 0xFFFF ;
320329 int shared_id = Core::turf_table->shared_info_id_table [id];
321330 return (*Core::turf_shared_info_table)[shared_id]->appearance ;
322331}
332+ template <>
323333inline int AtomUpdateBuffer<Obj, 0x3 , true , true , false >::get_appearance(Obj* obj, int id) {
324334 return obj ? GetAppearance ({ OBJ, {id} }) : 0xFFFF ;
325335}
336+ template <>
326337inline int AtomUpdateBuffer<Mob, 0x4 , true , true , true >::get_appearance(Mob* mob, int id) {
327338 return mob ? GetAppearance ({ MOB, {id} }) : 0xFFFF ;
328339}
340+ template <>
329341inline bool AtomUpdateBuffer<Turf, 0x2 , false , false , false >::does_element_exist(int id) {
330342 return true ;
331343}
332344// Because image serves as both a temporary appearance holder and a per-client, let's only write it if it's going to serve the latter purpose
345+ template <>
333346inline int AtomUpdateBuffer<ImageOverlay, 0x5 , true , false , false >::get_appearance(ImageOverlay* image, int id) {
334347 return (image && image->loc .type != NULL_D) ? GetAppearance ({ IMAGE, {id} }) : 0xFFFF ;
335348}
0 commit comments