Author Topic: Inheriting in OpenXcom  (Read 7025 times)

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Inheriting in OpenXcom
« on: November 08, 2012, 09:58:43 am »
SupSuper has not merged my pull, something about how I should be overloading similar states. So I modified the code, as you can see here, but it doesn't work. It still always runs the base class code. I've done overriding and abstract classes before, and I can't see anything I've done wrong. Anyone got any ideas?

https://github.com/pmprog/OpenXcom/commit/7f75444a5bb4ba140bb2f9bf060146d938f73078

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Inheriting in OpenXcom
« Reply #1 on: November 08, 2012, 09:31:46 pm »
Sooo, figured this out.

Technically, the code was fine. The problem is that you can't call derived class's functions whilst in the constructor! I never knew that...

Anyway, there's a new pull with the updated code

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Inheriting in OpenXcom
« Reply #2 on: November 08, 2012, 09:57:47 pm »
Sooo, figured this out.

Technically, the code was fine. The problem is that you can't call derived class's functions whilst in the constructor! I never knew that...

Anyway, there's a new pull with the updated code
Funny, I didn't know that either. That's another reason the State::init() function is so handy. Learn something new everyday. :)

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Inheriting in OpenXcom
« Reply #3 on: November 08, 2012, 10:11:57 pm »
Great, get it pulled so I can refork and start playing around with more stuff :)

I really need to remember to create branches before I do commits... Maybe one day  ;D

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Inheriting in OpenXcom
« Reply #4 on: November 08, 2012, 10:17:58 pm »
I thought I already had... ???

"This pull request cannot be automatically merged."

What did you dooooooooooooo? :P (that means there's a conflict I have to manually solve) Now I'm actually gonna have to *gasp* use the Git console. :P

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Inheriting in OpenXcom
« Reply #5 on: November 08, 2012, 10:24:41 pm »
Crap, I have no idea. Sorry :(

Should have been fine

Offline radius75

  • Colonel
  • ****
  • Posts: 108
  • I am the average PC user!
    • View Profile
Re: Inheriting in OpenXcom
« Reply #6 on: November 08, 2012, 11:03:02 pm »
src/engine/options.ccp

Quote
-<<<<<<< HEAD
    setInt("pauseMode", 0);
-=======
    setBool("customInitialBase", false);
->>>>>>> pmprog/AbstractVersion


Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Inheriting in OpenXcom
« Reply #7 on: November 09, 2012, 12:11:33 am »
Should be all fixed now. :)