Create item or monster in wizard mode
Any item can be created in wizard mode, with an Easter egg for gold.
I'm expanding this to create an item or monster. I'll push an update when ready.
Ok ready!
Awesome work! I can see this being really useful.
I'm getting a compilation error:
src/brogue/Items.c: In function ‘dialogSelectEntryFromList’:
src/brogue/Items.c:7888:14: error: implicit declaration of function ‘strnlen’; did you mean ‘strlen’? [-Werror=implicit-function-declaration]
maxLen = strnlen(windowTitle, COLS);
^~~~~~~
strlen
It looks like strnlen isn't actually in the C standard; is there any reason not to just use strlen here?
I also get this warning:
src/brogue/Items.c:7898:45: warning: ‘%s’ directive output may be truncated writing up to 299 bytes into a region of size 97 [-Wformat-truncation=]
snprintf(buttonText, COLS, "%c) %s", (int)buttons[i].hotkey[0], buttons[i].text);
^~
Also, items.c is really long already, and some of the code this adds to it isn't related to items; could you consider moving most of the new code to a new file called wizard.c or wizmode.c or something like that?
I plan to do some playtesting so I'll probably have more comments later.
Issues seen so far:
- Eels, krakens, phoenix eggs, phylacteries, goblin/ogre totems, winged guardians, spectral blades, and a few others can only be created inside walls
- If you create a phoenix or lich, it doesn't spawn an egg/phylactery when killed.
- If you try to make an item with more than 50 enchants, it should probably set the enchantment level to 50 rather than using the default
- Could you change the word "gem" to "lumenstone", for clarity?
- Can the message "Your pack now contains %s" be changed to mention the inventory letter, like the message when you pick up an item?
- The new command seems to always be available, even outside of debug builds and wizard mode
Thanks for the feedback! I fixed most of the issues. Still need to move code to a separate file as suggested. I'll try and wrap up in the next few days.
Thanks! It looks like part of #475 was undone by the merge; could you double-check the changes to IO.c to avoid re-adding some of the removed code?
Ok done! Check it out and let me know if you find anything else.
Ok I pushed an update. Yes, the limitation on creating allies is intended. Allies are limited to monsters that can be dominated. Also I forgot to mention earlier that in one of the previous updates I added a mutation selector for monsters.
I found another small bug: if you create a monster in a location that will overlap the "Make the <x> your ally?" prompt, the new monster's icon will be displayed on top of the message, overwriting one of the letters in the message.
The code could use another pass to make spacing around operators and other symbols more consistent, e.g. making sure there's always a space before opening braces and a space after each comma. ~~Also, I'd prefer declaring each variable where it's first used, instead of declaring them all at the top of each function~~ (actually, probably don't bother with this for now; this PR is useful enough for debugging/testing that I'd prefer for it to be merged sooner rather than for it to be delayed by things like this).