radar2.diff

little more optimization - yricl, 10/02/2012 12:33 am

Download (1.9 kB)

b/code/nel/include/nel/misc/debug.h Tue Oct 02 00:20:51 2012 +0200
478 478

479 479
#endif // NL_NO_DEBUG
480 480

481
#	ifdef NL_OS_UNIX
482

483
#ifndef nllikely
484
#	define nllikely(expr) __builtin_expect(!!(expr), true)
485
#endif
486
#ifndef nlunlikely
487
#	define nlunlikely(expr) __builtin_expect(!!(expr), false)
488
#endif
489

490
#	else // NL_OS_UNIX
491

492
#ifndef nllikely
493
#	define nllikely(x) (x)
494
#endif
495
#ifndef nlunlikely
496
#	define nlunlikely(x) (x)
497
#endif
498

499
#	endif // NL_OS_UNIX
500

481 501
#define nlunreferenced(identifier) (identifier)
482 502

483 503
#define nlstop \
b/code/ryzom/client/src/interface_v3/view_radar.cpp Tue Oct 02 00:20:51 2012 +0200
142 142
	xyzRef.z = 0;
143 143
	mat.translate(-xyzRef);
144 144

145
	float	maxSqrRadius= (float)sqr(_WorldSize/2);
145
	const double maxSqrRadius= sqr(_WorldSize/2);
146 146

147
	for (sint32 i = 1; i < 256; ++i)
147
	for (uint i = 1; i < 256; ++i)
148 148
	{
149 149
		CEntityCL *entity = EntitiesMngr.entity(i);
150
		if (entity == NULL) continue;
150
		if (nlunlikely(entity == NULL))
151
			continue;
151 152

152 153
		// if the entity must not be shown in radar
153 154
		if(!entity->getDisplayInRadar())
......
156 157
		// get entity pos
157 158
		CVectorD xyz = entity->pos();
158 159

159
		xyz.z = 0;
160 160
		// if the distance is too big so do not display the entity
161 161
		if ((sqr(xyz.x - xyzRef.x)+sqr(xyz.y - xyzRef.y)) > maxSqrRadius) continue;
162
		xyz.z = 0;
162 163

163 164
		// Transform the dot
164 165
		xyz = mat * xyz;
165 166

166 167
		// Convert to screen
167
		sint32 x = OptFastFloor((float)xyz.x);
168
		sint32 y = OptFastFloor((float)xyz.y);
168
		const sint32 x = OptFastFloor((float)xyz.x);
169
		const sint32 y = OptFastFloor((float)xyz.y);
169 170

170 171
		CRGBA col = entity->getColor();
171 172