Jump to content
Sign in to follow this  
Guest Patrick_Waugh

Any idea why this doesn't work?

Recommended Posts

Guest Patrick_Waugh

I tested this code outside of the sim, and it worked... but interestingly... when I trigger it in the sim, the 1st character (code[0]) never shows up.So, if I enter "2345" in the scratchpad, then hit the key to trigger this method, I get "345" in the Xpdr.void Xpdr::SetXpdr1Code(){ UINT32 bcd = 0; // encoded xpdr code (ie 1200 coded to 4608) const wchar_t *code = ScratchPad::GetText().c_str(); bcd = (code[0] - 0x30) << 12; bcd += (code[1] - 0x30) << 8; bcd += (code[2] - 0x30) << 4; bcd += (code[3] - 0x30); trigger_key_event(KEY_XPNDR_SET, bcd);}If I set a break point, I do see the full text "2345" is in the scratchpad, but strangely I can't see any of the local variables in the debugger.More strangely, the code works fine in a console app with the *code = "2345".Anyone see why this happens??

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Never mind, got it all figured out finally!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...