Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python

Notices

Reply
 
Thread Tools
Old Jan 23, 2010, 11:34 AM   #1
Opera
Deity
 
Opera's Avatar
 
Join Date: Sep 2008
Posts: 4,284
Access violation error

I was skimming through the pedia after some modding and I got a RuntimeError: unidentified C++ exception in CvPediaMain; in placeCorporations, line:
Code:
			screen.setTableText(tableName, iColumn, iRow, u"<font=3>" + item[0] + u"</font>", gc.getCorporationInfo(item[1]).getButton(), WidgetTypes.WIDGET_PEDIA_JUMP_TO_CORPORATION, item[1], 1, CvUtil.FONT_LEFT_JUSTIFY)
Using a debug dll, I got that:
Quote:
First-chance exception at 0x00682787 in Civ4BeyondSword.exe: 0xC0000005: Access violation reading location 0xd56a822a.
First-chance exception at 0x7c350440 in Civ4BeyondSword.exe: 0xC0000005: Access violation reading location 0x00000019.
First-chance exception at 0x7c350440 in Civ4BeyondSword.exe: 0xC0000005: Access violation reading location 0x00000019.
First-chance exception at 0x7c350440 in Civ4BeyondSword.exe: 0xC0000005: Access violation reading location 0x00000019.
First-chance exception at 0x00682787 in Civ4BeyondSword.exe: 0xC0000005: Access violation reading location 0xd56a822a.
Then I figured it was because of a check involving CvCorporation::getCrime(), so I commented out the check... And then the error was back at the below check. Using breakpoints, I managed to find that it breaks right when the function returns, in this case, m_iDefenseModifier.

What could that error be?
Opera is offline   Reply With Quote
Old Jan 23, 2010, 11:39 AM   #2
Afforess
The White Wizard
 
Afforess's Avatar
 
Join Date: Jul 2007
Location: Michigan, USA
Posts: 10,652
Images: 8
That error means you tried to use a getSomething(int i) call and it was out of bounds. So you tried to look up what corporation was at -1, or something like that. I can't tell until I see the code, but run a debug build, it will give you an assert right before usually.
__________________
"A Witty Saying Proves Nothing"
-Voltaire

Civilization 4 Mods: Rise of Mankind - A New Dawn 1.75
Civilization 5 Mods: Active City Defense, Tech Diffusion
Minecraft Mods: Spout & Spoutcraft Lead Developer
Afforess is offline   Reply With Quote
Old Jan 23, 2010, 12:03 PM   #3
Opera
Deity
 
Opera's Avatar
 
Join Date: Sep 2008
Posts: 4,284
I did run one, no assert, which surprised me... It really comes from WIDGET_PEDIA_JUMP_TO_CORPORATION, which calls ParseCorporationHelp (or something) which then calls to CvGameTextMgr::setCorporationHelp which then calls to CvCorporation::getCrime() which bugs.

As a note, I have added a new class in CvInfos, as well as a new pedia page, hence a new widget... Everything is working; at least everything I have added, since the corp page doesn't work anymore...

Edit: Oh, and every WIDGET_CLOSE_SCREEN are broken too... I'm willing to bet both bugs share some origin

Edit 2: With some more tests, it appears the defense modifier works like a charm, since it gets added to my city if I put the corporation in it... while the game can't use the exact same function to build the help string...?

Last edited by Opera; Jan 23, 2010 at 12:08 PM.
Opera is offline   Reply With Quote
Old Jan 23, 2010, 12:30 PM   #4
Opera
Deity
 
Opera's Avatar
 
Join Date: Sep 2008
Posts: 4,284
Ok, so, now it shows up to 4 corporations and CtD's when I click on one of them

Edit: and now it doesn't show any corp anymore... wtf?
Opera is offline   Reply With Quote
Old Jan 23, 2010, 03:47 PM   #5
The_J
Say No 2 Net Validations

 
The_J's Avatar
 
Join Date: Oct 2008
Location: Germany / Netherlands
Posts: 24,837
Images: 51
Your HDD and RAM are okay?

Did you maybe add all the things to a part of the code, which is already memory intensive?
__________________
Civ4-BtS-Mod "Mars, Now!"


Steam eats the souls of little gamers!!!
The_J is online now   Reply With Quote
Old Jan 23, 2010, 05:25 PM   #6
xienwolf
Deity
 
xienwolf's Avatar
 
Join Date: Oct 2007
Location: Location! Location!
Posts: 10,589
Images: 8
Quote:
Originally Posted by Opera View Post
I did run one, no assert, which surprised me... It really comes from WIDGET_PEDIA_JUMP_TO_CORPORATION, which calls ParseCorporationHelp (or something) which then calls to CvGameTextMgr::setCorporationHelp which then calls to CvCorporation::getCrime() which bugs.

As a note, I have added a new class in CvInfos, as well as a new pedia page, hence a new widget... Everything is working; at least everything I have added, since the corp page doesn't work anymore...

Edit: Oh, and every WIDGET_CLOSE_SCREEN are broken too... I'm willing to bet both bugs share some origin

Edit 2: With some more tests, it appears the defense modifier works like a charm, since it gets added to my city if I put the corporation in it... while the game can't use the exact same function to build the help string...?
Typical error when you didn't add the widget to the end of the list. If you added it in the middle or start, then you bumped things down and now something isn't aligned properly. Either a hardcode in the exe (as I suspect is the case with close screen, comes up a lot) or a failure to do a full rebuild after changing CvEnums.h (which always makes things weird).
xienwolf is offline   Reply With Quote
Old Jan 23, 2010, 07:05 PM   #7
Opera
Deity
 
Opera's Avatar
 
Join Date: Sep 2008
Posts: 4,284
Quote:
Originally Posted by xienwolf View Post
Typical error when you didn't add the widget to the end of the list. If you added it in the middle or start, then you bumped things down and now something isn't aligned properly. Either a hardcode in the exe (as I suspect is the case with close screen, comes up a lot) or a failure to do a full rebuild after changing CvEnums.h (which always makes things weird).
So you think the error is in CvEnums.h? But you didn't add CIVILOPEDIA_PAGE_TRAIT to the end, iirc. But you did add WIDGET_PEDIA_JUMP_TO_TRAIT to the end... Ah, I'll test that then.
Opera is offline   Reply With Quote
Old Jan 23, 2010, 07:24 PM   #8
Opera
Deity
 
Opera's Avatar
 
Join Date: Sep 2008
Posts: 4,284
Bug fixed! Thank you so much xienwolf
At least, when I'd want to add new widgets, I'll know I'd have to put them at the end
Opera is offline   Reply With Quote
Old Jan 23, 2010, 09:48 PM   #9
xienwolf
Deity
 
xienwolf's Avatar
 
Join Date: Oct 2007
Location: Location! Location!
Posts: 10,589
Images: 8
It is best to get in the habit of always working at the end of everything so that you can avoid such issues as this one. Just not a habit I forced on myself in my earlier days of coding. But I do intend to be more diligent in my rebuild. It really isn't an issue till you run into something which is hardcoded in the EXE or another DLL.
xienwolf is offline   Reply With Quote
Old Jan 24, 2010, 02:45 AM   #10
Opera
Deity
 
Opera's Avatar
 
Join Date: Sep 2008
Posts: 4,284
For some reason, I thought I had to put my new widget in the same order as the pedia. I guess there's really few cases in which order do matter
Opera is offline   Reply With Quote
Old Jan 24, 2010, 11:29 AM   #11
xienwolf
Deity
 
xienwolf's Avatar
 
Join Date: Oct 2007
Location: Location! Location!
Posts: 10,589
Images: 8
Order is only really important for the hardcode/xml hybrid systems, like GameOptions. Things that are listed completely in the SDK, but also exist in the XML. Since the XML is loaded in order, that is how it tries to match up.
xienwolf is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python > Access violation error

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
NEVER MIND- I discovered my error ---Uranium under city - cannot access! Saint Sarai Civ4 - General Discussions 9 Aug 17, 2007 01:08 PM
Civ 3 - Access error krizzel Civ3 - Technical Support 3 Feb 26, 2006 06:39 PM
RuntimeError: Access violation - no RTTI data! ingvild Civ4 - Technical Support 1 Nov 15, 2005 07:54 AM
error message: i need help=cant access mutiplayer capnahdharr Civ3 - Technical Support 3 Feb 13, 2005 06:21 PM
c0000005 (access violation) NDSN Civ3 - Technical Support 1 Sep 29, 2003 03:57 AM


Advertisement

All times are GMT -6. The time now is 02:06 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR