Add infos into target window
[ryzomcore.git] / ryzom / server / src / entities_game_service / entity_matrix.cpp
blob1af3f3992a8689c10b795fe01e791260f4fd771f
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "stdpch.h"
20 #include "entity_matrix.h"
22 // static data
23 std::vector<CEntityMatrixPatternSymetrical*> CEntityMatrixPatternSymetrical::_DiscPatterns;
26 //--------------------------------------------------------------------------
27 // DATA TABLES FOR ENTITY MATRIX
28 //--------------------------------------------------------------------------
30 // a series of tables giving the minimum iterator table forms for entity matrix iterators for all sizes up to 127m
31 static uint32 EntityMatrixDiscTbl0[] = { 3, 3, 3};
32 static uint32 EntityMatrixDiscTbl16[] = { 3, 5, 5, 5, 3};
33 static uint32 EntityMatrixDiscTbl23[] = { 5, 5, 5, 5, 5};
34 static uint32 EntityMatrixDiscTbl32[] = { 3, 5, 7, 7, 7, 5, 3};
35 static uint32 EntityMatrixDiscTbl36[] = { 5, 7, 7, 7, 7, 7, 5};
36 static uint32 EntityMatrixDiscTbl46[] = { 7, 7, 7, 7, 7, 7, 7};
37 static uint32 EntityMatrixDiscTbl48[] = { 3, 7, 7, 9, 9, 9, 7, 7, 3};
38 static uint32 EntityMatrixDiscTbl51[] = { 5, 7, 9, 9, 9, 9, 9, 7, 5};
39 static uint32 EntityMatrixDiscTbl58[] = { 7, 9, 9, 9, 9, 9, 9, 9, 7};
40 static uint32 EntityMatrixDiscTbl64[] = { 3, 7, 9, 9, 11, 11, 11, 9, 9, 7, 3};
41 static uint32 EntityMatrixDiscTbl66[] = { 5, 7, 9, 11, 11, 11, 11, 11, 9, 7, 5};
42 static uint32 EntityMatrixDiscTbl68[] = { 5, 9, 9, 11, 11, 11, 11, 11, 9, 9, 5};
43 static uint32 EntityMatrixDiscTbl72[] = { 7, 9, 11, 11, 11, 11, 11, 11, 11, 9, 7};
44 static uint32 EntityMatrixDiscTbl80[] = { 3, 9, 11, 11, 11, 13, 13, 13, 11, 11, 11, 9, 3};
45 static uint32 EntityMatrixDiscTbl82[] = { 5, 9, 11, 11, 13, 13, 13, 13, 13, 11, 11, 9, 5};
46 static uint32 EntityMatrixDiscTbl87[] = { 7, 9, 11, 13, 13, 13, 13, 13, 13, 13, 11, 9, 7};
47 static uint32 EntityMatrixDiscTbl91[] = { 7, 11, 11, 13, 13, 13, 13, 13, 13, 13, 11, 11, 7};
48 static uint32 EntityMatrixDiscTbl94[] = { 9, 11, 13, 13, 13, 13, 13, 13, 13, 13, 13, 11, 9};
49 static uint32 EntityMatrixDiscTbl96[] = { 3, 9, 11, 13, 13, 13, 15, 15, 15, 13, 13, 13, 11, 9, 3};
50 static uint32 EntityMatrixDiscTbl98[] = { 5, 9, 11, 13, 13, 15, 15, 15, 15, 15, 13, 13, 11, 9, 5};
51 static uint32 EntityMatrixDiscTbl102[] = { 7, 9, 11, 13, 15, 15, 15, 15, 15, 15, 15, 13, 11, 9, 7};
52 static uint32 EntityMatrixDiscTbl103[] = { 7, 11, 13, 13, 15, 15, 15, 15, 15, 15, 15, 13, 13, 11, 7};
53 static uint32 EntityMatrixDiscTbl108[] = { 9, 11, 13, 15, 15, 15, 15, 15, 15, 15, 15, 15, 13, 11, 9};
54 static uint32 EntityMatrixDiscTbl112[] = { 3, 9, 11, 13, 15, 15, 15, 17, 17, 17, 15, 15, 15, 13, 11, 9, 3};
55 static uint32 EntityMatrixDiscTbl114[] = { 5, 9, 13, 13, 15, 15, 17, 17, 17, 17, 17, 15, 15, 13, 13, 9, 5};
56 static uint32 EntityMatrixDiscTbl116[] = { 5, 11, 13, 15, 15, 15, 17, 17, 17, 17, 17, 15, 15, 15, 13, 11, 5};
57 static uint32 EntityMatrixDiscTbl117[] = { 7, 11, 13, 15, 15, 17, 17, 17, 17, 17, 17, 17, 15, 15, 13, 11, 7};
58 static uint32 EntityMatrixDiscTbl122[] = { 9, 11, 13, 15, 17, 17, 17, 17, 17, 17, 17, 17, 17, 15, 13, 11, 9};
59 static uint32 EntityMatrixDiscTbl125[] = { 9, 13, 15, 15, 17, 17, 17, 17, 17, 17, 17, 17, 17, 15, 15, 13, 9};
61 // a few larger special case matrices
62 static uint32 EntityMatrixDiscTblUpTo150[] = { 7, 11, 15, 17, 17, 19, 19, 21, 21, 21, 21, 21, 21, 21, 19, 19, 17, 17, 15, 11, 7};
63 static uint32 EntityMatrixDiscTblUpTo200[] = { 9, 13, 17, 19, 21, 23, 23, 25, 25, 27, 27, 27, 27, 27, 27, 27, 27, 27, 25, 25, 23, 23, 21, 19, 17, 13, 9};
64 static uint32 EntityMatrixDiscTblUpTo250[] = {11, 15, 19, 23, 25, 27, 27, 29, 29, 31, 31, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 31, 31, 29, 29, 27, 27, 25, 23, 19, 15, 11};
66 void CEntityMatrixPatternSymetrical::initMatrixPatterns()
68 // initialise the vectors with the first tables
69 _DiscPatterns.push_back(new CEntityMatrixPatternSymetrical(&(EntityMatrixDiscTbl0[0]),3));
71 // local macros undefined at end of function
72 #define ADD_TBL(d) \
73 { \
74 while (_DiscPatterns.size()<d) \
75 _DiscPatterns.push_back(_DiscPatterns[_DiscPatterns.size()-1]); \
76 _DiscPatterns.push_back(new CEntityMatrixPatternSymetrical(EntityMatrixDiscTbl##d,sizeof(EntityMatrixDiscTbl##d)/sizeof(EntityMatrixDiscTbl##d[0]))); \
80 // setup the disc tables ...
81 ADD_TBL(16) ADD_TBL(23)
82 ADD_TBL(32) ADD_TBL(36) ADD_TBL(46)
83 ADD_TBL(48) ADD_TBL(51) ADD_TBL(58)
84 ADD_TBL(64) ADD_TBL(66) ADD_TBL(68) ADD_TBL(72)
85 ADD_TBL(80) ADD_TBL(82) ADD_TBL(87) ADD_TBL(91) ADD_TBL(94)
86 ADD_TBL(96) ADD_TBL(98) ADD_TBL(102) ADD_TBL(103) ADD_TBL(108)
87 ADD_TBL(112) ADD_TBL(114) ADD_TBL(116) ADD_TBL(117) ADD_TBL(122) ADD_TBL(125)
89 #undef ADD_TBL