# HG changeset patch # User unc0rr # Date 1161986858 0 # Node ID a049157d673a154b7da0d4b4742c27c631ce6149 # Parent 28707778913279f8df7515c70bae6ff7e33d0bd5 Implement Knowledge Base for libs/compilers bugs diff -r 287077789132 -r a049157d673a QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Fri Oct 27 19:37:59 2006 +0000 +++ b/QTfrontend/CMakeLists.txt Fri Oct 27 22:07:38 2006 +0000 @@ -55,7 +55,8 @@ hwmap.h mapContainer.h tcpBase.h - about.h) + about.h + KB.h) set(hwfr_rez diff -r 287077789132 -r a049157d673a QTfrontend/KB.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/KB.h Fri Oct 27 22:07:38 2006 +0000 @@ -0,0 +1,34 @@ +/* + * Hedgewars, a worms-like game + * Copyright (c) 2006 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef KB_H +#define KB_H + +#include + +const ulong KBmsgsCount = 1; + +const QString KBMessages[KBmsgsCount] = +{ + QT_TRANSLATE_NOOP("KB", "SDL_ttf returned error while rendering text, " + "most propably it is related to the bug " + "in freetype2. It's recommended to update your " + "freetype lib.") +}; + +#endif // KB_H diff -r 287077789132 -r a049157d673a QTfrontend/game.cpp --- a/QTfrontend/game.cpp Fri Oct 27 19:37:59 2006 +0000 +++ b/QTfrontend/game.cpp Fri Oct 27 22:07:38 2006 +0000 @@ -29,6 +29,7 @@ #include "hwconsts.h" #include "gameuiconfig.h" #include "gamecfgwidget.h" +#include "kb.h" HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg) : TCPBase(true) @@ -126,6 +127,19 @@ QMessageBox::NoButton); return; } + case 'K': { + ulong kb = msg.mid(2).toULong(); + if (kb && kb <= KBmsgsCount) + { + QMessageBox::information(0, + "Hedgewars: information", + KBMessages[kb - 1], + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton); + } + return; + } case '+': { if (gameType == gtNet) { diff -r 287077789132 -r a049157d673a QTfrontend/hedgewars.pro --- a/QTfrontend/hedgewars.pro Fri Oct 27 19:37:59 2006 +0000 +++ b/QTfrontend/hedgewars.pro Fri Oct 27 22:07:38 2006 +0000 @@ -30,7 +30,8 @@ hwmap.h \ mapContainer.h \ tcpBase.h \ - about.h + about.h \ + KB.h SOURCES += game.cpp \ main.cpp \ diff -r 287077789132 -r a049157d673a hedgewars/hwengine.dpr --- a/hedgewars/hwengine.dpr Fri Oct 27 19:37:59 2006 +0000 +++ b/hedgewars/hwengine.dpr Fri Oct 27 22:07:38 2006 +0000 @@ -108,7 +108,7 @@ begin {$IFDEF DEBUGFILE}AddFileLog('Freeing resources...');{$ENDIF} if isSoundEnabled then ReleaseSound; -StoreRelease; +StoreRelease;SendKB; CloseIPC; TTF_Quit; SDL_Quit; diff -r 287077789132 -r a049157d673a hedgewars/uIO.pas --- a/hedgewars/uIO.pas Fri Oct 27 19:37:59 2006 +0000 +++ b/hedgewars/uIO.pas Fri Oct 27 22:07:38 2006 +0000 @@ -134,7 +134,10 @@ procedure SendIPCRaw(p: pointer; len: Longword); begin -SDLNet_TCP_Send(IPCSock, p, len) +if IPCSock <> nil then + begin + SDLNet_TCP_Send(IPCSock, p, len) + end end; procedure SendIPCXY(cmd: char; X, Y: SmallInt); diff -r 287077789132 -r a049157d673a hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Fri Oct 27 19:37:59 2006 +0000 +++ b/hedgewars/uMisc.pas Fri Oct 27 22:07:38 2006 +0000 @@ -100,12 +100,15 @@ procedure AddFileLog(s: shortstring); function RectToStr(Rect: TSDL_Rect): shortstring; {$ENDIF} +procedure SetKB(n: Longword); +procedure SendKB; var CursorPoint: TPoint; TargetPoint: TPoint = (X: NoPointX; Y: 0); implementation uses uConsole, uStore, uIO{$IFDEF FPC}, Math{$ENDIF}; +var KBnum: Longword = 0; {$IFDEF DEBUGFILE} var f: textfile; {$ENDIF} @@ -184,6 +187,21 @@ Result:= trunc(arctan2(_dY, _dX) * MaxAngleDivPI) mod cMaxAngle end; +procedure SetKB(n: Longword); +begin +KBnum:= n +end; + +procedure SendKB; +var s: shortstring; +begin +if KBnum <> 0 then + begin + s:= 'K' + inttostr(KBnum); + SendIPCRaw(@s, Length(s) + 1) + end +end; + {$IFDEF DEBUGFILE} procedure AddFileLog(s: shortstring); begin diff -r 287077789132 -r a049157d673a hedgewars/uStore.pas --- a/hedgewars/uStore.pas Fri Oct 27 19:37:59 2006 +0000 +++ b/hedgewars/uStore.pas Fri Oct 27 22:07:38 2006 +0000 @@ -376,7 +376,11 @@ clr.g:= $FF; clr.b:= $FF; tmpsurf:= TTF_RenderUTF8_Solid(Fontz[Font].Handle, PChar(s), clr.value); -SDLTry(tmpsurf <> nil, true); +if tmpsurf = nil then + begin + SetKB(1); + exit + end; SDL_UpperBlit(tmpsurf, nil, Surface, @r); SDL_FreeSurface(tmpsurf) end;