Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old November 4, 2019, 17:11   #1
PowerWyrm
Prophet
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,672
PowerWyrm is on a distinguished road
list-tvals.h

I was under the impression that we could add more object types in the game via object_base.txt, but it's not the case since tvals are hardcoded in list-tvals.h, so adding a new object type requires adding an entry to this file and recompile the source code.

This is bad, not anyone is a dev that can edit the source and recompile it. It would be nice if tvals were dynamically generated when parsing object_base.txt.
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
PowerWyrm is offline   Reply With Quote
Old November 5, 2019, 02:59   #2
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,414
Donated: $40
Pete Mack is on a distinguished road
List-tvals is necessary to make an enum used by the code. There isn't much point in adding a tval without also adding logic to handle it, so I see no benefit to changing this
Pete Mack is offline   Reply With Quote
Old November 5, 2019, 10:10   #3
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,105
wobbly is on a distinguished road
You could break up the logic into actions perhaps? Stackable, Edible, Zapable, Chargable... etc.
wobbly is offline   Reply With Quote
Old November 5, 2019, 15:36   #4
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,105
wobbly is on a distinguished road
So I may not have been exactly clear in the above post. The code has a bunch of this:

Code:
bool tval_is_edible(const struct object *obj)

{

	switch (obj->tval) {

		case TV_FOOD:

		case TV_MUSHROOM:

			return true;

		default:

			return false;

	}

}
There's not much point adding a new object type in object_base unless you can specify edible etc. in object_base.

It's also got a bunch of this:

Code:
else if (tval_is_edible(obj1) || tval_is_potion(obj1) ||

		tval_is_scroll(obj1) || tval_is_rod(obj1)) {

		/* Food, potions, scrolls and rods all stack nicely,

		   since the kinds are identical, either both will be

		   aware or both will be unaware */
that's a small snipet. If it's addable outside the code that needs to be more like:

if stackable {

Note I'm not particularly suggesting doing it that way. It just seems to me that list-tvals.h isn't the only thing that has to change to put types editable in the edit files.
wobbly is offline   Reply With Quote
Old November 5, 2019, 18:41   #5
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,414
Donated: $40
Pete Mack is on a distinguished road
Yeah, that is pretty much what I felt, but was less clear. If you plan to add a non-trivially different object type, SOME code will be needed. If the addition is trivial, what is the point?

There are a few more attributes that could go into the edit files without massive code changes, but NOT actual gameplay logic. We got rid of lua for a reason.
Beyond the ones you mention, there is also shoot/throw break chance.
Pete Mack is offline   Reply With Quote
Old November 5, 2019, 22:36   #6
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
We got rid of lua for a reason.
... which (for me at least) was because it was badly integrated. If it had been deeply integrated with more possibilities for extension then I wouldn't have removed it...

which isn't to take away from the overall point that there is a limit to the level of customisation you can get from the edit files.

Quote:
Beyond the ones you mention, there is also shoot/throw break chance
This one is actually already in the object_base file I think?
__________________
takkaria whispers something about options. -more-
takkaria 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
"List visible monsters" and "List visible items" behavior fruviad Development 1 April 19, 2019 03:56
Variant list caruso Oook! 13 July 5, 2013 19:14
list experience value in Monster List view fbas Vanilla 1 November 24, 2010 20:51
My Unangband wish list (0.6.4a) Hajo Variants 23 October 24, 2010 07:37
Variant list pav Oook! 19 September 19, 2008 00:07


All times are GMT +1. The time now is 17:59.


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