Debugger says my assignment hasn't worked

J

Jon Bell

I think the screenshot is self-explantory, tell me if it isn't.

Np, it's not.
http://www.hcstreet.f2s.com/james/stuff/assign.png

Can anyone explain what might be going on?

Not unless we can see the definitions of currentSelection.desc and of
whatever it is that "items" is an array (or vector?) of, and possibly the
code that puts stuff into items.desc in the first place.

I will wager a very wild guess that "desc" is a char* or array of char,
and that you might be having problems associated with confusing char
pointers with arrays of char.
 
J

James Gregory

Np, it's not.


Not unless we can see the definitions of currentSelection.desc and of
whatever it is that "items" is an array (or vector?) of,

class ItemInfo
{
public:
string desc;
WindowChoice choice;
int parem;
};

class MenuItem: public ItemInfo
{
public:
SDL_Rect rect;
};

class MenuChoice: public ItemInfo
{
public:
MenuChoiceType choiceType;
};

class Menu_Base: public GenWindow_Base
{
public:
Menu_Base(int initParentID, int flags);

virtual WindowInput GetInput();
virtual void DrawSelf();

int highlight;

vector<MenuItem> items;

static const int itemWidth = 160;

protected:
void InitRects();
virtual WindowInput SwitchOnChoice() = 0;

MenuChoice currentSelection;
};
and possibly the
code that puts stuff into items.desc in the first place.


MainSM::MainSM(int initx, int inity):
Menu_Base(none, 0)
{
rect.x = initx;
rect.y = inity;

MenuItem tempItem;
SDL_Rect tempRect = {0, 0, itemWidth, lineGap};

//snippity snip

tempItem.desc = "Force editor";
tempItem.choice = MM_ForceSelect;
tempItem.rect = tempRect;
items.push_back(tempItem);

tempRect.y+= lineGap;

//snippity snip
}

James
 
J

John Harrison

James Gregory said:
I think the screenshot is self-explantory, tell me if it isn't.

The line that doesn't seem to have worked properly is highlighted in blue.

The line highlighted in green is just a debugger break point.

http://www.hcstreet.f2s.com/james/stuff/assign.png

Can anyone explain what might be going on?

Thanks,

James

Could it simply be that your debugger is not very good at displaying the
values of std::string types?

john
 
J

James Gregory

Could it simply be that your debugger is not very good at displaying the
values of std::string types?

Oh, damn, I remember finding that out before once but I'd forgotten.

Many thanks for reminding me.

James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top