About Store Forum Documentation Contact
Donations:
327$/mo



Post Reply 
Game::World.setAreaData
Author Message
Driklyn Offline
Member

Post: #1
Game::World.setAreaData
How do you set a custom area data struct? Do you need a license or something, or am I just doing this wrong?

PHP Code:
struct CustomAreaData Game::Area::Data {}

bool Init()
{
    
// ...
    
Game::World.setAreaData<CustomAreaData>();


Produces the following error:

Code:
error C2664: 'CustomAreaData::CustomAreaData' : cannot convert parameter 1 from 'EE::Game::Area' to 'CustomAreaData &'
05-30-2011 04:18 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Game::World.setAreaData
Anyone have any idea? Esenthel perhaps? smile
05-31-2011 06:48 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Game::World.setAreaData
perhaps you're missing constructor
05-31-2011 10:17 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: Game::World.setAreaData
I believe I tried messing with constructors before making this thread, but I was still getting errors. Using Header Browser, I figured out I needed this constructor:

PHP Code:
struct CustomAreaData Game::Area::Data
{
   
CustomAreaData(Game::Area &area) {}


But, this gives a new error:

Code:
error C2512: 'EE::Game::Area::Data' : no appropriate default constructor available

Not sure how to get around this.

Also, shouldn't the CustomAreaData constructor being setting T._area as well? I can't do that since it's private.
05-31-2011 07:52 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #5
RE: Game::World.setAreaData
You have to create a empty constructor as well.. like it says "no appropriate default constructor available"

There is always evil somewhere, you just have to look for it properly.
05-31-2011 10:54 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #6
RE: Game::World.setAreaData
Already tried that. All that does it make the error occur twice instead of once.

It's saying 'EE::Game::Area::Data' has no appropriate default constructor, not 'CustomAreaData', which is correct however, EE::Game::Area::Data does not have a default constructor, only this:

PHP Code:
Data(Area &area); 

So it must not need a default constructor, not sure why it's giving me this error...
06-01-2011 01:07 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Game::World.setAreaData
Code:
struct CustomAreaData : Game::Area::Data
{
   CustomAreaData(Game::Area &area) : Game::Area::Data(area) {}
}
06-01-2011 02:39 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #8
RE: Game::World.setAreaData
Sweet! Thanks, Esenthel. It works perfectly now! Not sure if I ever would have thought to do that...
06-01-2011 11:04 PM
Find all posts by this user Quote this message in a reply
Post Reply