YTDB

YTDB (http://ytdb.ru/index.php)
-   Патчи (http://ytdb.ru/forumdisplay.php?f=26)
-   -   antimat crash fix (http://ytdb.ru/showthread.php?t=736)

Mr.Grom 24.11.2009 08:31

antimat crash fix
 
Фикс краша сервера при отсутствии файлов антимата.
PHP код:

diff --git a/src/game/ChatLexicsCutter.cpp b/src/game/ChatLexicsCutter.cpp
index e7fa2f2
..7e9c733 100644
--- a/src/game/ChatLexicsCutter.cpp
+++ b/src/game/ChatLexicsCutter.cpp
@@ -57,+57,@@ bool LexicsCutter::Read_Letter_Analogs(std::stringFileName)
     
std::string lanalog;
 
     
ma_file fopen(FileName.c_str(), "rb");
-
+    if (!
ma_file) return false;
     while (!
feof(ma_file))
     {
         
line***91;0***93; = 0x0;
@@ -
115,+115,@@ bool LexicsCutter::Read_Innormative_Words(std::stringFileName)
     
std::string lchar;
 
     
ma_file fopen(FileName.c_str(), "rb");
-
+    if (!
ma_file) return false;
     while (!
feof(ma_file))
     {
         
line***91;0***93; = 0x0


Insider 24.11.2009 18:47

А вы хотите чтобы потом спрашивали: а почему у меня неработает антимат? Вот так ведь же и будет...
Вот например sLog.outError("текст");
осталось только придумать текст на английском, так чтобы его можно было понять :D

Mr.Grom 24.11.2009 20:27

Тогда так,но надо тестить. Поправил.
PHP код:

diff --git a/src/game/ChatLexicsCutter.cpp b/src/game/ChatLexicsCutter.cpp
index e7fa2f2
..c06ef86 100644
--- a/src/game/ChatLexicsCutter.cpp
+++ b/src/game/ChatLexicsCutter.cpp
@@ -57,+57,11 @@ bool LexicsCutter::Read_Letter_Analogs(std::stringFileName)
     
std::string lanalog;
 
     
ma_file fopen(FileName.c_str(), "rb");
-
+    if (!
ma_file)
+    {
+    
sLog.outError("FileName `Read_Letter_Analogs` incomplete");
+    return 
false;
+    }
     while (!
feof(ma_file))
     {
         
line***91;0***93; = 0x0;
@@ -
115,+119,11 @@ bool LexicsCutter::Read_Innormative_Words(std::stringFileName)
     
std::string lchar;
 
     
ma_file fopen(FileName.c_str(), "rb");
-
+    if (!
ma_file)
+    {
+    
sLog.outError("FileName `Read_Innormative_Words` incomplete");
+    return 
false;
+    }
     while (!
feof(ma_file))
     {
         
line***91;0***93; = 0x0


srv38 25.11.2009 06:48

Дык теперь вроде всегда будет возвращатся
PHP код:

return false

может правильнее так :)

PHP код:

if (!ma_file
{
sLog.outError("FileName `Read_Letter_Analogs` incomplete");
return 
false



Mr.Grom 26.12.2009 16:28

Надо бы в патчи перенести тему.





++++++
Перенес.
YuruY


Текущее время: 13:38. Часовой пояс GMT +4.

YTDB - MaNGOS DataBase