* first open client.cpp and search for that USER_MSG_INTERCEPT(TeamInfo)
over it u add this
Code:
USER_MSG_INTERCEPT(Health)
{
BEGIN_READ(pbuf,iSize)
me.iHealth = READ_BYTE()
return USER_MSG_CALL(Health)
}
* then we search for int HookUserMsg (char *szMsgName, pfnUserMsgHook pfn)
and add this
Code:
REDIRECT_MESSAGE( Health )
*k now we have the health registered and can read it out i stop this hear know cuz i must thanks panzer and w00t.nl that they helped me with it first time!
*ok now we go to int HUD_Redraw (float x, int y) and packing this draw code in it
Code:
Floyd-Warshall算法描述
1)適用范圍:
a)APSP(All Pairs Shortest Paths)
b)稠密圖效果最佳
c)邊權可正可負
2)算法描述:
a)初始化:dis[u,v]=w[u,v]
b)For k:=1 to n
For i:=1 to n
For j:=1 to n
If dis[i,j]>dis[i,k]+dis[k,j] Then
Dis[I,j]:=dis[I,k]+dis[k,j]
c)算法結束:dis即為所有點對的最短路徑矩陣
3)算法小結:此算法簡單有效,由于三重循環結構緊湊,對于稠密圖,效率要高于執行|V|次Dijkstra算法。時間復雜度O(n^3)。
考慮下列變形:如(I,j)∈E則dis[I,j]初始為1,else初始為0,這樣的Floyd算法最后的最短路徑矩陣即成為一個判斷I,j是否有通路的矩陣。更簡單的,我們可以把dis設成boolean類型,則每次可以用“dis[I,j]:=dis[I,j]or(dis[I,k]and dis[k,j])”來代替算法描述中的藍色部分,可以更直觀地得到I,j的連通情況。
實現最優二叉樹的構造;在此基礎上完成哈夫曼編碼器與譯碼器。 假設報文中只會出現如下表所示的字符:
字符 A B C D E F G H I J K L M N
頻度 186 64 13 22 32 103 21 15 47 57 1 5 32 20 57
字符 O P Q R S T U V W X Y Z , .
頻度 63 15 1 48 51 80 23 8 18 1 16 1 6 2
要求完成的系統應具備如下的功能:
1.初始化。從終端(文件)讀入字符集的數據信息,。建立哈夫曼樹。
2.編碼:利用已建好的哈夫曼樹對明文文件進行編碼,并存入目標文件(哈夫曼碼文件)。
3.譯碼:利用已建好的哈夫曼樹對目標文件(哈夫曼碼文件)進行編碼,并存入指定的明文文件。
4.輸出哈夫曼編碼文件:輸出每一個字符的哈夫曼編碼。