Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old June 1, 2010, 17:53   #1
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Trying to understand the Angband 3.X source code

This weekend I began the project of trying to update the NPP source code with as much of the Andi Sidwell era development as possible (NPP is currently based on Angband 3.0.6, the last RR version).

My first attempt is to get the stores to interact like they do in the current Angband. I didn't get very far. I incorporated most of the updates in store.c, but my compiler (lcc-win32) gives more than a screenful errors for the display related functions, like this one:

static void store_display_entry(menu_type *menu, int oid, bool cursor, int row, int col, int width)

I added the ui-event.c and ui-menu.c to the build, along with the helper files listed in store.c, and now I get pagefuls of compile errors from those files instead. I am clearly missing a major section of code that need to be worked into my project, but I can't tell what it is. Is there anyone out there who can give me any guidance on this? Thanks.
nppangband is offline   Reply With Quote
Old June 1, 2010, 18:45   #2
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
Are you #including ui-menu.h ?
PowerDiver is offline   Reply With Quote
Old June 1, 2010, 19:28   #3
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Yes, I included that. I made sure all of the .h files at the top of Angband's current store.c are included. Now they are giving me pages and pages of error messages.

I was wondering if I have to include all the changes in main-win.c as well, or if that is completely unrelated.

I probably also need to try to compile Angband with lcc-win as well. There used to be instructions for it. Maybe that compiler can't do it any more.
nppangband is offline   Reply With Quote
Old June 2, 2010, 00:45   #4
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
I found most of the problem, I was missing ui.h.

The final compile error I get is for any code related to "ui_event_data".

I grepped the angband source code, and I cannot find where this is defined.

Thanks to anyone who can help with this.
nppangband is offline   Reply With Quote
Old June 2, 2010, 00:48   #5
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
Quote:
Originally Posted by nppangband View Post
I found most of the problem, I was missing ui.h.

The final compile error I get is for any code related to "ui_event_data".

I grepped the angband source code, and I cannot find where this is defined.

Thanks to anyone who can help with this.
ui-event.h

I guess it looks a little different since the def is at the end of a struct statement.
PowerDiver is offline   Reply With Quote
Old June 2, 2010, 03:14   #6
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Thanks! I wasn't sure that was it, because I had it included in ui-menu.c. But once I included it in z-term.h as well, it compiled.

Of course getting it to compile and getting it to work are two completely different things, but that's a good first step.
nppangband is offline   Reply With Quote
Old June 2, 2010, 07:01   #7
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,387
Donated: $40
Pete Mack is on a distinguished road
@jeff [nppangband] --
If you have questions about the menu code, let me know. I wrote the menu event model 2 or 3 years back, along with the big refactoring of cmd4.c (now cmd-know.c)

The menu code you can live without. The cmd4.c stuff you will certainly want. (npp 5 still uses the original crazy non-relational knowledge model.) You can get standalone cmd4.c from unangband if you don't want to port all your menu code. The menu code is useful only if you want small-screen and/or mouse support.

If you do want small-screen support, you will also need to port files.c, and get a whole bunch of stuff from Nick (FAAnangband)

Last edited by Pete Mack; June 2, 2010 at 07:07.
Pete Mack is offline   Reply With Quote
Old June 2, 2010, 15:08   #8
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
@Pete - thanks for the offer help me get up to speed on the Angband code. I am going to need it. I am going to try to work things one file at a time....starting with store.c (but now I have to figure out how the menu code works, because I have to change the Angband store.c code so it handles NPPAngband's store services and the adventurer's guild quests. Next will come birth.c, which should be easier.

After that, I want to get the new main-win.c to work with NPP. I don't know what to do about the other operating systems (MAC and Linux). I can look at the new main*.c files and change things I know need to be changed for NPP, but I can't compile or test it. The new makefiles make absolutely no sense to me (they don't list the individual files, so I can't tell if I have to modify them to add the files unique to NPP such as effects.c, quest.c, and terrain.c). Then after all that I will take on updating cmd4.c.

It looks like Angband has made alot of good changes, and dropped support for alot of the older operating systems. IMHO that was a good thing, since it allowed Angband to move to a modern open source license. My first goal is to get NPP there too.

I seriously debated which would be the bigger project, adding all the new Angband code to NPP, or putting all the NPP changes into the current Angband code. But the changes necessary to add 4gai and UnAngband terrain features are so extensive those two features alone would have made it a bigger task.
nppangband is offline   Reply With Quote
Old June 2, 2010, 17:34   #9
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,387
Donated: $40
Pete Mack is on a distinguished road
@jeff --
check out the make include files. (Makefile.src, Makefile.inc)
This is a much better model for maintaining dependencies.

Also, V does support small screen mode, but not to the extent that FA does.
One well-known player (Psi) plays FA on a small screen almost exclusively.

Also, the various ui fixes (menus, cmd0.c, cmd-know.c, etc) are supposed to make porting easier, not harder. If this is not the case, we've done something wrong.

Last edited by Pete Mack; June 2, 2010 at 17:40.
Pete Mack is offline   Reply With Quote
Old June 2, 2010, 18:06   #10
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Pete - I am sure it will be easier, once I understand it. You all have done a fine job. Everything I know about C and programming I learned from reading & working with the Angband source code, so all the code cleanup you all have done are completely new concepts to me. My NPP co-developer Diego is the true programmer who usually does the heavy lifting when it comes to new ideas. I usually work on incorporating ideas from other variants, where I have somebody else's written code as a starting point. So I will spend a couple weeks poking around the new Angband source, RTFM, and ask questions and then hopefully I will understand it enough to fully incorporate it into NPP.

But the quests, 4gai and Unangband terrain projects required a re-write of more than half the source code. I will definitely be quicker and easier to put the Angband ui improvements into NPP and then gradually change the code so that it is current with the latest Vanilla releases.
nppangband is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to understand Ranger playing mechanics dormouse Vanilla 5 December 15, 2009 12:43
Angband Code Interface to GUI meeshoo Vanilla 50 February 3, 2009 18:18
I finally understand how diving quicker can be "safer" Wraitheist Vanilla 13 September 19, 2008 18:25
strange C code in Angband (am I reading this right?) will_asher Idle chatter 3 February 4, 2008 10:07
Angband source branches vs trac ctate Vanilla 1 July 14, 2007 12:43


All times are GMT +1. The time now is 07:27.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.