Go Back   Angband Forums > Angband > Development

Thread Tools Display Modes
Old July 21, 2010, 13:10   #21
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Originally Posted by Pete Mack View Post
OK, OK, mea culpa; mea maxima culpa!
I will write some comments for ui-menu.c (In my defense, I put lots of comments in the .h file.)

Oh yeah, and ui-menu.c isn't "thousands" of lines; only 922 including comments.
Pete - It is some great code. I just used it as an example because I had just spent some time getting NPP features like store services to work alongside the store inventory inside the new interface. In terms of ui-menu.c, most of it worked automatically. Ui_menu added the services right alongside the store inventory and I could highlight them with a mouseclick without having to de-bug or fix anything. I half expected it to have to make major changes, and I didn't. I am a big fan of how it works, even if I don't quite understand it yet.

For example: two of the store services in NPP are increase stat and restore stat, kind of like buying the potions and quaffing them. Currently, the player can purchase the service by mouseclick, but when it comes to picking a stat to restore/increase, they have to use the keyboard, because it isn't apparent to me how to create and display a list of the stats that need to be restored or increased, and have the player pick from the display with the mouse. No big deal, it is on my to-do list and I am sure I will figure it out when I get to it. But unless I missed it there is nowhere that says "here are the steps to create a menu, display it on the screen, and erase it after the user selects from a list." I don't think the code needs painstaking line-by-line commenting, just a quick paragraph or two on how to create an interactive list from scratch.

Nick had a better example, with game-event.c. I haven't looked too closely at it yet, but it isn't apparent to me why that was added, what was wrong with the code it replaced, or how it makes the game work better.
nppangband is offline   Reply With Quote
Old July 21, 2010, 14:05   #22
Vanilla maintainer
Nick's Avatar
Join Date: Apr 2007
Location: Canberra, Australia
Age: 56
Posts: 9,317
Donated: $60
Nick will become famous soon enoughNick will become famous soon enough
Originally Posted by nppangband View Post
Nick had a better example, with game-event.c. I haven't looked too closely at it yet, but it isn't apparent to me why that was added, what was wrong with the code it replaced, or how it makes the game work better.
My understanding is that it is an interface between the game and the UI, so the game says "this happened" and the UI works out how to draw it. But I certainly don't have the detail down.
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old May 24, 2021, 11:08   #23
Join Date: May 2021
Location: Australia, SA
Posts: 2
rogerhaines is on a distinguished road
I've looked at the code, and it's nothing like spaghetti. There's no sauce.
LOL!!! But seriously, it's not. C++ is very object orientated, which makes spaghetti code hard to implement.
Python, on the other hand...... is different.
rogerhaines is offline   Reply With Quote

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 the Angband 3.X source code nppangband Development 62 July 11, 2010 18:20
Angband Code Interface to GUI meeshoo Vanilla 50 February 3, 2009 17:18
strange C code in Angband (am I reading this right?) will_asher Idle chatter 3 February 4, 2008 09:07
Updating Vanilla for dummies Dragonboneman Vanilla 7 August 12, 2007 22:12
Looking through the code K.I.L.E.R Vanilla 5 July 11, 2007 08:01

All times are GMT +1. The time now is 11:31.

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