Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old July 12, 2016, 00:17   #31
Elfin Jedi
Adept
 
Join Date: Mar 2013
Posts: 102
Elfin Jedi is on a distinguished road
Ok, edited gamedata files are now in gamedata folder rather than user folder.

Chose INVISIBLE as name. Edited list-mon-timed.h and list-mon-message.h.

Still working out where to add extra checks.

Haven't put invisibility spell changes on github yet.

Oh bother, the line endings are a problem again (with files in gamedata).

Looks like pit.txt, terrain.txt, and store.txt (at the very bottom) are fine. The others are older and will need to be redone.

Last edited by Elfin Jedi; July 12, 2016 at 00:47.
Elfin Jedi is offline   Reply With Quote
Old July 12, 2016, 17:52   #32
Elfin Jedi
Adept
 
Join Date: Mar 2013
Posts: 102
Elfin Jedi is on a distinguished road
Fixed bug where bookstore wasn't showing up and magic shop had bookstores symbol. Terrain.txt had for the bookstore info:6:0. Changed to info:9:0.

Also, got history.txt, pit.txt, store.txt, and terrain.txt in separate uploads with fixed line endings. (So now it won't say that I changed every line in history.txt, makes it a LOT easier to find changes.)
Elfin Jedi is offline   Reply With Quote
Old July 12, 2016, 18:05   #33
Elfin Jedi
Adept
 
Join Date: Mar 2013
Posts: 102
Elfin Jedi is on a distinguished road
Now I just need to get the nature and necromany books to display in the store and inventory lists.

So far I have made changes to list-magic-realms.h:

"REALM(NONE, STAT_STR, "", "", "", "")
REALM(ARCANE, STAT_INT, "cast", "spell", "magic book", "arcane")
REALM(PIOUS, STAT_WIS, "recite", "prayer", "prayer book", "divine")
REALM(NATURE, STAT_WIS, "use", "druidic lore", "nature book", "nature")
REALM(NECROMANCY, STAT_INT, "perform", "ritual", "necromancy book", "necromancy")
"
list-tvals.h:

"TV(MAGIC_BOOK, "magic book")
TV(PRAYER_BOOK, "prayer book")
TV(NATURE_BOOK, "nature book")
TV(NECROMANCY_BOOK, "necromancy book") "

and obj-desc.c:

" case TV_MAGIC_BOOK:
if (terse)
return "& Book~ #";
else
return "& Book~ of Magic Spells #";

case TV_PRAYER_BOOK:
if (terse)
return "& Book~ #";
else
return "& Holy Book~ of Prayers #";

case TV_NATURE_BOOK:
if (terse)
return "& Book~ #";
else
return "& Book~ of Nature Lore #";

case TV_NECROMANCY_BOOK:
if (terse)
return "& Book~ #";
else
return "& Book~ of Necromancy #";"
Elfin Jedi is offline   Reply With Quote
Old July 12, 2016, 22:06   #34
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,166
Donated: $40
Pete Mack is on a distinguished road
The easiest way to do this would be to use priest books for druids and mage books for necromancers. That way you wouldn't need any code at all, and there wouldn't be so much junk--as it is, there's only a 50% chance of a caster being unable to use a particular book. With your change, that goes to 25%.

That said, I have no idea how many changes are necessary, but I know how to find out: use grep (or select-string in powershell, which I have set as an alias):
Code:
> grep TV_MAGIC *.c
obj-desc.c:155:        case TV_MAGIC_BOOK:
obj-randart.c:429:           tval == TV_FOOD || tval == TV_MUSHROOM || tval == TV_MAGIC_BOOK ||
obj-tval.c:331:        case TV_MAGIC_BOOK:
store.c:671:        case TV_MAGIC_BOOK:
ui-knowledge.c:1347:    {TV_MAGIC_BOOK,        "Magic Book"    },
ui-knowledge.c:1860:        case TV_MAGIC_BOOK:
ui-options.c:1438:    { TV_MAGIC_BOOK,    "Magic books" },
ui-options.c:1588:        case TV_MAGIC_BOOK:
wiz-spoil.c:122:    { TV_MAGIC_BOOK,    "Books (Mage)" },
wiz-stats.c:934:        case TV_MAGIC_BOOK:{
Pete Mack is offline   Reply With Quote
Old July 12, 2016, 22:18   #35
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,578
Donated: $60
Nick is on a distinguished road
Thanks for all the updates. Ideally a whole new school of magic should be addable by the edit files, and once you get this working I should have a good idea what code changes need to happen for that to be possible.

It is precisely this sort of behaviour that has made Angband what it is today
__________________
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
Nick is offline   Reply With Quote
Old July 12, 2016, 23:56   #36
Elfin Jedi
Adept
 
Join Date: Mar 2013
Posts: 102
Elfin Jedi is on a distinguished road
Ok, I made changes to all of these (the others (obj-desc.c:155, obj-tval.c:331, ui-knowledge.c:1347, and wiz-stats.c:934) I had already edited, with the exception of wiz-stats.c:934 which said it didn't bother using priest books because they had the same probability as magic books.)

obj-randart.c:429: tval == TV_FOOD || tval == TV_MUSHROOM || tval == TV_MAGIC_BOOK ||
store.c:671: case TV_MAGIC_BOOK:
ui-knowledge.c:1860: case TV_MAGIC_BOOK:
ui-options.c:1438: { TV_MAGIC_BOOK, "Magic books" },
ui-options.c:1588: case TV_MAGIC_BOOK:
wiz-spoil.c:122: { TV_MAGIC_BOOK, "Books (Mage)" },

Unfortunately, the book names still aren't displaying. Maybe I need to look at ui-display.c or somewhere else dealing with displaying stuff?

And it is having trouble restocking store 9, approximately 50% of the 10 or so characters I started to test this (after the 1st one crashed) closed with an error that read: "unable to (re-)stock store 9, please report this bug."
Elfin Jedi is offline   Reply With Quote
Old July 12, 2016, 23:59   #37
Elfin Jedi
Adept
 
Join Date: Mar 2013
Posts: 102
Elfin Jedi is on a distinguished road
Thanks Nick
Elfin Jedi is offline   Reply With Quote
Old July 13, 2016, 00:56   #38
Elfin Jedi
Adept
 
Join Date: Mar 2013
Posts: 102
Elfin Jedi is on a distinguished road
And detecting monsters that aren't invisible, but not ones that are (permanently or temporarily):

effects.c

1368: /* Detect all non-invisible, obvious monsters */
1369: if (!rf_has(mon->race->flags, RF_INVISIBLE) || (mon->m_timed[MON_TMD_INVISIBLE]) &&
1370: !mflag_has(mon->mflag, MFLAG_UNAWARE)
1371: {
1372: /* Hack -- Detect the monster */
1373: mflag_on(mon->mflag, MFLAG_MARK);
1374: mflag_on(mon->mflag, MFLAG_SHOW);
1375:
1376: /* Update monster recall window */
1377: if (player->upkeep->monster_race == mon->race)
1378: /* Redraw stuff */
1379: player->upkeep->redraw |= (PR_MONSTER);
1380:
1381: /* Update the monster */
1382: update_mon(mon, cave, FALSE);
1383:
1384: /* Detect */
1385: monsters = TRUE;
1386: context->ident = TRUE;
1387: }
1388: }

is running into a few errors (involving these curvy brackets "{" "}" (I don't know what they are called, just that they begin and end sections of code)) & a warning:

effects.c:1369:84: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (!rf_has(mon->race->flags, RF_INVISIBLE) || (mon->m_timed[MON_TMD_INVISIBLE]) &&

effects.c:1371:3: error: expected ')' before '{' token
{
^
effects.c:1388:2: error: expected expression before '}' token
}
^
Elfin Jedi is offline   Reply With Quote
Old July 13, 2016, 02:04   #39
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,166
Donated: $40
Pete Mack is on a distinguished road
@EJ:
This is when I would start up the debugger. Have you tried making some of those books always rather than normal in the text file? (At the least, the beginners books need to be, to allow the start-with-gold-no start option.)
Pete Mack is offline   Reply With Quote
Old July 13, 2016, 02:13   #40
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,166
Donated: $40
Pete Mack is on a distinguished road
When you don't have matching openers and closers, the compiler gets horribly confused. In this case:
1369: if (!rf_has(mon->race->flags, RF_INVISIBLE) || (mon->m_timed[MON_TMD_INVISIBLE]) &&
1370: !mflag_has(mon->mflag, MFLAG_UNAWARE)
1371: {

is missing a closing ")"

The warning about && is because the precedence is sometimes non-intuitive (as in, it can get evaluated before you think it should.) And in this case, you want the || (OR) evaluated before the AND, so you absolutely need it. (In effect && has precedence like *, and || has precedence like +, so && is applied first.)

Here's the complete list:
http://en.cppreference.com/w/c/langu...tor_precedence
Pete Mack 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
[PosChengband] Making Realms Questions riftor_77 Development 5 August 4, 2014 12:24
Spellbooks as artifacts TJS Vanilla 48 July 29, 2010 05:12
Sangband and spell realms Malak Darkhunter Variants 21 March 18, 2009 04:03
Spellbooks curinor Variants 3 April 20, 2008 13:38
Spellbooks curinor Vanilla 1 April 19, 2008 22:07


All times are GMT +1. The time now is 06:36.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.