1
Curses / Re: Terra Vitae Mod (version 1.4 released!)
« on: December 31, 2017, 01:18:03 am »
Can you upload it anywhere else temporarily? I really wanted to mess with it today.
March 6, 2024: Dwarf Fortress 50.12 has been released.
News: February 3, 2024: The February '24 Report is up.
News: February 4, 2021: Dwarf Fortress Talk #28 has been posted.
News: November 21, 2018: A new Threetoe story has been posted.
Forum Guidelines
Oh, you have GDB? Oh, wonderful! I have not been able to get it to run on my machine!Not sure what you need to do in Macs, but in Linux all you have to do is install it using you package manager.
sudo pacman -Syyu && sudo pacamn -S gdb
wget <URL>
cd teravita/src
patch -p3 --ignore-whitespace < ../../<Name Of Downloaded file>
Then hit enter a couple times to tell it to ignore the binary files. //Phase III - who lives and who dies
switch (alignment)
{
case ALIGN_ELITELIBERAL: //All good guys live, all bad guys die
amsurvival = -abs(amsurvival);
alsurvival = -abs(alsurvival);
hmsurvival = -abs(hmsurvival);
hlsurvival = -abs(hlsurvival);
break;
case ALIGN_LIBERAL: //One of the good guys dies, bad guys don't live
while (true)
{
randomint = LCSrandom(4);
if (randomint == 0 && pmsurvival)
{
pmsurvival = -1;
break;
}
else if (randomint == 1 && plsurvival)
{
plsurvival = -1;
break;
}
else if (randomint == 2 && smsurvival)
{
smsurvival = -1;
break;
}
else if (randomint == 3 && slsurvival)
{
slsurvival = -1;
break;
}
}
amsurvival = -abs(amsurvival);
alsurvival = -abs(alsurvival);
hmsurvival = -abs(hmsurvival);
hlsurvival = -abs(hlsurvival);
randomint = LCSrandom(abs(amsurvival) + abs(alsurvival) + abs(hmsurvival) + abs(hlsurvival));
break;
case ALIGN_MODERATE: //33% of survival for everybody, but somebody on each side survives.
if (LCSrandom(3))
pmsurvival = -abs(pmsurvival);
if (LCSrandom(3))
plsurvival = -abs(plsurvival);
if (LCSrandom(3))
smsurvival = -abs(smsurvival);
if (LCSrandom(3))
slsurvival = -abs(slsurvival);
if (LCSrandom(3))
amsurvival = -abs(amsurvival);
if (LCSrandom(3))
alsurvival = -abs(alsurvival);
if (LCSrandom(3))
hmsurvival = -abs(hmsurvival);
if (LCSrandom(3))
hlsurvival = -abs(hlsurvival);
while (!(pmsurvival || plsurvival || smsurvival || slsurvival))
{
randomint = LCSrandom(4);
if (randomint == 0 && abs(pmsurvival))
{
pmsurvival = 1;
}
else if (randomint == 1 && abs(plsurvival))
{
plsurvival = 1;
}
else if (randomint == 2 && abs(smsurvival))
{
smsurvival = 1;
}
else if (randomint == 3 && abs(slsurvival))
{
slsurvival = 1;
}
}
while (!(amsurvival || alsurvival || hmsurvival || hlsurvival))
{
randomint = LCSrandom(4);
if (randomint == 0 && abs(amsurvival))
{
amsurvival = 1;
}
else if (randomint == 1 && abs(alsurvival))
{
alsurvival = 1;
}
else if (randomint == 2 && abs(hmsurvival))
{
hmsurvival = 1;
}
else if (randomint == 3 && abs(hlsurvival))
{
hlsurvival = 1;
}
}
break;
case ALIGN_CONSERVATIVE: //One of the bad guys dies, one of the good guys lives
while (true)
{
randomint = LCSrandom(4);
if (randomint == 0 && pmsurvival)
{
pmsurvival = -1;
break;
}
else if (randomint == 1 && plsurvival)
{
plsurvival = -1;
break;
}
else if (randomint == 2 && smsurvival)
{
smsurvival = -1;
break;
}
else if (randomint == 3 && slsurvival)
{
slsurvival = -1;
break;
}
}
amsurvival = -abs(amsurvival);
alsurvival = -abs(alsurvival);
hmsurvival = -abs(hmsurvival);
hlsurvival = -abs(hlsurvival);
while (!(amsurvival || alsurvival || hmsurvival || hlsurvival))
{
randomint = LCSrandom(4);
if (randomint == 0 && abs(amsurvival))
{
amsurvival = 1;
}
else if (randomint == 1 && abs(alsurvival))
{
alsurvival = 1;
}
else if (randomint == 2 && abs(hmsurvival))
{
hmsurvival = 1;
}
else if (randomint == 3 && abs(hlsurvival))
{
hlsurvival = 1;
}
}
break;
case ALIGN_ARCHCONSERVATIVE: //good guys lose, bad guys win
amsurvival = -abs(amsurvival);
alsurvival = -abs(alsurvival);
hmsurvival = -abs(hmsurvival);
hlsurvival = -abs(hlsurvival);
break;
case ALIGN_STALINIST: //Only the "hero" survives - and the hero becomes evil by the end of the story
pmsurvival = abs(pmsurvival);
plsurvival = -abs(plsurvival);
smsurvival = -abs(smsurvival);
slsurvival = -abs(slsurvival);
amsurvival = -abs(amsurvival);
alsurvival = -abs(alsurvival);
hmsurvival = -abs(hmsurvival);
hlsurvival = -abs(hlsurvival);
break;
default: break;
}

(gdb) down
#3 0x0000000100047b13 in mode_title () at title/titlescreen.cpp:618
#2 0x00000001000761c3 in mode_base () at basemode/basemode.cpp:565
#1 0x0000000100145dd2 in passmonth (clearformess=@0x7fffffffd60b: 1 '\001', canseethings=canseethings@entry=0 '\000') at monthly/monthly.cpp:777
#0 0x000000010006fe3a in Advance_Movie (Film=0x1011bcbe0, canseethings=canseethings@entry=0 '\000') at monthly/tvrecord.cpp:982
advanceprob = 5000000 / Film->budget; │
to: if (Film->budget == 0)
{
Film->budget = -1;
}
advanceprob = 5000000 / Film->budget; │
fixes the problem. $ ag -Qi "saveTV1.3"
daily/daily.cpp
38: //*JDS* Save the game to saveTV1.3.dat each day.
39: if(!disbanding&&autosave) savegame("saveTV1.3.dat");
title/titlescreen.cpp
620: savegame("saveTV1.3.dat");
title/saveload.cpp
449:/* loads the game from saveTV1.3.dat */
1022:/* deletes saveTV1.3.dat (used on endgame and for invalid save version) */
includes.h
1481:/* loads the game from saveTV1.3.dat */
1483:/* deletes saveTV1.3.dat (used on endgame and for invalid save version) */
(gdb) dow
#0 TVRecord_InputSleeperView (viewnumber=viewnumber@entry=10, creaturetype=creaturetype@entry=61) at monthly/tvrecord.cpp:176
(gdb) print liblist
$40 = {30, 15, 12, 57, 88, 69, 91, 74, 87, 57, 69, 91, 74, 87, 57, 69, 74, 87, 13, 57, 91, 88, 77, 69, 91, 13, 74, 77, 87, 57, 88, 23, 33, 69, 91, 74, 87}
(gdb) print listlength
$41 = 118
(gdb) info watchpoint
Num Type Disp Enb Address What
8 hw watchpoint keep y *0x100c3a1d8
breakpoint already hit 1 time
0x100c3a1d8 is LocalCreature's address(gdb) print liblist[listlength]
$42 = 28
(gdb) print &(liblist[listlength])
$43 = (int *) 0x100c3a1d8 <namecreaturetype(int)::LocalCreature>
void TVRecord_InputSleeperView(int viewnumber, int creaturetype)
{
static int listlength = 0;
static int liblist[VIEWNUM], stalist[VIEWNUM];
int i, libcount, stacount, localview, numsleepers;
to this code:void TVRecord_InputSleeperView(int viewnumber, int creaturetype)
{
static int listlength = 0;
static int liblist[VIEWNUM], stalist[VIEWNUM];
int i, libcount, stacount, localview, numsleepers;
if (listlength >= VIEWNUM)
{
listlength = 0;
}
(gdb) down
#5 0x0000000100047b13 in mode_title () at title/titlescreen.cpp:618
#4 0x00000001000762e3 in mode_base () at basemode/basemode.cpp:565
#3 0x0000000100145ef2 in passmonth (clearformess=@0x7fffffffd17b: 1 '\001', canseethings=canseethings@entry=0 '\000') at monthly/monthly.cpp:777
#2 0x0000000100070c84 in Advance_Movie (Film=0x1011c3d60, canseethings=canseethings@entry=0 '\000') at monthly/tvrecord.cpp:1199
#1 0x000000010006ca95 in Narrate_Movie_Events (genre=<optimized out>, protagonistview=<optimized out>, antagonistview=<optimized out>, alignment=3,
canseethings=canseethings@entry=0 '\000') at monthly/tvrecord.cpp:3260
#0 0x0000000100069f04 in Kill_Movie_Character (characterindex=-1, andneeded=0, lovertakeupmysword=lovertakeupmysword@entry=0,
List=List@entry=0x7fffffffccf0 "Raghad Matthews,") at monthly/tvrecord.cpp:2594
Tried switching both instances with 39, 40 and 41, no cigar.QuoteNo symbol "len" in current context.Code: [Select]creature/creature.h: #define CREATURE_NAMELEN 40Code: [Select]title/saveload.cpp: fwrite(&lobbies[l]->LobbyName, sizeof(char), CREATURE_NAMELEN, h);
title/saveload.cpp: fread(&lobbies[l]->LobbyName, sizeof(char), CREATURE_NAMELEN, h);
Looks to me this is the code that needs changing.
A quick fix is to replace instances of "CREATURE_NAMELEN" with the number 40. Most, maybe all of them. Definitely its appearances in saveload.cpp
Hopefully that's enough.
"Quck change" should be just"creature/creature.h" is included by "includes.h" which is included by "extern.h" which is included by "title/saveload.cpp" so that should not be necessary.Code: [Select]#include "creature/creature.h"
(gdb) list
952 lobbies.resize(dummy);
953 for (int l = 0; l < len(lobbies); l++)
954 {
955 auto h2 = fopen("lobbies", "r");
956
957 fread(&lobbies[l]->LobbyName, sizeof(char), CREATURE_NAMELEN, h2);
958 fread(&lobbies[l]->LobbyCreatures, sizeof(int), CREATURENUM, h2);
959 fread(&lobbies[l]->LobbyLaws, sizeof(int), LAWNUM, h2);
960 fread(&lobbies[l]->spectrum, sizeof(int), 1, h2);
961 fread(&lobbies[l]->alignment_max_liberal, sizeof(int), 1, h2);
(gdb) print sizeof(char)
$13 = 1
(gdb) print lobbies
$14 = std::vector of length 2, capacity 2 = {0x0, 0x0}
(gdb) print l
$15 = 0
(gdb) print lobbies[l]
$16 = (Lobby *) 0x0
(gdb) print lobbies[l]
lobbies[l] = new Lobby;beforefread(&lobbies[l]->LobbyName, sizeof(char), CREATURE_NAMELEN, h);