before:
#include "hash_manager.h"
int ChashManager::calculate_hash(float x, float y)
{
if( ((x >= 4.0f)||(x < 0.0f)) || ((y >= 4.0f)||(y < 0.0f)) )
{
return 0xFFFF;
}
else
{
return ( ((int)y*4) + (int)x); //TO DO: how do i control hash size???
}
}
int ChashManager::getbin(vector2f position, vector2f offset, vector2f corner, vector2f camera)
{
vector2f temp;
temp = position + offset + corner;
temp = temp - camera; //collapse to camera space
return calculate_hash(temp.x, temp.y);
}
void ChashManager::flush()
{
hashbucket_.clear();
objectindex_.clear();
}
void ChashManager::add(int id, Chitbox phitbox, vector2f position, vector2f camera)
{
//main loop for every available hitbox in hitbox collection
for(std::vector<circle2f>::size_type i = 0; i < phitbox.collection.size(); i++)
{
//phitbox.collection[i].r
Sbox box();
}
}
void addtomap(int id, Sbox box)
{
if( box.box_min == 0xffff && box.box_max == 0xffff && box.box_lt == 0xffff && box.box_rb == 0xffff )
{
return; // out of scene
}
int ymod = 0;
int xspread = box.box_rb - box.box_min;
int yspread = (box.box_max - box.box_rb)/4;
for(int y = 0; y <= yspread; y++)
{
for(int x = box.box_min; x <= (xspread + box.box_min); x++)
{
//p_ent->hitbox.binlist.push_back(ymod + x);//bin number here is (ymod+x)
}
ymod += 4;
}
}
void delimit_box(Sbox &box)
{
//lt, max
//min, rb
if( box.box_min == 0xffff && box.box_max == 0xffff && box.box_lt == 0xffff && box.box_rb == 0xffff )
{
return; // out of scene
}
//first scenario - min is Oxffff (object in lower left corner)
if((box.box_min == 0xffff) && (box.box_max != 0xffff))
{
if( box.box_lt == 0xffff && box.box_rb == 0xffff )
{
box.box_rb = box.box_max%4;
box.box_lt = 4*(box.box_max/4);
box.box_min = 0;
}
else if( box.box_lt != 0xffff && box.box_rb == 0xffff )
{
box.box_min = box.box_lt%4;
box.box_rb = box.box_max%4;
}
else if( box.box_lt == 0xffff && box.box_rb != 0xffff )
{
box.box_lt = 4*(box.box_max/4);
box.box_min = 4*(box.box_rb/4);
}
}
//second scenario- max is 0xffff (object in upper right corner)
else if ( (box.box_min != 0xffff) && (box.box_max == 0xffff) )
{
if( box.box_lt == 0xffff && box.box_rb == 0xffff )
{
box.box_max = 15;
box.box_lt = (box.box_min%4)+12;
box.box_rb = (((box.box_min/4)+1)*4)-1;
}
else if( box.box_lt != 0xffff && box.box_rb == 0xffff )
{
box.box_max = (((box.box_lt/4)+1)*4)-1;
box.box_rb = (((box.box_min/4)+1)*4)-1;
}
else if( box.box_lt == 0xffff && box.box_rb != 0xffff )
{
box.box_max = 12+(box.box_rb%4);
box.box_lt = 12+(box.box_min%4);
}
}
//second scenario- max and min is 0xffff (object in upper right/lower left corner)
else if ( (box.box_min == 0xffff) && (box.box_max == 0xffff) )
{
if(box.box_rb == 0xffff)
{
box.box_max = (((box.box_lt/4)+1)*4)-1;
box.box_min = box.box_lt%4;
box.box_rb = 3;
}
else
{
box.box_lt = 12;
box.box_max = 12+(box.box_rb%4);
box.box_min = 4*(box.box_rb/4);
}
}
}
std::vector<int> ChashManager::getBinElements(int pid)
{
}
after:
#include "hash_manager.h"
int ChashManager::calculate_hash(float x, float y)
{
if( ((x >= 4.0f)||(x < 0.0f)) || ((y >= 4.0f)||(y < 0.0f)) )
{
return 0xFFFF;
}
else
{
return ( ((int)y*4) + (int)x); //TO DO: how do i control hash size???
}
}
int ChashManager::getbin(vector2f position, vector2f offset, vector2f corner, vector2f camera)
{
vector2f temp;
temp = position + offset + corner;
temp = temp - camera; //collapse to camera space
temp = temp - camera; //collapse to camera space
return calculate_hash(temp.x, temp.y);
}
void ChashManager::flush()
{
hashbucket_.clear();
objectindex_.clear();
}
void ChashManager::add(int id, Chitbox phitbox, vector2f position, vector2f camera)
{
//main loop for every available hitbox in hitbox collection
for(std::vector<circle2f>::size_type i = 0; i < phitbox.collection.size(); i++)
{
//phitbox.collection[i].r
Sbox box();
}
}
void addtomap(int id, Sbox box)
{
if( box.box_min == 0xffff && box.box_max == 0xffff && box.box_lt == 0xffff && box.box_rb == 0xffff )
{
return; // out of scene
}
{
int ymod = 0;
int xspread = box.box_rb - box.box_min;
int yspread = (box.box_max - box.box_rb)/4;
for(int y = 0; y <= yspread; y++)
{
for(int x = box.box_min; x <= (xspread + box.box_min); x++)
{
//p_ent->hitbox.binlist.push_back(ymod + x);//bin number here is (ymod+x)
}
ymod += 4;
}
}
void delimit_box(Sbox &box)
{
//lt, max
//min, rb
int yspread = (box.box_max - box.box_rb)/4;
if( box.box_min == 0xffff && box.box_max == 0xffff && box.box_lt == 0xffff && box.box_rb == 0xffff )
{
return; // out of scene
}
for(int y = 0; y <= yspread; y++)
//first scenario - min is Oxffff (object in lower left corner)
if((box.box_min == 0xffff) && (box.box_max != 0xffff))
{
if( box.box_lt == 0xffff && box.box_rb == 0xffff )
{
box.box_rb = box.box_max%4;
box.box_lt = 4*(box.box_max/4);
box.box_min = 0;
}
else if( box.box_lt != 0xffff && box.box_rb == 0xffff )
{
box.box_min = box.box_lt%4;
box.box_rb = box.box_max%4;
}
else if( box.box_lt == 0xffff && box.box_rb != 0xffff )
{
box.box_lt = 4*(box.box_max/4);
box.box_min = 4*(box.box_rb/4);
}
}
//second scenario- max is 0xffff (object in upper right corner)
else if ( (box.box_min != 0xffff) && (box.box_max == 0xffff) )
{
if( box.box_lt == 0xffff && box.box_rb == 0xffff )
{
box.box_max = 15;
box.box_lt = (box.box_min%4)+12;
box.box_rb = (((box.box_min/4)+1)*4)-1;
}
else if( box.box_lt != 0xffff && box.box_rb == 0xffff )
{
box.box_max = (((box.box_lt/4)+1)*4)-1;
box.box_rb = (((box.box_min/4)+1)*4)-1;
}
else if( box.box_lt == 0xffff && box.box_rb != 0xffff )
{
box.box_max = 12+(box.box_rb%4);
box.box_lt = 12+(box.box_min%4);
}
}
//second scenario- max and min is 0xffff (object in upper right/lower left corner)
else if ( (box.box_min == 0xffff) && (box.box_max == 0xffff) )
{
if(box.box_rb == 0xffff)
{
box.box_max = (((box.box_lt/4)+1)*4)-1;
box.box_min = box.box_lt%4;
box.box_rb = 3;
}
else
{
box.box_lt = 12;
box.box_max = 12+(box.box_rb%4);
box.box_min = 4*(box.box_rb/4);
}
}
}
for(int x = box.box_min; x <= (xspread + box.box_min); x++)
std::vector<int> ChashManager::getBinElements(int pid)
{
//p_ent->hitbox.binlist.push_back(ymod + x);//bin number here is (ymod+x)
}
}
as you can see, astyle formatting things is out of whack for me, there is some code duplication going on in the getbin method, and right near the end its copying code from somewhere else.
this is using nightly 9781 in windows 7 64bit
Is there a problem with auto-completion?
I am using svn9793 on debian testing (64-bit) and as soon as I complete <stdio it stops drop down listbox and I have to press Ctrl-space to auto-complete it.
Another thing I have noticed is that under a C project if you use C99 syntax for structures and press "dot" to get a member, instead of getting the name of a desired member, you only get C++ keywords.
Is it possible for the parser to search only for C data members, reserved keywords, and such?
Thank you.
You mean:
http://www.dribin.org/dave/blog/archives/2010/05/15/c99_syntax/
NSPoint point = { .x = 0, .y = 0};
?
1, we should know it is an initialization statement.
2, we are after the dot.
3, we are in a C file, but we have C99 option enabled.
The hardest part is 1. How do we locate that we are in an C stile initialization? Currently, CC only remember the "{}" pair for function bodies and class definition.
svn9817 compiled with GCC 4.9.0 on Debian testing (64-bit) had just crashed while typing a macro in C.
I presume it has something to do with the parser, because it would not let me include any structure member while pressing dot or Ctrl-Space. I have reparsed it and still nothing.
<?xml version="1.0" encoding="utf-8"?>
<report version="1.0" kind="exception">
<system description="Linux 3.14-1-amd64 x86_64"/>
...
... [ deleted unnecessary modules to save space ]
...
<stack>
<frame level="0"/>
<frame level="1" function="wxsResourceTree::InvalidateItemData(wxsResourceTreeItemData*)" offset="00000010"/>
<frame level="2" function="wxsResourceTreeItemData::~wxsResourceTreeItemData()" offset="00000036"/>
<frame level="3"/>
<frame level="4"/>
<frame level="5" function="wxGenericTreeItem::~wxGenericTreeItem()" offset="00000016"/>
<frame level="6" function="wxGenericTreeItem::DeleteChildren(wxGenericTreeCtrl*)" offset="0000002d"/>
<frame level="7" function="wxGenericTreeCtrl::Delete(wxTreeItemId const&)" offset="00000106"/>
<frame level="8" function="wxGenericTreeCtrl::DeleteAllItems()" offset="00000023"/>
<frame level="9" function="wxGenericTreeCtrl::~wxGenericTreeCtrl()" offset="00000050"/>
<frame level="10" function="wxTreeCtrl::~wxTreeCtrl()" offset="00000043"/>
<frame level="11" function="wxsResourceTree::~wxsResourceTree()" offset="00000061"/>
<frame level="12" function="wxsResourceTree::~wxsResourceTree()" offset="00000018"/>
<frame level="13" function="wxWindowBase::DestroyChildren()" offset="00000026"/>
<frame level="14" function="wxWindow::~wxWindow()" offset="00000062"/>
<frame level="15" function="wxPanel::~wxPanel()" offset="00000009"/>
<frame level="16" function="wxWindowBase::DestroyChildren()" offset="00000026"/>
<frame level="17" function="wxWindow::~wxWindow()" offset="00000062"/>
<frame level="18" function="wxSplitterWindow::~wxSplitterWindow()" offset="00000009"/>
<frame level="19" function="wxWindowBase::DestroyChildren()" offset="00000026"/>
<frame level="20" function="wxWindow::~wxWindow()" offset="00000062"/>
<frame level="21" function="wxsStoringSplitterWindow::~wxsStoringSplitterWindow()" offset="0000002a"/>
<frame level="22" function="wxsStoringSplitterWindow::~wxsStoringSplitterWindow()" offset="00000018"/>
<frame level="23" function="wxWindowBase::Destroy()" offset="0000000f"/>
<frame level="24" function="wxAuiNotebook::DeletePage(unsigned long)" offset="000000b4"/>
<frame level="25" function="wxAuiNotebook::~wxAuiNotebook()" offset="00000032"/>
<frame level="26" function="cbAuiNotebook::~cbAuiNotebook()" offset="00000053"/>
<frame level="27" function="cbAuiNotebook::~cbAuiNotebook()" offset="00000018"/>
<frame level="28" function="wxWindowBase::DestroyChildren()" offset="00000026"/>
<frame level="29" function="wxWindow::~wxWindow()" offset="00000062"/>
<frame level="30" function="MainFrame::~MainFrame()" offset="00000000" file="/home/stefanos/svn_code/CodeBlocks/src/src/main.cpp" line="660"/>
<frame level="31" function="MainFrame::~MainFrame()" offset="00000000" file="/home/stefanos/svn_code/CodeBlocks/src/src/main.cpp" line="660"/>
<frame level="32" function="wxAppBase::CleanUp()" offset="00000036"/>
<frame level="33" function="wxEntryCleanup()" offset="00000050"/>
</stack>
</report>
About crashing issue: Can anyone with svn9817 try to create a macro like
#define arrsize(array) (sizeof(array) / sizeof(array[0]) )
and let me know if it crashes on insertion of the first parenthesis (?
UPDATE: I ran it with GDB and got the following line upon repeating the aforementioned procedure:
0x00007fffe553605e in wxsResourceTree::InvalidateItemData (this=0x0, ItemData=0x49b6b50) at wxsresourcetree.cpp:212
212 if ( m_Data == ItemData )
Yeah jens, I know. I have created the packages and the issue remains the same. I am repeating the steps as I am typing this message to make sure it's not my fault.
UPDATE: Yep, the issue remains the same. Can someone update to latest HEAD revision, compile it, and try a #define something() macro to see whether it crashes on first parenthesis or not?
UPDATE #2: Now that I have compiled .deb packages myself and managed to reproduce the crash, gdb reports the following:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff58c0880 in wxMutex::Lock() () from /usr/lib/x86_64-linux-gnu/libwx_baseu-2.8.so.0