Skip to content

Commit 1205611

Browse files
finduraffinduraf
finduraf
authored and
finduraf
committed
fix: BlurMemory and Amnesia fail in wilderness
1 parent e836ef7 commit 1205611

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

Diff for: Main/Source/bodypart.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -3564,17 +3564,21 @@ void head::SignalPossibleUsabilityChange()
35643564
if(RAND_N(5))
35653565
{
35663566
ADD_MESSAGE("Your memory becomes blurred.");
3567-
GetLevel()->Amnesia(25 + RAND_N(50));
35683567
Master->EditExperience(INTELLIGENCE, -80, 1 << 13);
3569-
game::SendLOSUpdateRequest();
3568+
if(!game::IsInWilderness()) {
3569+
GetLevel()->Amnesia(25 + RAND_N(50));
3570+
game::SendLOSUpdateRequest();
3571+
}
35703572
}
35713573
else
35723574
{
35733575
ADD_MESSAGE("A terrible concussion garbles your consciousness.");
35743576
Master->BeginTemporaryState(CONFUSED, 5000 + RAND_N(5000));
35753577
Master->EditExperience(INTELLIGENCE, -100, 1 << 14);
3576-
GetLevel()->BlurMemory();
3577-
game::SendLOSUpdateRequest();
3578+
if(!game::IsInWilderness()) {
3579+
GetLevel()->BlurMemory();
3580+
game::SendLOSUpdateRequest();
3581+
}
35783582
}
35793583
}
35803584
else

Diff for: Main/Source/char.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5042,7 +5042,7 @@ void character::DoDetecting()
50425042
if(Squares > GetAttribute(INTELLIGENCE) * (25 + RAND() % 51))
50435043
{
50445044
ADD_MESSAGE("An enormous burst of geographical information overwhelms your consciousness. Your mind cannot cope with it and your memories blur.");
5045-
Level->BlurMemory();
5045+
Level->BlurMemory(); // !game::IsInWilderness() is already checked by DetectHandler()
50465046
BeginTemporaryState(CONFUSED, 1000 + RAND() % 1000);
50475047
EditExperience(INTELLIGENCE, -100, 1 << 12);
50485048
}

Diff for: Main/Source/dungeon.cpp

+9-13
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ truth dungeon::PrepareLevel(int Index, truth Visual)
9494
{
9595
festring fsGenLoopDL;{const char* pc = std::getenv("IVAN_DebugGenDungeonLevelLoopID");if(pc!=NULL)fsGenLoopDL<<pc;}
9696
int iGenLoopMax=250;{const char* pc = std::getenv("IVAN_DebugGenDungeonLevelLoopMax");if(pc!=NULL)iGenLoopMax=atoi(pc);}
97-
97+
9898
festring fsDL;fsDL<<GetIndex()<<Index;
9999
int iRetryMax = fsGenLoopDL==fsDL ? iGenLoopMax : 10;
100-
100+
101101
DBG3("GeneratingDungeonLevel",fsDL.CStr(),fsGenLoopDL.CStr());
102-
102+
103103
level* NewLevel=NULL;
104104
cbitmap* EnterImage=NULL;
105105
for(int i=0;i<iRetryMax;i++){
106106
try{
107107
if(!genericException::ToggleGenNewLvl())ABORT("expecting gen lvl to become: true");
108-
108+
109109
NewLevel = Level[Index] = new level;
110110
NewLevel->SetDungeon(this);
111111
NewLevel->SetIndex(Index);
@@ -123,11 +123,11 @@ truth dungeon::PrepareLevel(int Index, truth Visual)
123123
game::SetEnterTextDisplacement(Displacement);
124124
game::TextScreen(CONST_S("Entering ") + GetLevelDescription(Index)
125125
+ CONST_S("...\n\nThis may take some time, please wait."),
126-
Displacement, WHITE, false,
126+
Displacement, WHITE, false,
127127
true, &game::BusyAnimation);
128128
game::TextScreen(CONST_S("Entering ") + GetLevelDescription(Index)
129129
+ CONST_S("...\n\nPress any key to continue."),
130-
Displacement, WHITE, game::GetAutoPlayMode()<2,
130+
Displacement, WHITE, game::GetAutoPlayMode()<2,
131131
false, &game::BusyAnimation);
132132
game::SetEnterImage(0);
133133
delete EnterImage;
@@ -158,7 +158,7 @@ truth dungeon::PrepareLevel(int Index, truth Visual)
158158
//TODO it is not working well, memory usage keeps increasing...
159159
if(NewLevel ){delete NewLevel ;NewLevel=NULL;}
160160
if(EnterImage){delete EnterImage;EnterImage=NULL;}
161-
161+
162162
//retry
163163
}
164164
} //for()
@@ -210,10 +210,6 @@ void dungeon::PrepareMusic(int Index)
210210
}
211211
audio::SetPlaybackStatus(audio::PLAYING);
212212
}
213-
214-
215-
216-
217213
}
218214

219215
void dungeon::SaveLevel(cfestring& SaveName, int Number, truth DeleteAfterwards)
@@ -312,7 +308,7 @@ inputfile& operator>>(inputfile& SaveFile, dungeon*& Dungeon)
312308

313309
/**
314310
* The wrong luminance saved to a lsquare problem
315-
* may happen after craft/split eg.: a blue crystal stone,
311+
* may happen after craft/split e.g.: a blue crystal stone,
316312
* then you save the game and re-load it and the luminance would be still there.
317313
* TODO this workaround will not be necessary when the problem is fixed on it's origin
318314
*/
@@ -333,7 +329,7 @@ level* dungeon::LoadLevel(inputfile& SaveFile, int Number)
333329
Level[Number]->SetLevelScript(GetLevelScript(Number));
334330
PrepareMusic(Number);
335331
WorkaroundFixLuminance(Level[Number]);
336-
332+
337333
return Level[Number];
338334
}
339335

Diff for: Main/Source/miscitem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3087,7 +3087,7 @@ void scrollofdetectmaterial::FinishReading(character* Reader)
30873087
{
30883088
ADD_MESSAGE("An enormous burst of geographical information overwhelms your "
30893089
"consciousness. Your mind cannot cope with it and your memories blur.");
3090-
Level->BlurMemory();
3090+
Level->BlurMemory(); // !game::IsInWilderness() is already handled by reading command
30913091
Reader->BeginTemporaryState(CONFUSED, 1000 + RAND() % 1000);
30923092
Reader->EditExperience(INTELLIGENCE, -100, 1 << 12);
30933093
}

0 commit comments

Comments
 (0)