Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the prerequisites for the current research goal in the tech tree of the Great Library #135

Merged

Conversation

MartinGuehmann
Copy link
Collaborator

Show the prerequisites for the current research goal in the tech tree of the Great Library: This way it is easier to see what needs to be researched for the current research goal.

This PR should still add a label to the tech tree giving the current research and how many prerequisites it has has and how many of those are known.

…brary

..\ctp2_data\french\uidata\layouts\greatlibrary.ldl
..\ctp2_data\chinese\uidata\layouts\greatlibrary.ldl
..\ctp2_data\english\uidata\layouts\greatlibrary.ldl
..\ctp2_data\german\uidata\layouts\greatlibrary.ldl
..\ctp2_data\italian\uidata\layouts\greatlibrary.ldl
..\ctp2_data\japanese\uidata\layouts\greatlibrary.ldl
..\ctp2_data\spanish\uidata\layouts\greatlibrary.ldl
..\ctp2_data\french\uidata\layouts\ChatWindow.ldl
..\ctp2_data\french\uidata\layouts\SpriteEditor.ldl
..\ctp2_data\french\uidata\layouts\advancespad.ldl
..\ctp2_data\french\uidata\layouts\aipad.ldl
..\ctp2_data\french\uidata\layouts\ancient.ldl
..\ctp2_data\french\uidata\layouts\attract.ldl
..\ctp2_data\french\uidata\layouts\buttonbank.ldl
..\ctp2_data\french\uidata\layouts\c3utilitydialog.ldl
..\ctp2_data\french\uidata\layouts\ce_screen.ldl
..\ctp2_data\french\uidata\layouts\cityespionage.ldl
..\ctp2_data\french\uidata\layouts\citymanager.ldl
..\ctp2_data\french\uidata\layouts\citypad.ldl
..\ctp2_data\french\uidata\layouts\cityview.ldl
..\ctp2_data\french\uidata\layouts\creditsscreen.ldl
..\ctp2_data\french\uidata\layouts\ctp_template.ldl
..\ctp2_data\french\uidata\layouts\cutnpastepad.ldl
..\ctp2_data\french\uidata\layouts\cvscreen.ldl
..\ctp2_data\french\uidata\layouts\diplomacy.ldl
..\ctp2_data\french\uidata\layouts\endgame.ldl
..\ctp2_data\french\uidata\layouts\fancy.ldl
..\ctp2_data\french\uidata\layouts\fliwindow.ldl
..\ctp2_data\french\uidata\layouts\font1.ldl
..\ctp2_data\french\uidata\layouts\font2.ldl
..\ctp2_data\french\uidata\layouts\font3.ldl
..\ctp2_data\french\uidata\layouts\font4.ldl
..\ctp2_data\french\uidata\layouts\font5.ldl
..\ctp2_data\french\uidata\layouts\font6.ldl
..\ctp2_data\french\uidata\layouts\happystatus.ldl
..\ctp2_data\french\uidata\layouts\helppopup.ldl
..\ctp2_data\french\uidata\layouts\helptile.ldl
..\ctp2_data\french\uidata\layouts\hotseatlist.ldl
..\ctp2_data\french\uidata\layouts\infoscreen.ldl
..\ctp2_data\french\uidata\layouts\intromovie.ldl
..\ctp2_data\french\uidata\layouts\loadsave.ldl
..\ctp2_data\french\uidata\layouts\messagebox.ldl
..\ctp2_data\french\uidata\layouts\musicscreen.ldl
..\ctp2_data\french\uidata\layouts\ns_chglobby.ldl
..\ctp2_data\french\uidata\layouts\ns_editplyr.ldl
..\ctp2_data\french\uidata\layouts\ns_joingame.ldl
..\ctp2_data\french\uidata\layouts\ns_launch.ldl
..\ctp2_data\french\uidata\layouts\ns_lobby.ldl
..\ctp2_data\french\uidata\layouts\ns_selcnct.ldl
..\ctp2_data\french\uidata\layouts\ns_selplyr.ldl
..\ctp2_data\french\uidata\layouts\ns_selserv.ldl
..\ctp2_data\french\uidata\layouts\ns_template.ldl
..\ctp2_data\french\uidata\layouts\objectpad.ldl
..\ctp2_data\french\uidata\layouts\options.ldl
..\ctp2_data\french\uidata\layouts\playerpad.ldl
..\ctp2_data\french\uidata\layouts\pointspad.ldl
..\ctp2_data\french\uidata\layouts\pollutionpad.ldl
..\ctp2_data\french\uidata\layouts\profileedit.ldl
..\ctp2_data\french\uidata\layouts\queuewin.ldl
..\ctp2_data\french\uidata\layouts\scenario.ldl
..\ctp2_data\french\uidata\layouts\sciencevictory.ldl
..\ctp2_data\french\uidata\layouts\segmentlist.ldl
..\ctp2_data\french\uidata\layouts\sound.ldl
..\ctp2_data\french\uidata\layouts\sourcelist.ldl
..\ctp2_data\french\uidata\layouts\statswindow.ldl
..\ctp2_data\french\uidata\layouts\throneroom.ldl
..\ctp2_data\french\uidata\layouts\tilepad.ldl
..\ctp2_data\french\uidata\layouts\toolbar.ldl
..\ctp2_data\french\uidata\layouts\trademanager.ldl
..\ctp2_data\french\uidata\layouts\tradescreen.ldl
..\ctp2_data\french\uidata\layouts\tutorialwin.ldl
..\ctp2_data\french\uidata\layouts\unitmanager.ldl
..\ctp2_data\french\uidata\layouts\unitpad.ldl
..\ctp2_data\french\uidata\layouts\unitstatus.ldl
..\ctp2_data\french\uidata\layouts\victorymovie.ldl
..\ctp2_data\french\uidata\layouts\victoryscreen.ldl
..\ctp2_data\french\uidata\layouts\watchlist.ldl
..\ctp2_data\french\uidata\layouts\wondermovie.ldl
…reat Library

..\ctp2_code\ui\aui_ctp2\chart.cpp
..\ctp2_code\ui\interface\greatlibrary.cpp
..\ctp2_code\ui\interface\greatlibrary.h
..\ctp2_code\ui\interface\sci_advancescreen.cpp
..\ctp2_code\ui\interface\sci_advancescreen.h
@MartinGuehmann MartinGuehmann added the WIP A pull request that is work in progress, the maintainer shouldn't merge it, yet label May 6, 2019
Add it to the source files
..\ctp2_code\ui\aui_ctp2\chart.cpp
..\ctp2_code\ui\aui_ctp2\chart.h

Add it to the layout files
..\ctp2_data\chinese\uidata\layouts\greatlibrary.ldl
..\ctp2_data\english\uidata\layouts\greatlibrary.ldl
..\ctp2_data\french\uidata\layouts\greatlibrary.ldl
..\ctp2_data\german\uidata\layouts\greatlibrary.ldl
..\ctp2_data\italian\uidata\layouts\greatlibrary.ldl
..\ctp2_data\japanese\uidata\layouts\greatlibrary.ldl
..\ctp2_data\spanish\uidata\layouts\greatlibrary.ldl
…and the advance chooser

..\ctp2_code\ui\aui_ctp2\chart.cpp
..\ctp2_code\ui\interface\sci_advancescreen.cpp
..\ctp2_code\ui\interface\sci_advancescreen.h
@MartinGuehmann MartinGuehmann removed the WIP A pull request that is work in progress, the maintainer shouldn't merge it, yet label May 6, 2019
@LynxAbraxas
Copy link
Contributor

Sounds great, will give it a test and report back.

@LynxAbraxas
Copy link
Contributor

Not sure if I saw the effect of this PR. @MartinGuehmann do you have a screen shot showing where this change should be visible?

@MartinGuehmann
Copy link
Collaborator Author

Not sure if I saw the effect of this PR. @MartinGuehmann do you have a screen shot showing where this change should be visible?

Well it is in the great library and the research chooser. All what you have to do is to set a goal for instance set the goal to Theocracy. And then you will see how many techs you need and how many of those you already know.

In the Great Library you have to go to the tech tree. Go to Theocracy, go to the tree and set the goal to Theocracy and the advances you need in the tech tree get an asterix.

@LynxAbraxas
Copy link
Contributor

Got it. That's great! Even works for "set goal" of a unit, e.g. sea ingeneer, just need to click on the advance ("nano assembly") that is listed to give that to get to the advance and then I can click on the tech-tree (which does not work for the unit entry):

ss_2019-06-01_23:10:10

Then I can follow the advance that have an asterix and are not yet known (red frame):

ss_2019-06-01_23:11:06

Which brings me to my currently researched advance (yellow frame):

ss_2019-06-01_23:11:52

So works as expected. Good to go.
PS: It would be nice to have a way to list all advances that are still needed to be researched to get the the goal, but I guess that would be quite complicated as there is no window for showing that info already in the game.

@MartinGuehmann
Copy link
Collaborator Author

Got it. That's great! Even works for "set goal" of a unit, e.g. sea ingeneer, just need to click on the advance ("nano assembly") that is listed to give that to get to the advance and then I can click on the tech-tree (which does not work for the unit entry):

I know, probably also something to change. But that is another PR.

So works as expected. Good to go.

Well, then let's merge.

PS: It would be nice to have a way to list all advances that are still needed to be researched to get the the goal, but I guess that would be quite complicated as there is no window for showing that info already in the game.

The only complicated thing is finding a place for it. The candidates are the science chooser and the science window. The rest is a list box and some text elements.

@LynxAbraxas
Copy link
Contributor

Just noticed that a commit between 247c8dc and the merging of this PR 68fa841 now causes the game to crash when opening the great-library. I'm not sure why that did not happen when I tested this PR as the screenshots show that it had worked then.
@MartinGuehmann should I open a new issue for this or do you already see where the problem could lie?

@MartinGuehmann MartinGuehmann deleted the ShowTechGoalInGreatLibrary branch June 27, 2019 21:49
@MartinGuehmann
Copy link
Collaborator Author

Just noticed that a commit between 247c8dc and the merging of this PR 68fa841 now causes the game to crash when opening the great-library. I'm not sure why that did not happen when I tested this PR as the screenshots show that it had worked then.
@MartinGuehmann should I open a new issue for this or do you already see where the problem could lie?

I think, I will test it first. For sure that would be an issue we have to fix, quickly.

@MartinGuehmann
Copy link
Collaborator Author

Well, I compiled it on Windows and I got some LDL errors. I then also restored helptile.ldl in the German folder since I thought it had something to do with it. Anyway, I still got some ldl errors, so that I wonder whether originally read the errors correctly or just thought of helptile.ldl.

I think we have also to solve this with the duplicated ldl files in a better way. They should be in the default folder. There is a main files called civ3.ldl, if the game is supposed to look for a ctp2.ldl then we could relocate it.

Here are the errors:

   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\trademanager.ldl:1: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\intelligence.ldl:2: syntax error
   c3errors.cpp@165 : Error: LDL Error, C:\Activision\CivCTP2\ctp2_data\german\uidata\layouts\intelligence.ldl:2: syntax error
   c3errors.cpp@165 : Error: LDL Error, Duplicate block CTP2_STANDARD_FONT

For sure we did not modify intelligence.ldl, so that is really odd. When I open the trade manager I get the following assert:

slicengine.cpp@2081: SLIC: control ControlPanelWindow.ControlPanel.ShortcutPad.TradeButton used
    c3debug.cpp@302 : Assertion (dataBlock) Failed in File:c:\activision\civctp2\ctp2_code\ui\aui_common\aui_ldl.cpp, Line:559
    c3debug.cpp@303 : Stack Trace: '  0x01497b8c  [char * __cdecl c3debug_StackTrace(void) + 0x3c]
  0x0148f902  [void __cdecl c3debug_Assert(char const *,char const *,int) + 0x72]
  0x01117ae9  [public: static class aui_Region * __cdecl aui_Ldl::BuildHierarchyFromRoot(char const *) + 0xe9]
  0x0136b30f  [public: __thiscall TradeManager::TradeManager(enum AUI_ERRCODE *) + 0x5f]
  0x0136e213  [public: static enum AUI_ERRCODE __cdecl TradeManager::Initialize(void) + 0x83]
  0x0136d33c  [public: static enum AUI_ERRCODE __cdecl TradeManager::Display(void) + 0x2c]
  0x0134a71d  [public: virtual void __thiscall ShortcutPad::ShortcutCallback<enum AUI_ERRCODE>::operator()(void) + 0x2d]
  0x0134a9fa  [private: static void __cdecl ShortcutPad::ShortcutButtonActionCallback(class aui_Control *,unsigned int,unsigned int,void *) + 0x5a]
  0x010f9b88  [protected: virtual void __thiscall aui_Button::MouseLDropInside(struct aui_MouseEvent *) + 0x168]
  0x011cab59  [public: virtual void __thiscall ctp2_Button::MouseLDropInside(struct aui_MouseEvent *) + 0x39]
  0x0114d34a  [public: void __thiscall aui_Region::MouseDispatch(struct aui_MouseEvent *,int) + 0x29ba]
  0x01146438  [public: enum AUI_ERRCODE __thiscall aui_Region::HandleMouseEvent(struct aui_MouseEvent *,int) + 0x1b8]
  0x0114638b  [public: enum AUI_ERRCODE __thiscall aui_Region::HandleMouseEvent(struct aui_MouseEvent *,int) + 0x10b]
  0x0116f6ea  [public: enum AUI_ERRCODE __thiscall aui_UI::HandleMouseEvents(int,struct aui_MouseEvent *) + 0x14a]
  0x01172396  [public: virtual enum AUI_ERRCODE __thiscall aui_UI::Process(void) + 0x56]
  0x01472e0a  [private: int __thiscall CivApp::ProcessUI(unsigned int,unsigned int &) + 0x27a]
  0x014722cf  [public: int __thiscall CivApp::Process(void) + 0x10f]
  0x0145f15b  [int __stdcall CivMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int) + 0x41b]
  0x01463fce  [WinMain@16 + 0xae]
  0x014b2f0e  [int __cdecl invoke_main(void) + 0x1e]
  0x014b2da7  [int __cdecl __scrt_common_main_seh(void) + 0x157]
  0x014b2c3d  [int __cdecl __scrt_common_main(void) + 0xd]
  0x014b2f88  [WinMainCRTStartup + 0x8]
  0x76858494  [$R002030 + 0x7507e104]
  0x778041c8  [$R002030 + 0x76029e38]
  0x77804198  [$R002030 + 0x76029e08]

dataBlock is NULL, which follows from the LDL error. But I don't know why the LDL error happened. After the assert, I went into debug mode and when I saw that dataBlock was NULL, I stopped debugging. But I would expect that the game would crash then.

@LynxAbraxas
Copy link
Contributor

LynxAbraxas commented Jul 1, 2019

Testing this further, I have the impression that the problem occurs when continuing playing a game that was saved after a research goal was set.

@LynxAbraxas
Copy link
Contributor

Yes, the crash occurs when opening the great-library in a game that was previously saved with a research goal set (that's why I did not observe the problem when testing this PR).
The crash can be avoided by first opening the research window and then clicking on a link that opens the great-library:

ss_2019-07-01_20:41:43
It does not crash then and even opening the great-library directly after this action does not lead to a crash.

I once got a double free or corruption (!prev) on the command line but not always in the case of a crash.

@MartinGuehmann
Copy link
Collaborator Author

So looks like the LDL errors are another problem.

At least, with new information, I have a some idea where to look.

@MartinGuehmann
Copy link
Collaborator Author

I found the problem, now I just have to upload it.

@LynxAbraxas
Copy link
Contributor

That's great! Looking forward to testing that (synced your fork of civctp2 but found no new branch/commit so far).
BTW: Your fork of civctp2 still has branches for already merged PRs: https://github.com/MartinGuehmann/civctp2/branches It's best to delete the merged ones to avoid confusion and accidental use.

MartinGuehmann added a commit to MartinGuehmann/civctp2 that referenced this pull request Jul 4, 2019
…l was set

This fixes a bug introduced in civctp2#135

..\ctp2_code\ui\aui_ctp2\chart.cpp
..\ctp2_code\ui\interface\sci_advancescreen.cpp
..\ctp2_code\ui\interface\sci_advancescreen.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants