ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/cfperl.h
(Generate patch)

Comparing deliantra/server/include/cfperl.h (file contents):
Revision 1.129 by root, Wed Nov 16 23:42:00 2016 UTC vs.
Revision 1.133 by root, Wed Dec 5 19:13:21 2018 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 (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 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 * 6 *
6 * Deliantra is free software: you can redistribute it and/or modify it under 7 * 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 8 * 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 9 * Free Software Foundation, either version 3 of the License, or (at your
130#endif 131#endif
131 132
132extern tstamp runtime; // virtual server time, excluding time jumps and lag 133extern tstamp runtime; // virtual server time, excluding time jumps and lag
133extern tstamp NOW; // real time of current server tick 134extern tstamp NOW; // real time of current server tick
134 135
135noinline utf8_string cfSvPVutf8_nolen (SV *sv); 136ecb_noinline utf8_string cfSvPVutf8_nolen (SV *sv);
136 137
137enum event_klass 138enum event_klass
138{ 139{
139 KLASS_NONE, 140 KLASS_NONE,
140 KLASS_GLOBAL, 141 KLASS_GLOBAL,
171#define ARG_CLIENT(o) DT_CLIENT, (void *)(static_cast<client *> (o)) 172#define ARG_CLIENT(o) DT_CLIENT, (void *)(static_cast<client *> (o))
172#define ARG_PARTY(o) DT_PARTY , (void *)(static_cast<party *> (o)) 173#define ARG_PARTY(o) DT_PARTY , (void *)(static_cast<party *> (o))
173#define ARG_REGION(o) DT_REGION, (void *)(static_cast<region *> (o)) 174#define ARG_REGION(o) DT_REGION, (void *)(static_cast<region *> (o))
174 175
175// the ", ## __VA_ARGS" is, unfortunately, a gnu-cpp extension 176// the ", ## __VA_ARGS" is, unfortunately, a gnu-cpp extension
176#define INVOKE(obj,event, ...) (expect_false ((obj)->should_invoke (event)) ? (obj)->invoke (event, ## __VA_ARGS__, DT_END) : 0) 177#define INVOKE(obj,event, ...) (ecb_expect_false ((obj)->should_invoke (event)) ? (obj)->invoke (event, ## __VA_ARGS__, DT_END) : 0)
177#define INVOKE_GLOBAL(event, ...) INVOKE (&gbl_ev, EVENT_ ## GLOBAL ## _ ## event, ## __VA_ARGS__) 178#define INVOKE_GLOBAL(event, ...) INVOKE (&gbl_ev, EVENT_ ## GLOBAL ## _ ## event, ## __VA_ARGS__)
178#define INVOKE_ATTACHABLE(event, obj, ...) INVOKE (obj , EVENT_ ## ATTACHABLE ## _ ## event, ## __VA_ARGS__) 179#define INVOKE_ATTACHABLE(event, obj, ...) INVOKE (obj , EVENT_ ## ATTACHABLE ## _ ## event, ## __VA_ARGS__)
179#define INVOKE_OBJECT(event, obj, ...) INVOKE (obj , EVENT_ ## OBJECT ## _ ## event, ## __VA_ARGS__) 180#define INVOKE_OBJECT(event, obj, ...) INVOKE (obj , EVENT_ ## OBJECT ## _ ## event, ## __VA_ARGS__)
180#define INVOKE_CLIENT(event, obj, ...) INVOKE (obj , EVENT_ ## CLIENT ## _ ## event, ## __VA_ARGS__) 181#define INVOKE_CLIENT(event, obj, ...) INVOKE (obj , EVENT_ ## CLIENT ## _ ## event, ## __VA_ARGS__)
181#define INVOKE_PLAYER(event, obj, ...) INVOKE (obj , EVENT_ ## PLAYER ## _ ## event, ## __VA_ARGS__) 182#define INVOKE_PLAYER(event, obj, ...) INVOKE (obj , EVENT_ ## PLAYER ## _ ## event, ## __VA_ARGS__)
206 MTH static void check_mortals (); 207 MTH static void check_mortals ();
207 208
208 // object is delete'd after the refcount reaches 0 209 // object is delete'd after the refcount reaches 0
209 MTH int refcnt_cnt () const; 210 MTH int refcnt_cnt () const;
210 // check wether the object has died and destroy 211 // check wether the object has died and destroy
211 MTH void refcnt_chk () { if (expect_false (refcnt <= 0)) do_check (); } 212 MTH void refcnt_chk () { if (ecb_expect_false (refcnt <= 0)) do_check (); }
212 213
213 // destroy the object unless it was already destroyed 214 // destroy the object unless it was already destroyed
214 // this politely asks everybody interested the reduce 215 // this politely asks everybody interested the reduce
215 // the refcount to 0 as soon as possible. 216 // the refcount to 0 as soon as possible.
216 MTH void destroy (); 217 MTH void destroy ();
265 bool should_invoke (event_type event) 266 bool should_invoke (event_type event)
266 { 267 {
267 return ev_want_event [event] || cb; 268 return ev_want_event [event] || cb;
268 } 269 }
269 270
270 bool invoke (event_type event, ...); 271 bool invoke (/*event_type*/int event, ...);
271 272
272 MTH void instantiate (); 273 MTH void instantiate ();
273 void reattach (); 274 void reattach ();
274 275
275protected: 276protected:
308 static void do_cede_to_tick (); 309 static void do_cede_to_tick ();
309 310
310 // actually cede's far more often 311 // actually cede's far more often
311 static bool cede_to_tick () 312 static bool cede_to_tick ()
312 { 313 {
313 if (expect_true (!cede_pending)) 314 if (ecb_expect_true (!cede_pending))
314 return false; 315 return false;
315 316
316 do_cede_to_tick (); 317 do_cede_to_tick ();
317 return true; 318 return true;
318 } 319 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines