Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DaveKram

Pages: [1]
1
I would suggest you guys having trouble with generics read over something like this:

http://www.codeproject.com/Articles/257589/An-Idiots-Guide-to-Cplusplus-Templates-Part

Trying to just throw in generics into a class and seeing if it works, without really understanding the code you're writing is not a good idea.

If you read and understand what and how these work, all of the syntax and how awesome they can be will suddenly make sense. Take the time to learn about them first. Then implementing generics into a simple resource manager won't be very hard.

2
http://en.wikipedia.org/wiki/Template_%28C%2B%2B%29

Take a read up on templates/generics. It allows you essentially to write generic code that can work with many types. So you "hopefully" write once - with a tweak here or there - and then can pass in a multitude of different types.

So for your resource manager, you could build a generic class that handles resources, without having to make specific cases for load, for instance, based on type. It would just be one load, using generics/templates (code-wise)

Before just jumping into code though, I would take the time to read about generics and how to use them effectively.

3
Totally misread your post - sorry about that. But if you're looking into a universal resource manager that can load any type from SFML, I would look into using generics.

That way, you can write generic code to deal with a multitude of types.


4
Are you sure you aren't still running your executable? Getting a permission denied like that on the .exe seems like your process from a previous build is still running, and you can't write over/build the new exe because of that.

Check your computers running processes in Task Manager or something similar.

5
Network / Re: Debug Assertion Failure
« on: January 29, 2015, 05:44:58 am »
Sorry everyone, not really sure what happened. Reverted any changes I made while testing different things, downloaded the 32bit binaries again for VS2012 and just replaced the files.

Compile and run in debug mode, works just fine. Weirdest thing  ::)

6
Network / Solved - Debug Assertion Failure
« on: January 29, 2015, 02:42:12 am »
Solved - see my post below

Hello all,

Let me preface this with that I've done the looking around on the forums to see if I screwed up somewhere.

With recent code changes, I've been getting a debug assertion failure - I can't seem to determine if it's my code or some setting in the projects I have changed. It's very similar to this: http://en.sfml-dev.org/forums/index.php?topic=16539.msg118780#msg118780

Here's the debug assert failure:



So it's heap corruption, but I'm not sure from where.

Here's the call stack:

Quote
>   msvcr110d.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1424   C++
    msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1265   C++
    msvcr110d.dll!operator delete(void * pUserData) Line 54   C++
    Game.exe!std::allocator<std::_Container_proxy>::deallocate(std::_Container_proxy * _Ptr, unsigned int __formal) Line 586   C++
    Game.exe!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::_Free_proxy() Line 683   C++
    Game.exe!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >() Line 656   C++
    Game.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 965   C++
    Game.exe!NetworkManager::connect() Line 41   C++
    Game.exe!NetworkManager::changeServer(std::basic_string<char,std::char_traits<char>,std::allocator<char> > ipAddress) Line 65   C++
    Game.exe!Game::Game(NetworkManager * nm) Line 18   C++
    Game.exe!GameManager::setCurGameState(int state) Line 146   C++
    Game.exe!GameManager::init(sf::RenderWindow & windowReference) Line 40   C++
    Game.exe!main() Line 16   C++
    Game.exe!__tmainCRTStartup() Line 536   C
    Game.exe!mainCRTStartup() Line 377   C
    kernel32.dll!774c919f()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]   
    ntdll.dll!777a0bbb()   Unknown
    ntdll.dll!777a0b91()   Unknown

This is a networked application, so I have a server application as well and whenever a client connects - the same debug assert shows up on that application as well. They both break on calling an sf::IpAddress::toString().

Like in that thread above I linked, one of the solutions was to check your PATH variable for SFML references - I have no references to SFML in my path. I am using the Visual Studio 2012 SFML binaries (2.2 32bit) from the website and dynamically linking them in (they're all in the debug folder/or release depending what I'm building).

I am also using /MDd Multi-threaded Debug DLL for my Runtime Library option when compiling in debug mode (which I do most of the time) and /MD Multi-threaded DLL for Release.

Here's some example code where it breaks:

Quote
void NetworkManager::connect()
{
   remoteServerIP = refGameConfig->getValue("ServerIp");
   //Send data to connect
   sf::Packet packet;
   packet << __NETWORK_USER_CONNECTED;
   if (sendMessage(packet))
   {
      int data;
      packet >> data;
      std::cout << "Sent data to: " << remoteServerIP.toString() << ":" << UDPPort << " - Data: " << data << std::endl;
   }
}

If I remove any remoteServerIP.toString from my Game client - it runs without the debug assertion fail. This only recently has started to happen, and maybe I'm overlooking something/the corruption is somewhere else entirely.

If anyone can help point me in a direction, that would be appreciated.

Thanks,

Dave

Pages: [1]
anything