|
I found a book called game programming gems that contains a whole set of AI to find those paths.
You may be able to find something on the internet or one of the game programming sites that has a code sample that will do this for you.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Is there a way to get the same effect as TRACE in debug mode but in release mode. I have a program that can trap the messages, I just need to know how to send those messages. It seems that AfxTrace and AtlTrace both disapear in release build.
Thanks,
Clint
|
|
|
|
|
clintsinger wrote:
AfxTrace and AtlTrace both disapear in release build
This is by design. Use OutputDebugString()
John
|
|
|
|
|
|
|
I have a custom control but it doesn't get any mouse messages. I had the same problem with a static control and someone told me to check Notify and that fixed it.
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
Have you subclassed a static control to make your custom control? If so, then the following code (I copied it out of MSDN) may help:
DWORD dwStyle = ::SetWindowLong(m_hWnd, GWL_STYLE);
if (!(dwStyle & SS_NOTIFY)) {
::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | SS_NOTIFY);
}
"The laws of nature, the laws of man
This volatile paradox will never stand"
-Plasticity, Front Line Assembly
|
|
|
|
|
The SS_NOFIFY is a static control style. This one is just derived from CWnd. Any other ideas?
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
If you use spy++ on your control window does it receive mouse messages?
"The laws of nature, the laws of man
This volatile paradox will never stand"
-Plasticity, Front Line Assembly
|
|
|
|
|
no
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
UINT CClass::OnNcHitTest(CPoint point)
{
return HTCLIENT;
//return CClass::OnNcHitTest(point);
}
i used this in a CStatic subclass, now u can just keep a look out for those mouse messages
hope this works.
|
|
|
|
|
Thanks!
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
Hi everyone,
i tried to use the multimap(STL) but I got an error "fatal error: Cannot open include file: 'multimap' C++" I already installed the all the files that I got from sgi... STL Version 3.3, I installed it in "C:\Program Files\Microsoft Visual Studio\VC98\Include"
Here's my code:
#include <string>
#include <iostream>
#include <multimap>
using namespace std;
struct ltstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;
}
};
int main()
{
multimap<const char*,="" int,="" ltstr=""> m;
m.insert(pair<const char*="" const,="" int="">("a", 1));
m.insert(pair<const char*="" const,="" int="">("c", 2));
m.insert(pair<const char*="" const,="" int="">("b", 3));
m.insert(pair<const char*="" const,="" int="">("b", 4));
m.insert(pair<const char*="" const,="" int="">("a", 5));
m.insert(pair<const char*="" const,="" int="">("b", 6));
cout << "Number of elements with key a: " << m.count("a") << endl;
cout << "Number of elements with key b: " << m.count("b") << endl;
cout << "Number of elements with key c: " << m.count("c") << endl;
cout << "Elements in m: " << endl;
for (multimap<const char*,="" int,="" ltstr="">::iterator it = m.begin();
it != m.end();
++it)
cout << " [" << (*it).first << ", " << (*it).second << "]" << endl;
}
What could be the problem?
Thanks/Regards
Sidney
|
|
|
|
|
Use #include <map> instead.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I used the #include <map> and I got 14 WARNINGS to many to enumarate it here
but <map> is for map only right? or is it the same file that I shall include if I used multimap?
here's my code after I changed it to <map>:
#include <string>
#include <iostream>
#include <map>
using namespace std;
struct ltstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;
}
};
int main()
{
multimap<const char*, int, ltstr> m;
m.insert(pair<const char* const, int>("a", 1));
m.insert(pair<const char* const, int>("c", 2));
m.insert(pair<const char* const, int>("b", 3));
m.insert(pair<const char* const, int>("b", 4));
m.insert(pair<const char* const, int>("a", 5));
m.insert(pair<const char* const, int>("b", 6));
cout << "Number of elements with key a: " << m.count("a") << endl;
cout << "Number of elements with key b: " << m.count("b") << endl;
cout << "Number of elements with key c: " << m.count("c") << endl;
cout << "Elements in m: " << endl;
for (multimap<const char*, int, ltstr>::iterator it = m.begin();
it != m.end();
++it)
cout << " [" << (*it).first << ", " << (*it).second << "]" << endl;
}
Thanks/Regards
Sidney
|
|
|
|
|
There is a known issue with VC6 sucking that means you will get warnings unless you #pragma them away. The problem is VC, not STL.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
A bug? humm... MS is bad did you try running the simple code which used multipam? I need the multimap to work co'z the cannot accomodate my data criteria... can you try running it?
Thanks/Regards
Sidney
|
|
|
|
|
I didn't notice before - using namespace std is BAD. Put using decalrations only for the bits of the namespace you need.
Apart from that the code runs fine except it has exactly the warning I anticipated seeing.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Christian Thank you very much!! now the multimap works great The warnings are all gone hehehehe! I used an STL.h that I got from a friend. Thank you very much everyone!!!
Thanks/Regards
Sidney
|
|
|
|
|
I was wondering..do you have to call RemoveAll on the destructor of your CStringArray or CMaps and other collections or do the destructors take care of everything automatically.
I have always maintained this practice since I took an MFC course a couple of years back, but I wasn't 100% sure if this is actually necessary? If it is, then why? shouldn't the destructors take care of everything?
|
|
|
|
|
the destructors will call RemoveAll (or equivalent).
-c
Cheap oil. It's worth it!
|
|
|
|
|
I have an SDI MFC application, and I use OnPaint() to draw something to my view. Since my view is updated very frequently, (less than 1 second), I am thinking of using memory DC to reduce the flickering. I tried this:
{
CPaintDC dc(this);
CDC memDc;
memDc.CreateCompatibleDC(&dc);
dc.BitBlt(0,
0,
displayWidth,
displayHeight,
&memDc,
0,
0,
SRCCOPY);
memDc.DeleteDC();
}
but there is nothing on the display. The MSDN document said that I should select a bitmap to my memDc. I did so with a dummy blank bitmap resource I created using resource editor. After I select it to the memDc, there will only be the dummy bitmap displayed on my screen. How could I get my drawing displayed?
|
|
|
|
|
you need to create a compatible bitmap and select it into the memDc before you draw to memDc.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Thank you for your fast help. Now I got my drawing dislayed on the monitor, but the background is totally black. And it flickers even worse. what could be wrong?
|
|
|
|
|
let me try OnEraseBkGround.
|
|
|
|