PSP Hacks - Forums

Go Back   PSP Hacks - Forums > Tech Talk > PC Programming

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 06-25-2009, 06:36 AM
pirata nervo pirata nervo is offline
Moderator
PSP Titan
 

Join Date: Mar 2007
Location: www.consoleworld.net
Posts: 5,556
pirata nervo is on a distinguished road
Default C++ question

I am still learning C++.

(this is my first C++ project. The only things I have coded in C++ were a few samples)
I find it hard to get used to C++ when I am used to code in C.

So I created an object handler for a game me and jo3_sum are creating and here it is the part I need help with:
Code:
typedef struct Model_obj
{
    //OBJ_Model obj_model;
    BMOBJ obj_class;
} Model_obj;

typedef struct Model_md2
{
    BMMD2 md2_class;
    MD2_Model md2_model;
} Model_md2;

typedef struct Model
{
    int mod_type; // one of the definitions
    Model_obj obj;
    Model_md2 md2;
    //float x, y, z;
} Model;
The md2 loader works, I am nearly done with the obj loader but soon we should have both working.

The thing is whenever I do:
Code:
Model something;
It automatically stores:
Code:
    BMOBJ obj_class;

    BMMD2 md2_class;
    MD2_Model md2_model;
in memory, but we should only need one kind of model per structure("something" structure?) (I don't even know if that's the correct word in English). Thus, what I wanted to do is to use ONLY one of the model structures, either:
Code:
    Model_obj obj;
or:
Code:
    Model_md2 md2;
Depending on the model format.

One thing that would (probably) work is to use a pointer instead, and allocate one of the pointers and (maybe) delete the other pointer?

Thanks for the help

Edit:
Figured out to do it in a different way
__________________


Last edited by pirata nervo; 06-25-2009 at 01:32 PM.
Reply With Quote
Reply

 



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:51 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©