wpdev-commits Mailing List for Wolfpack Emu (Page 68)
Brought to you by:
rip,
thiagocorrea
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(121) |
Sep
(256) |
Oct
(59) |
Nov
(73) |
Dec
(120) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(259) |
Feb
(381) |
Mar
(501) |
Apr
(355) |
May
(427) |
Jun
(270) |
Jul
(394) |
Aug
(412) |
Sep
(724) |
Oct
(578) |
Nov
(65) |
Dec
|
From: Correa <thi...@us...> - 2004-08-12 12:13:44
|
Update of /cvsroot/wpdev/wolfpack/twofish In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20217 Modified Files: aes.h debug.h table.h twofish2.c Log Message: applied coding standard rules. Index: table.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/twofish/table.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** table.h 24 Jun 2003 18:30:45 -0000 1.3 --- table.h 12 Aug 2004 12:13:33 -0000 1.4 *************** *** 48,64 **** * * Min Hamming weight (one byte difference) = 8. Max=26. Total = 1020. ! * Prob[8]: 7 23 42 20 52 95 88 94 121 128 91 ! * 102 76 41 24 8 4 1 3 0 0 0 ! * Runs[8]: 2 4 5 6 7 8 9 11 ! * MSBs[8]: 1 4 15 8 18 38 40 43 * HW= 8: 05040705 0A080E0A 14101C14 28203828 50407050 01499101 A080E0A0 * HW= 9: 04050707 080A0E0E 10141C1C 20283838 40507070 80A0E0E0 C6432020 07070504 ! * 0E0E0A08 1C1C1410 38382820 70705040 E0E0A080 202043C6 05070407 0A0E080E ! * 141C101C 28382038 50704070 A0E080E0 4320C620 02924B02 089A4508 * Min Hamming weight (two byte difference) = 3. Max=28. Total = 390150. ! * Prob[3]: 7 18 55 149 270 914 2185 5761 11363 20719 32079 ! * 43492 51612 53851 52098 42015 31117 20854 11538 6223 2492 1033 * MDS OK, ROR: 6+ 7+ 8+ 9+ 10+ 11+ 12+ 13+ 14+ 15+ 16+ ! * 17+ 18+ 19+ 20+ 21+ 22+ 23+ 24+ 25+ 26+ */ #define MDS_GF_FDBK 0x169 /* primitive polynomial for GF(256)*/ --- 48,64 ---- * * Min Hamming weight (one byte difference) = 8. Max=26. Total = 1020. ! * Prob[8]: 7 23 42 20 52 95 88 94 121 128 91 ! * 102 76 41 24 8 4 1 3 0 0 0 ! * Runs[8]: 2 4 5 6 7 8 9 11 ! * MSBs[8]: 1 4 15 8 18 38 40 43 * HW= 8: 05040705 0A080E0A 14101C14 28203828 50407050 01499101 A080E0A0 * HW= 9: 04050707 080A0E0E 10141C1C 20283838 40507070 80A0E0E0 C6432020 07070504 ! * 0E0E0A08 1C1C1410 38382820 70705040 E0E0A080 202043C6 05070407 0A0E080E ! * 141C101C 28382038 50704070 A0E080E0 4320C620 02924B02 089A4508 * Min Hamming weight (two byte difference) = 3. Max=28. Total = 390150. ! * Prob[3]: 7 18 55 149 270 914 2185 5761 11363 20719 32079 ! * 43492 51612 53851 52098 42015 31117 20854 11538 6223 2492 1033 * MDS OK, ROR: 6+ 7+ 8+ 9+ 10+ 11+ 12+ 13+ 14+ 15+ 16+ ! * 17+ 18+ 19+ 20+ 21+ 22+ 23+ 24+ 25+ 26+ */ #define MDS_GF_FDBK 0x169 /* primitive polynomial for GF(256)*/ *************** *** 68,72 **** #define Mx_1(x) ((DWORD) (x)) /* force result to dword so << will work */ ! #define Mx_X(x) ((DWORD) ((x) ^ LFSR2(x))) /* 5B */ #define Mx_Y(x) ((DWORD) ((x) ^ LFSR1(x) ^ LFSR2(x))) /* EF */ --- 68,72 ---- #define Mx_1(x) ((DWORD) (x)) /* force result to dword so << will work */ ! #define Mx_X(x) ((DWORD) ((x) ^ LFSR2(x))) /* 5B */ #define Mx_Y(x) ((DWORD) ((x) ^ LFSR1(x) ^ LFSR2(x))) /* EF */ *************** *** 138,145 **** * log2(skDup[ 0.. 6])= --- 2.37 0.44 3.94 8.36 13.04 17.99 ***********************************************************************/ ! CONST BYTE P8x8[2][256]= ! { /* p0: */ ! /* dpMax = 10. lpMax = 64. cycleCnt= 1 1 1 0. */ /* 817D6F320B59ECA4.ECB81235F4A6709D.BA5E6D90C8F32471.D7F4126E9B3085CA. */ /* Karnaugh maps: --- 138,145 ---- * log2(skDup[ 0.. 6])= --- 2.37 0.44 3.94 8.36 13.04 17.99 ***********************************************************************/ ! CONST BYTE P8x8[2][256] = ! { /* p0: */ ! /* dpMax = 10. lpMax = 64. cycleCnt= 1 1 1 0. */ /* 817D6F320B59ECA4.ECB81235F4A6709D.BA5E6D90C8F32471.D7F4126E9B3085CA. */ /* Karnaugh maps: *************** *** 149,188 **** * 0111 0100 0001 0110. 1000 1011 1110 1001. 0011 0011 1001 1101. 1101 0101 0000 1100. */ ! { ! 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, ! 0x9A, 0x92, 0x80, 0x78, 0xE4, 0xDD, 0xD1, 0x38, ! 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, ! 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, ! 0xF2, 0xD0, 0x8B, 0x30, 0x84, 0x54, 0xDF, 0x23, ! 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, ! 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, ! 0xA6, 0xEB, 0xA5, 0xBE, 0x16, 0x0C, 0xE3, 0x61, ! 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, ! 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, ! 0xE1, 0xE6, 0xBD, 0x45, 0xE2, 0xF4, 0xB6, 0x66, ! 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, ! 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, ! 0xEA, 0x77, 0x39, 0xAF, 0x33, 0xC9, 0x62, 0x71, ! 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, ! 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, ! 0xA1, 0x1D, 0xAA, 0xED, 0x06, 0x70, 0xB2, 0xD2, ! 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, ! 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, ! 0x9E, 0x9C, 0x52, 0x1B, 0x5F, 0x93, 0x0A, 0xEF, ! 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, ! 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, ! 0x2A, 0xCE, 0xCB, 0x2F, 0xFC, 0x97, 0x05, 0x7A, ! 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, ! 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, ! 0xB8, 0xDA, 0xB0, 0x17, 0x55, 0x1F, 0x8A, 0x7D, ! 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, ! 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, ! 0x6E, 0x50, 0xDE, 0x68, 0x65, 0xBC, 0xDB, 0xF8, ! 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, ! 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, ! 0x6F, 0x9D, 0x36, 0x42, 0x4A, 0x5E, 0xC1, 0xE0 ! }, /* p1: */ ! /* dpMax = 10. lpMax = 64. cycleCnt= 2 0 0 1. */ /* 28BDF76E31940AC5.1E2B4C376DA5F908.4C75169A0ED82B3F.B951C3DE647F208A. */ /* Karnaugh maps: --- 149,188 ---- * 0111 0100 0001 0110. 1000 1011 1110 1001. 0011 0011 1001 1101. 1101 0101 0000 1100. */ ! { ! 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, ! 0x9A, 0x92, 0x80, 0x78, 0xE4, 0xDD, 0xD1, 0x38, ! 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, ! 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, ! 0xF2, 0xD0, 0x8B, 0x30, 0x84, 0x54, 0xDF, 0x23, ! 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, ! 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, ! 0xA6, 0xEB, 0xA5, 0xBE, 0x16, 0x0C, 0xE3, 0x61, ! 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, ! 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, ! 0xE1, 0xE6, 0xBD, 0x45, 0xE2, 0xF4, 0xB6, 0x66, ! 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, ! 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, ! 0xEA, 0x77, 0x39, 0xAF, 0x33, 0xC9, 0x62, 0x71, ! 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, ! 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, ! 0xA1, 0x1D, 0xAA, 0xED, 0x06, 0x70, 0xB2, 0xD2, ! 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, ! 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, ! 0x9E, 0x9C, 0x52, 0x1B, 0x5F, 0x93, 0x0A, 0xEF, ! 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, ! 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, ! 0x2A, 0xCE, 0xCB, 0x2F, 0xFC, 0x97, 0x05, 0x7A, ! 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, ! 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, ! 0xB8, 0xDA, 0xB0, 0x17, 0x55, 0x1F, 0x8A, 0x7D, ! 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, ! 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, ! 0x6E, 0x50, 0xDE, 0x68, 0x65, 0xBC, 0xDB, 0xF8, ! 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, ! 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, ! 0x6F, 0x9D, 0x36, 0x42, 0x4A, 0x5E, 0xC1, 0xE0 ! }, /* p1: */ ! /* dpMax = 10. lpMax = 64. cycleCnt= 2 0 0 1. */ /* 28BDF76E31940AC5.1E2B4C376DA5F908.4C75169A0ED82B3F.B951C3DE647F208A. */ /* Karnaugh maps: *************** *** 192,228 **** * 1101 1000 0010 0001. 0110 1001 1110 0101. 0001 0100 0101 0111. 0011 1011 1111 0010. */ ! { ! 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, ! 0x4A, 0xD3, 0xE6, 0x6B, 0x45, 0x7D, 0xE8, 0x4B, ! 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, ! 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, ! 0x5E, 0xBA, 0xAE, 0x5B, 0x8A, 0x00, 0xBC, 0x9D, ! 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, ! 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, ! 0xB2, 0x73, 0x4C, 0x54, 0x92, 0x74, 0x36, 0x51, ! 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, ! 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, ! 0x13, 0x95, 0x9C, 0xC7, 0x24, 0x46, 0x3B, 0x70, ! 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, ! 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, ! 0x03, 0x6F, 0x08, 0xBF, 0x40, 0xE7, 0x2B, 0xE2, ! 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, ! 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, ! 0x66, 0x94, 0xA1, 0x1D, 0x3D, 0xF0, 0xDE, 0xB3, ! 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, ! 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, ! 0x81, 0x88, 0xEE, 0x21, 0xC4, 0x1A, 0xEB, 0xD9, ! 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, ! 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, ! 0x4F, 0xF2, 0x65, 0x8E, 0x78, 0x5C, 0x58, 0x19, ! 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, ! 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, ! 0xCE, 0xE9, 0x68, 0x44, 0xE0, 0x4D, 0x43, 0x69, ! 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, ! 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, ! 0x22, 0xC9, 0xC0, 0x9B, 0x89, 0xD4, 0xED, 0xAB, ! 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, ! 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, ! 0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xBE, 0x91 ! } ! }; --- 192,228 ---- * 1101 1000 0010 0001. 0110 1001 1110 0101. 0001 0100 0101 0111. 0011 1011 1111 0010. */ ! { ! 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, ! 0x4A, 0xD3, 0xE6, 0x6B, 0x45, 0x7D, 0xE8, 0x4B, ! 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, ! 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, ! 0x5E, 0xBA, 0xAE, 0x5B, 0x8A, 0x00, 0xBC, 0x9D, ! 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, ! 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, ! 0xB2, 0x73, 0x4C, 0x54, 0x92, 0x74, 0x36, 0x51, ! 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, ! 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, ! 0x13, 0x95, 0x9C, 0xC7, 0x24, 0x46, 0x3B, 0x70, ! 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, ! 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, ! 0x03, 0x6F, 0x08, 0xBF, 0x40, 0xE7, 0x2B, 0xE2, ! 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, ! 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, ! 0x66, 0x94, 0xA1, 0x1D, 0x3D, 0xF0, 0xDE, 0xB3, ! 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, ! 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, ! 0x81, 0x88, 0xEE, 0x21, 0xC4, 0x1A, 0xEB, 0xD9, ! 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, ! 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, ! 0x4F, 0xF2, 0x65, 0x8E, 0x78, 0x5C, 0x58, 0x19, ! 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, ! 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, ! 0xCE, 0xE9, 0x68, 0x44, 0xE0, 0x4D, 0x43, 0x69, ! 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, ! 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, ! 0x22, 0xC9, 0xC0, 0x9B, 0x89, 0xD4, 0xED, 0xAB, ! 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, ! 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, ! 0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xBE, 0x91 ! } ! }; Index: aes.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/twofish/aes.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** aes.h 30 Jun 2003 00:39:14 -0000 1.5 --- aes.h 12 Aug 2004 12:13:33 -0000 1.6 *************** *** 82,141 **** /* The structure for key information */ ! typedef struct ! { BYTE direction; /* Key used for encrypting or decrypting? */ #if ALIGN32 BYTE dummyAlign[3]; /* keep 32-bit alignment */ #endif ! int keyLen; /* Length of the key */ ! char keyMaterial[MAX_KEY_SIZE+4];/* Raw key data in ASCII */ /* Twofish-specific parameters: */ DWORD keySig; /* set to VALID_SIG by makeKey() */ ! int numRounds; /* number of rounds in cipher */ ! DWORD key32[MAX_KEY_BITS/32]; /* actual key bits, in dwords */ ! DWORD sboxKeys[MAX_KEY_BITS/64];/* key bits used for S-boxes */ DWORD subKeys[TOTAL_SUBKEYS]; /* round subkeys, input/output whitening bits */ #if REENTRANT fullSbox sBox8x32; /* fully expanded S-box */ ! #if defined(COMPILE_KEY) && defined(USE_ASM) #undef VALID_SIG #define VALID_SIG 0x504D4F43 /* 'COMP': C is compiled with -DCOMPILE_KEY */ DWORD cSig1; /* set after first "compile" (zero at "init") */ ! void *encryptFuncPtr; /* ptr to asm encrypt function */ ! void *decryptFuncPtr; /* ptr to asm decrypt function */ DWORD codeSize; /* size of compiledCode */ DWORD cSig2; /* set after first "compile" */ ! BYTE compiledCode[5000]; /* make room for the code itself */ ! #endif #endif ! } keyInstance; /* The structure for cipher information */ ! typedef struct ! { ! BYTE mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */ #if ALIGN32 BYTE dummyAlign[3]; /* keep 32-bit alignment */ #endif ! BYTE IV[MAX_IV_SIZE]; /* CFB1 iv bytes (CBC uses iv32) */ /* Twofish-specific parameters: */ DWORD cipherSig; /* set to VALID_SIG by cipherInit() */ ! DWORD iv32[BLOCK_SIZE/32]; /* CBC IV bytes arranged as dwords */ ! } cipherInstance; /* Function protoypes */ ! int makeKey(keyInstance *key, BYTE direction, int keyLen, char *keyMaterial); ! int cipherInit(cipherInstance *cipher, BYTE mode, char *IV); ! int blockEncrypt(cipherInstance *cipher, keyInstance *key, BYTE *input, ! int inputLen, BYTE *outBuffer); ! int blockDecrypt(cipherInstance *cipher, keyInstance *key, BYTE *input, ! int inputLen, BYTE *outBuffer); ! int reKey(keyInstance *key); /* do key schedule using modified key.keyDwords */ /* API to check table usage, for use in ECB_TBL KAT */ --- 82,139 ---- /* The structure for key information */ ! typedef struct ! { BYTE direction; /* Key used for encrypting or decrypting? */ #if ALIGN32 BYTE dummyAlign[3]; /* keep 32-bit alignment */ #endif ! int keyLen; /* Length of the key */ ! char keyMaterial[MAX_KEY_SIZE + 4];/* Raw key data in ASCII */ /* Twofish-specific parameters: */ DWORD keySig; /* set to VALID_SIG by makeKey() */ ! int numRounds; /* number of rounds in cipher */ ! DWORD key32[MAX_KEY_BITS / 32]; /* actual key bits, in dwords */ ! DWORD sboxKeys[MAX_KEY_BITS / 64];/* key bits used for S-boxes */ DWORD subKeys[TOTAL_SUBKEYS]; /* round subkeys, input/output whitening bits */ #if REENTRANT fullSbox sBox8x32; /* fully expanded S-box */ ! #if defined(COMPILE_KEY) && defined(USE_ASM) #undef VALID_SIG #define VALID_SIG 0x504D4F43 /* 'COMP': C is compiled with -DCOMPILE_KEY */ DWORD cSig1; /* set after first "compile" (zero at "init") */ ! void* encryptFuncPtr; /* ptr to asm encrypt function */ ! void* decryptFuncPtr; /* ptr to asm decrypt function */ DWORD codeSize; /* size of compiledCode */ DWORD cSig2; /* set after first "compile" */ ! BYTE compiledCode[5000]; /* make room for the code itself */ #endif ! #endif ! } keyInstance; /* The structure for cipher information */ ! typedef struct ! { ! BYTE mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */ #if ALIGN32 BYTE dummyAlign[3]; /* keep 32-bit alignment */ #endif ! BYTE IV[MAX_IV_SIZE]; /* CFB1 iv bytes (CBC uses iv32) */ /* Twofish-specific parameters: */ DWORD cipherSig; /* set to VALID_SIG by cipherInit() */ ! DWORD iv32[BLOCK_SIZE / 32]; /* CBC IV bytes arranged as dwords */ ! } cipherInstance; /* Function protoypes */ ! int makeKey( keyInstance* key, BYTE direction, int keyLen, char* keyMaterial ); ! int cipherInit( cipherInstance* cipher, BYTE mode, char* IV ); ! int blockEncrypt( cipherInstance* cipher, keyInstance* key, BYTE* input, int inputLen, BYTE* outBuffer ); ! int blockDecrypt( cipherInstance* cipher, keyInstance* key, BYTE* input, int inputLen, BYTE* outBuffer ); ! int reKey( keyInstance* key ); /* do key schedule using modified key.keyDwords */ /* API to check table usage, for use in ECB_TBL KAT */ *************** *** 145,149 **** #define TAB_QUERY 3 #define TAB_MIN_QUERY 50 ! int TableOp(int op); #ifndef CONST // warning C4005: 'CONST' : macro redefinition \microsoft visual studio\vc98\include\windef.h(138) : see previous definition of 'CONST' --- 143,147 ---- #define TAB_QUERY 3 #define TAB_MIN_QUERY 50 ! int TableOp( int op ); #ifndef CONST // warning C4005: 'CONST' : macro redefinition \microsoft visual studio\vc98\include\windef.h(138) : see previous definition of 'CONST' *************** *** 200,269 **** #define MAX_BLK_CNT 4 /* max # blocks per call in TestTwofish */ ! int TestTwofish(int mode,int keySize) /* keySize must be 128, 192, or 256 */ ! { /* return 0 iff test passes */ ! keyInstance ki; /* key information, including tables */ cipherInstance ci; /* keeps mode (ECB, CBC) and IV */ ! BYTE plainText[MAX_BLK_CNT*(BLOCK_SIZE/8)]; ! BYTE cipherText[MAX_BLK_CNT*(BLOCK_SIZE/8)]; ! BYTE decryptOut[MAX_BLK_CNT*(BLOCK_SIZE/8)]; ! BYTE iv[BLOCK_SIZE/8]; ! int i,byteCnt; ! if (makeKey(&ki,DIR_ENCRYPT,keySize,NULL) != TRUE) return 1; /* 'dummy' setup for a 128-bit key */ ! if (cipherInit(&ci,mode,NULL) != TRUE) return 1; /* 'dummy' setup for cipher */ - - for (i=0;i<keySize/32;i++) /* select key bits */ - ki.key32[i]=0x10003 * rand(); - reKey(&ki); /* run the key schedule */ ! if (mode != MODE_ECB) /* set up random iv (if needed)*/ ! { ! for (i=0;i<sizeof(iv);i++) ! iv[i]=(BYTE) rand(); ! memcpy(ci.iv32,iv,sizeof(ci.iv32)); /* copy the IV to ci */ ! } /* select number of bytes to encrypt (multiple of block) */ /* e.g., byteCnt = 16, 32, 48, 64 */ ! byteCnt = (BLOCK_SIZE/8) * (1 + (rand() % MAX_BLK_CNT)); - for (i=0;i<byteCnt;i++) /* generate test data */ - plainText[i]=(BYTE) rand(); - /* encrypt the bytes */ ! if (blockEncrypt(&ci,&ki, plainText,byteCnt*8,cipherText) != byteCnt*8) return 1; /* decrypt the bytes */ ! if (mode != MODE_ECB) /* first re-init the IV (if needed) */ ! memcpy(ci.iv32,iv,sizeof(ci.iv32)); ! if (blockDecrypt(&ci,&ki,cipherText,byteCnt*8,decryptOut) != byteCnt*8) return 1; ! /* make sure the decrypt output matches original plaintext */ ! if (memcmp(plainText,decryptOut,byteCnt)) return 1; return 0; /* tests passed! */ ! } ! void main(void) ! { ! int testCnt,keySize; ! srand((unsigned) time(NULL)); /* randomize */ ! for (keySize=128;keySize<=256;keySize+=64) ! for (testCnt=0;testCnt<10;testCnt++) { ! if (TestTwofish(MODE_ECB,keySize)) ! { printf("ECB Failure at keySize=%d",keySize); return; } ! if (TestTwofish(MODE_CBC,keySize)) ! { printf("CBC Failure at keySize=%d",keySize); return; } } ! printf("Tests passed"); ! } #endif /* TEST_2FISH */ \ No newline at end of file --- 198,272 ---- #define MAX_BLK_CNT 4 /* max # blocks per call in TestTwofish */ ! int TestTwofish( int mode, int keySize ) /* keySize must be 128, 192, or 256 */ ! { ! /* return 0 iff test passes */ ! keyInstance ki; /* key information, including tables */ cipherInstance ci; /* keeps mode (ECB, CBC) and IV */ ! BYTE plainText[MAX_BLK_CNT*( BLOCK_SIZE / 8 )]; ! BYTE cipherText[MAX_BLK_CNT*( BLOCK_SIZE / 8 )]; ! BYTE decryptOut[MAX_BLK_CNT*( BLOCK_SIZE / 8 )]; ! BYTE iv[BLOCK_SIZE / 8]; ! int i, byteCnt; ! if ( makeKey( &ki, DIR_ENCRYPT, keySize, NULL ) != TRUE ) return 1; /* 'dummy' setup for a 128-bit key */ ! if ( cipherInit( &ci, mode, NULL ) != TRUE ) return 1; /* 'dummy' setup for cipher */ ! for ( i = 0; i < keySize / 32; i++ ) /* select key bits */ ! ki.key32[i] = 0x10003 * rand(); ! reKey( &ki ); /* run the key schedule */ ! ! if ( mode != MODE_ECB ) /* set up random iv (if needed)*/ ! { ! for ( i = 0; i < sizeof( iv ); i++ ) ! iv[i] = ( BYTE ) rand(); ! memcpy( ci.iv32, iv, sizeof( ci.iv32 ) ); /* copy the IV to ci */ ! } /* select number of bytes to encrypt (multiple of block) */ /* e.g., byteCnt = 16, 32, 48, 64 */ ! byteCnt = ( BLOCK_SIZE / 8 ) * ( 1 + ( rand() % MAX_BLK_CNT ) ); ! ! for ( i = 0; i < byteCnt; i++ ) /* generate test data */ ! plainText[i] = ( BYTE ) rand(); /* encrypt the bytes */ ! if ( blockEncrypt( &ci, &ki, plainText, byteCnt * 8, cipherText ) != byteCnt * 8 ) return 1; /* decrypt the bytes */ ! if ( mode != MODE_ECB ) /* first re-init the IV (if needed) */ ! memcpy( ci.iv32, iv, sizeof( ci.iv32 ) ); ! if ( blockDecrypt( &ci, &ki, cipherText, byteCnt * 8, decryptOut ) != byteCnt * 8 ) return 1; ! /* make sure the decrypt output matches original plaintext */ ! if ( memcmp( plainText, decryptOut, byteCnt ) ) return 1; return 0; /* tests passed! */ ! } ! void main( void ) ! { ! int testCnt, keySize; ! srand( ( unsigned ) time( NULL ) ); /* randomize */ ! for ( keySize = 128; keySize <= 256; keySize += 64 ) ! for ( testCnt = 0; testCnt < 10; testCnt++ ) ! { ! if ( TestTwofish( MODE_ECB, keySize ) ) { ! printf( "ECB Failure at keySize=%d", keySize ); return; } ! if ( TestTwofish( MODE_CBC, keySize ) ) ! { ! printf( "CBC Failure at keySize=%d", keySize ); return; ! } ! } ! printf( "Tests passed" ); ! } #endif /* TEST_2FISH */ \ No newline at end of file Index: debug.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/twofish/debug.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** debug.h 24 Jun 2003 18:30:45 -0000 1.3 --- debug.h 12 Aug 2004 12:13:33 -0000 1.4 *************** *** 1,6 **** #ifdef DEBUG /* keep these macros common so they are same for both versions */ ! CONST int debugCompile = 1; ! extern int debug; ! extern void DebugIO(CONST char *s); /* display the debug output */ #define DebugDump(x,s,R,XOR,doRot,showT,needBswap) \ --- 1,6 ---- #ifdef DEBUG /* keep these macros common so they are same for both versions */ ! CONST int debugCompile = 1; ! extern int debug; ! extern void DebugIO( CONST char* s ); /* display the debug output */ #define DebugDump(x,s,R,XOR,doRot,showT,needBswap) \ *************** *** 8,76 **** #define DebugDumpKey(key) { if (debug) _DumpKey(key); } #define IV_ROUND -100 ! ! void _Dump(CONST void *p,CONST char *s,int R,int XOR,int doRot,int showT,int needBswap, ! DWORD t0,DWORD t1) ! { char line[512]; /* build output here */ ! int i,n; DWORD q[4]; ! if (R == IV_ROUND) ! sprintf(line,"%sIV: ",s); else ! sprintf(line,"%sR[%2d]: ",s,R); ! for (n=0;line[n];n++) ; ! ! for (i=0;i<4;i++) ! { ! q[i]=((CONST DWORD *)p)[i^(XOR)]; ! if (needBswap) q[i]=Bswap(q[i]); ! } ! sprintf(line+n,"x= %08lX %08lX %08lX %08lX.", ! ROR(q[0],doRot*(R )/2), ! ROL(q[1],doRot*(R )/2), ! ROR(q[2],doRot*(R+1)/2), ! ROL(q[3],doRot*(R+1)/2)); ! for (;line[n];n++) ; ! if (showT) ! sprintf(line+n," t0=%08lX. t1=%08lX.",t0,t1); ! for (;line[n];n++) ; ! sprintf(line+n,"\n"); ! DebugIO(line); ! } ! void _DumpKey(CONST keyInstance *key) ! { ! char line[512]; ! int i; ! int k64Cnt=(key->keyLen+63)/64; /* round up to next multiple of 64 bits */ ! int subkeyCnt = ROUND_SUBKEYS + 2*key->numRounds; ! sprintf(line,";\n;makeKey: Input key --> S-box key [%s]\n", ! (key->direction == DIR_ENCRYPT) ? "Encrypt" : "Decrypt"); ! DebugIO(line); ! for (i=0;i<k64Cnt;i++) /* display in RS format */ ! { ! sprintf(line,";%12s %08lX %08lX --> %08lX\n","", ! key->key32[2*i+1],key->key32[2*i],key->sboxKeys[k64Cnt-1-i]); ! DebugIO(line); ! } ! sprintf(line,";%11sSubkeys\n",""); ! DebugIO(line); ! for (i=0;i<subkeyCnt/2;i++) ! { ! sprintf(line,";%12s %08lX %08lX%s\n","",key->subKeys[2*i],key->subKeys[2*i+1], ! (2*i == INPUT_WHITEN) ? " Input whiten" : ! (2*i == OUTPUT_WHITEN) ? " Output whiten" : ! (2*i == ROUND_SUBKEYS) ? " Round subkeys" : ""); ! DebugIO(line); ! } ! DebugIO(";\n"); } #else ! CONST int debugCompile = 0; #define DebugDump(x,s,R,XOR,doRot,showT,needBswap) #define DebugDumpKey(key) --- 8,70 ---- #define DebugDumpKey(key) { if (debug) _DumpKey(key); } #define IV_ROUND -100 ! ! void _Dump( CONST void* p, CONST char* s, int R, int XOR, int doRot, int showT, int needBswap, DWORD t0, DWORD t1 ) ! { char line[512]; /* build output here */ ! int i, n; DWORD q[4]; ! if ( R == IV_ROUND ) ! sprintf( line, "%sIV: ", s ); else ! sprintf( line, "%sR[%2d]: ", s, R ); ! for ( n = 0; line[n]; n++ ) ! ; ! for ( i = 0; i < 4; i++ ) ! { ! q[i] = ( ( CONST DWORD * ) p )[i ^ ( XOR )]; ! if ( needBswap ) ! q[i] = Bswap( q[i] ); ! } ! sprintf( line + n, "x= %08lX %08lX %08lX %08lX.", ROR( q[0], doRot * ( R ) / 2 ), ROL( q[1], doRot * ( R ) / 2 ), ROR( q[2], doRot * ( R + 1 ) / 2 ), ROL( q[3], doRot * ( R + 1 ) / 2 ) ); ! for ( ; line[n]; n++ ) ! ; ! if ( showT ) ! sprintf( line + n, " t0=%08lX. t1=%08lX.", t0, t1 ); ! for ( ; line[n]; n++ ) ! ; ! sprintf( line + n, "\n" ); ! DebugIO( line ); ! } ! void _DumpKey( CONST keyInstance* key ) ! { ! char line[512]; ! int i; ! int k64Cnt = ( key->keyLen + 63 ) / 64; /* round up to next multiple of 64 bits */ ! int subkeyCnt = ROUND_SUBKEYS + 2 * key->numRounds; ! ! sprintf( line, ";\n;makeKey: Input key --> S-box key [%s]\n", ( key->direction == DIR_ENCRYPT ) ? "Encrypt" : "Decrypt" ); ! DebugIO( line ); ! for ( i = 0; i < k64Cnt; i++ ) /* display in RS format */ ! { ! sprintf( line, ";%12s %08lX %08lX --> %08lX\n", "", key->key32[2 * i + 1], key->key32[2 * i], key->sboxKeys[k64Cnt - 1 - i] ); ! DebugIO( line ); } + sprintf( line, ";%11sSubkeys\n", "" ); + DebugIO( line ); + for ( i = 0; i < subkeyCnt / 2; i++ ) + { + sprintf( line, ";%12s %08lX %08lX%s\n", "", key->subKeys[2 * i], key->subKeys[2 * i + 1], ( 2 * i == INPUT_WHITEN ) ? " Input whiten" : ( 2 * i == OUTPUT_WHITEN ) ? " Output whiten" : ( 2 * i == ROUND_SUBKEYS ) ? " Round subkeys" : "" ); + DebugIO( line ); + } + DebugIO( ";\n" ); + } #else ! CONST int debugCompile = 0; #define DebugDump(x,s,R,XOR,doRot,showT,needBswap) #define DebugDumpKey(key) Index: twofish2.c =================================================================== RCS file: /cvsroot/wpdev/wolfpack/twofish/twofish2.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** twofish2.c 24 Jun 2003 18:30:45 -0000 1.3 --- twofish2.c 12 Aug 2004 12:13:33 -0000 1.4 *************** *** 36,49 **** #ifdef USE_ASM ! extern int useAsm; /* ok to use ASM code? */ ! typedef int cdecl CipherProc ! (cipherInstance *cipher, keyInstance *key,BYTE *input,int inputLen,BYTE *outBuffer); ! typedef int cdecl KeySetupProc(keyInstance *key); ! extern CipherProc *blockEncrypt_86; /* ptr to ASM functions */ ! extern CipherProc *blockDecrypt_86; [...1616 lines suppressed...] } ! } ! if ( mode == MODE_CBC ) /* restore iv32 to cipher */ ! BlockCopy( cipher->iv32, IV ) return inputLen; ! } #ifdef GetCodeSize ! DWORD TwofishCodeSize( void ) ! { ! DWORD x = Here( 0 ); #ifdef USE_ASM ! if ( useAsm & 3 ) return TwofishAsmCodeSize(); #endif return x - TwofishCodeStart(); ! }; #endif \ No newline at end of file |
From: Correa <thi...@us...> - 2004-08-12 03:18:50
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15121 Modified Files: char.cpp item.cpp Log Message: fix bug 210 ( onCreate issue, Items ) also, contains several API fixes to conform the coding standard. Index: item.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/item.cpp,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** item.cpp 10 Aug 2004 03:27:53 -0000 1.119 --- item.cpp 12 Aug 2004 03:18:24 -0000 1.120 *************** *** 315,319 **** UINT16 deleted = 0; ! deleted = self->pItem->DeleteAmount( amount, id, color ); return PyInt_FromLong( deleted ); --- 315,319 ---- UINT16 deleted = 0; ! deleted = self->pItem->deleteAmount( amount, id, color ); return PyInt_FromLong( deleted ); *************** *** 345,350 **** color = PyInt_AsLong( PyTuple_GetItem( args, 1 ) ); ! UINT16 avail = 0; ! avail = self->pItem->CountItems( id, color ); return PyLong_FromLong( avail ); --- 345,350 ---- color = PyInt_AsLong( PyTuple_GetItem( args, 1 ) ); ! unsigned int avail = 0; ! avail = self->pItem->countItems( id, color ); return PyLong_FromLong( avail ); *************** *** 677,700 **** autoStack = getArgInt( 3 ) != 0; ! // Special rules: ! // If randomPos == false but autoStack == true then manually set a random position as well ! // If randomPos == true but autoStack = false then manually set the random position ! ! if ( randomPos && !autoStack ) ! { ! self->pItem->addItem( pItem, false, handleWeight ); ! pItem->SetRandPosInCont( self->pItem ); ! } ! else if ( !randomPos && autoStack ) ! { ! Coord_cl pos = pItem->pos(); ! self->pItem->addItem( pItem, true, handleWeight ); ! if ( !pItem->free ) ! pItem->moveTo( pos ); ! } ! else ! { ! self->pItem->addItem( pItem, randomPos, handleWeight ); ! } Py_RETURN_NONE; --- 677,681 ---- autoStack = getArgInt( 3 ) != 0; ! self->pItem->addItem( pItem, randomPos, handleWeight, false, autoStack ); Py_RETURN_NONE; Index: char.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/char.cpp,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** char.cpp 10 Aug 2004 03:27:51 -0000 1.177 --- char.cpp 12 Aug 2004 03:18:24 -0000 1.178 *************** *** 549,553 **** if ( pPack ) ! deleted = amount - pPack->DeleteAmount( amount, id, color ); return PyInt_FromLong( deleted ); --- 549,553 ---- if ( pPack ) ! deleted = amount - pPack->deleteAmount( amount, id, color ); return PyInt_FromLong( deleted ); *************** *** 741,748 **** P_ITEM pPack = self->pChar->getBackpack(); ! UINT16 avail = 0; if ( pPack ) ! avail = pPack->CountItems( id, color ); return PyInt_FromLong( avail ); --- 741,748 ---- P_ITEM pPack = self->pChar->getBackpack(); ! unsigned int avail = 0; if ( pPack ) ! avail = pPack->countItems( id, color ); return PyInt_FromLong( avail ); |
From: Correa <thi...@us...> - 2004-08-12 03:17:14
|
Update of /cvsroot/wpdev/wolfpack/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14942 Modified Files: ai_humans.cpp Log Message: fix bug 210 ( onCreate issue, Items ) also, contains several API fixes to conform the coding standard. Index: ai_humans.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ai/ai_humans.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ai_humans.cpp 4 Aug 2004 23:17:38 -0000 1.15 --- ai_humans.cpp 12 Aug 2004 03:17:05 -0000 1.16 *************** *** 108,112 **** else if ( message.contains( tr( " RELEASE" ) ) ) { ! int gold = pTalker->CountBankGold() + pTalker->CountGold(); P_ITEM pPack = m_npc->getBankbox(); cItem::ContainerContent stableitems; --- 108,112 ---- else if ( message.contains( tr( " RELEASE" ) ) ) { ! int gold = pTalker->countBankGold() + pTalker->countGold(); P_ITEM pPack = m_npc->getBankbox(); cItem::ContainerContent stableitems; |
From: Correa <thi...@us...> - 2004-08-12 03:16:31
|
Update of /cvsroot/wpdev/wolfpack/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14770 Modified Files: uosocket.cpp Log Message: fix bug 210 ( onCreate issue, Items ) also, contains several API fixes to conform the coding standard. Index: uosocket.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v retrieving revision 1.389 retrieving revision 1.390 diff -C2 -d -r1.389 -r1.390 *** uosocket.cpp 10 Aug 2004 03:24:29 -0000 1.389 --- uosocket.cpp 12 Aug 2004 03:16:20 -0000 1.390 *************** *** 2394,2398 **** sendStats.setIntelligence( _player->intelligence() ); sendStats.setWeight( _player->weight() ); ! sendStats.setGold( _player->CountBankGold() + _player->CountGold() ); sendStats.setSex( _player->gender() ); sendStats.setPets( _player->controlslots() ); --- 2394,2398 ---- sendStats.setIntelligence( _player->intelligence() ); sendStats.setWeight( _player->weight() ); ! sendStats.setGold( _player->countBankGold() + _player->countGold() ); sendStats.setSex( _player->gender() ); sendStats.setPets( _player->controlslots() ); *************** *** 3032,3036 **** if ( item->corpse() ) { ! if ( !_player->Owns( item ) && !_player->isGM() ) { _player->unhide(); --- 3032,3036 ---- if ( item->corpse() ) { ! if ( !_player->owns( item ) && !_player->isGM() ) { _player->unhide(); *************** *** 3038,3042 **** // TODO: Add a XML option for this ! if ( !_player->Owns( item ) && !_player->isGM() && _player->isInnocent() ) { // Innocent Corpse and not in the same party && party allowance for looting? --- 3038,3042 ---- // TODO: Add a XML option for this ! if ( !_player->owns( item ) && !_player->isGM() && _player->isInnocent() ) { // Innocent Corpse and not in the same party && party allowance for looting? *************** *** 3066,3070 **** if ( item->isLockedDown() && item->secured() ) { ! if ( !_player->Owns( item ) && !_player->isGM() ) { sysMessage( tr( "That is a secured chest!" ) ); --- 3066,3070 ---- if ( item->isLockedDown() && item->secured() ) { ! if ( !_player->owns( item ) && !_player->isGM() ) { sysMessage( tr( "That is a secured chest!" ) ); |
From: Correa <thi...@us...> - 2004-08-12 03:03:08
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12824 Modified Files: basechar.cpp basechar.h dragdrop.cpp items.cpp items.h multi.cpp npc.cpp player.cpp player.h timers.cpp timers.h trade.cpp Log Message: fix bug 210 ( onCreate issue, Items ) also, contains several API fixes to conform the coding standard. Index: player.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/player.h,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** player.h 10 Aug 2004 03:15:57 -0000 1.53 --- player.h 12 Aug 2004 03:02:51 -0000 1.54 *************** *** 102,107 **** virtual stError* setProperty( const QString& name, const cVariant& value ); PyObject* getProperty( const QString& name ); - void turnTo( cUObject* object ); // override - void turnTo( const Coord_cl& data ); // override P_NPC unmount(); void mount( P_NPC pMount ); --- 102,105 ---- *************** *** 111,115 **** void makeCriminal(); void disturbMed(); ! int CountBankGold(); bool canPickUp( cItem* pi ); virtual bool inWorld(); --- 109,113 ---- void makeCriminal(); void disturbMed(); ! int countBankGold(); bool canPickUp( cItem* pi ); virtual bool inWorld(); Index: trade.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/trade.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** trade.cpp 10 Aug 2004 03:15:57 -0000 1.6 --- trade.cpp 12 Aug 2004 03:02:51 -0000 1.7 *************** *** 94,98 **** } ! P_ITEM pStock = pVendor->GetItemOnLayer( 0x1A ); cItem::ContainerContent sContent; --- 94,98 ---- } ! P_ITEM pStock = pVendor->getItemOnLayer( 0x1A ); cItem::ContainerContent sContent; *************** *** 100,104 **** sContent = pStock->content(); ! P_ITEM pBought = pVendor->GetItemOnLayer( 0x1B ); cItem::ContainerContent bContent; --- 100,104 ---- sContent = pStock->content(); ! P_ITEM pBought = pVendor->getItemOnLayer( 0x1B ); cItem::ContainerContent bContent; *************** *** 172,177 **** // Get our total gold at once ! UINT32 bankGold = pChar->CountBankGold(); ! UINT32 packGold = pChar->CountGold(); bool fromBank; --- 172,177 ---- // Get our total gold at once ! UINT32 bankGold = pChar->countBankGold(); ! UINT32 packGold = pChar->countGold(); bool fromBank; *************** *** 279,283 **** } ! P_ITEM pPurchase = pVendor->GetItemOnLayer( 0x1C ); if ( !pPurchase ) { --- 279,283 ---- } ! P_ITEM pPurchase = pVendor->getItemOnLayer( 0x1C ); if ( !pPurchase ) { Index: dragdrop.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/dragdrop.cpp,v retrieving revision 1.239 retrieving revision 1.240 diff -C2 -d -r1.239 -r1.240 *** dragdrop.cpp 10 Aug 2004 03:15:56 -0000 1.239 --- dragdrop.cpp 12 Aug 2004 03:02:50 -0000 1.240 *************** *** 125,129 **** bool sameGuild = true;//( GuildCompare( pChar, outmostCont->owner() ) != 0 ); ! if ( outmostCont->hasTag( "notoriety" ) && outmostCont->getTag( "notoriety" ).toInt() == 1 && !pChar->Owns( outmostCont ) && !sameGuild ) { // pChar->karma -= 5; --- 125,129 ---- bool sameGuild = true;//( GuildCompare( pChar, outmostCont->owner() ) != 0 ); ! if ( outmostCont->hasTag( "notoriety" ) && outmostCont->getTag( "notoriety" ).toInt() == 1 && !pChar->owns( outmostCont ) && !sameGuild ) { // pChar->karma -= 5; Index: basechar.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** basechar.cpp 10 Aug 2004 03:15:56 -0000 1.125 --- basechar.cpp 12 Aug 2004 03:02:50 -0000 1.126 *************** *** 679,683 **** { changed_ = true; ! cItem* pHair = GetItemOnLayer( 11 ); if ( pHair ) pHair->setColor( d ); --- 679,683 ---- { changed_ = true; ! cItem* pHair = getItemOnLayer( 11 ); if ( pHair ) pHair->setColor( d ); *************** *** 690,694 **** return; changed_ = true; ! cItem* pHair = GetItemOnLayer( 11 ); if ( pHair ) { --- 690,694 ---- return; changed_ = true; ! cItem* pHair = getItemOnLayer( 11 ); if ( pHair ) { *************** *** 711,715 **** { changed_ = true; ! cItem* pBeard = GetItemOnLayer( 16 ); if ( pBeard ) pBeard->setColor( d ); --- 711,715 ---- { changed_ = true; ! cItem* pBeard = getItemOnLayer( 16 ); if ( pBeard ) pBeard->setColor( d ); *************** *** 722,726 **** return; changed_ = true; ! cItem* pBeard = GetItemOnLayer( 16 ); if ( pBeard ) pBeard->setId( d ); --- 722,726 ---- return; changed_ = true; ! cItem* pBeard = getItemOnLayer( 16 ); if ( pBeard ) pBeard->setId( d ); *************** *** 973,983 **** } ! int cBaseChar::CountItems( short ID, short col ) { // Dont you think it's better to search the char's equipment as well? UINT32 number = 0; ! ItemContainer container = content_; ! ItemContainer::const_iterator it = container.begin(); ! ItemContainer::const_iterator end = container.end(); for ( ; it != end; ++it ) --- 973,982 ---- } ! int cBaseChar::countItems( short ID, short col ) { // Dont you think it's better to search the char's equipment as well? UINT32 number = 0; ! ItemContainer::const_iterator it(content_.begin()); ! ItemContainer::const_iterator end(content_.end()); for ( ; it != end; ++it ) *************** *** 995,1008 **** if ( pi ) ! number = pi->CountItems( ID, col ); return number; } ! int cBaseChar::CountGold() { ! return CountItems( 0x0EED ); } ! P_ITEM cBaseChar::GetItemOnLayer( unsigned char layer ) { return atLayer( static_cast<enLayer>( layer ) ); --- 994,1007 ---- if ( pi ) ! number = pi->countItems( ID, col ); return number; } ! int cBaseChar::countGold() { ! return countItems( 0x0EED ); } ! P_ITEM cBaseChar::getItemOnLayer( unsigned char layer ) { return atLayer( static_cast<enLayer>( layer ) ); *************** *** 1053,1062 **** } ! void cBaseChar::MoveTo( short newx, short newy, signed char newz ) ! { ! cUObject::moveTo( Coord_cl( newx, newy, newz, pos().map ) ); ! } ! ! bool cBaseChar::Wears( P_ITEM pi ) { return ( this == pi->container() ); --- 1052,1056 ---- } ! bool cBaseChar::wears( P_ITEM pi ) { return ( this == pi->container() ); *************** *** 1157,1161 **** } ! bool cBaseChar::Owns( P_ITEM pItem ) const { if ( !pItem ) --- 1151,1155 ---- } ! bool cBaseChar::owns( P_ITEM pItem ) const { if ( !pItem ) *************** *** 2853,2857 **** for ( unsigned char layer = SingleHandedWeapon; layer <= InnerLegs; ++layer ) { ! P_ITEM item = GetItemOnLayer( layer ); if ( item ) --- 2847,2851 ---- for ( unsigned char layer = SingleHandedWeapon; layer <= InnerLegs; ++layer ) { ! P_ITEM item = getItemOnLayer( layer ); if ( item ) Index: timers.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/timers.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** timers.h 19 Jun 2004 02:06:51 -0000 1.4 --- timers.h 12 Aug 2004 03:02:51 -0000 1.5 *************** *** 161,164 **** --- 161,177 ---- }; + class cDelayedOnCreateCall : public cTimer + { + cUObject* obj_; + const QString def_; + public: + cDelayedOnCreateCall( cUObject*, const QString& definition ); + void Expire(); + QString objectID() const + { + return "cDelayedOnCreateCall"; + } + }; + class cTimers { Index: timers.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/timers.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** timers.cpp 10 Aug 2004 03:15:57 -0000 1.7 --- timers.cpp 12 Aug 2004 03:02:51 -0000 1.8 *************** *** 465,468 **** --- 465,480 ---- } + cDelayedOnCreateCall::cDelayedOnCreateCall( cUObject* obj, const QString& definition ) : + obj_(obj), def_(definition) + { + setSerializable( false ); + expiretime = 0; // right on the next loop. + } + + void cDelayedOnCreateCall::Expire() + { + obj_->onCreate(def_); + } + void cTimers::insert( cTimer* pT ) { Index: multi.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/multi.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** multi.cpp 10 Aug 2004 03:15:57 -0000 1.12 --- multi.cpp 12 Aug 2004 03:02:50 -0000 1.13 *************** *** 34,37 **** --- 34,38 ---- #include "console.h" #include "sectors.h" + #include "timers.h" void cMulti::remove() *************** *** 93,97 **** multi->setBaseid( id.latin1() ); multi->applyDefinition( section ); ! multi->onCreate( id ); } else --- 94,99 ---- multi->setBaseid( id.latin1() ); multi->applyDefinition( section ); ! cDelayedOnCreateCall* onCreateCall = new cDelayedOnCreateCall( multi, id ); ! Timers::instance()->insert( onCreateCall ); } else Index: items.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v retrieving revision 1.430 retrieving revision 1.431 diff -C2 -d -r1.430 -r1.431 *** items.cpp 10 Aug 2004 03:15:57 -0000 1.430 --- items.cpp 12 Aug 2004 03:02:50 -0000 1.431 *************** *** 292,300 **** } - void cItem::MoveTo( int newx, int newy, signed char newz ) - { - moveTo( Coord_cl( newx, newy, newz, pos().z, pos().map ) ); - } - /* * Author: LB purpose: returns the type of pack --- 292,295 ---- *************** *** 310,405 **** * 40 .. 140 for 4 */ ! short cItem::GetContGumpType() { switch ( id() ) { case 0x09a8: - return 1; - case 0x09a9: - return 2; case 0x09aa: - return 1; - case 0x09ab: - return 3; case 0x09b0: return 1; - case 0x09b2: - return 4; - - case 0x0A2C: - return 1; // chest of drawers - case 0x0A30: - return 1; // chest of drawers - case 0x0A34: - return 1; // chest of drawers - case 0x0A38: - return 1; // chest of drawers - - case 0x0A4D: - return 1; // armoire - case 0x0A4F: - return 1; // armoire - case 0x0A51: - return 1; // armoire - case 0x0A53: - return 1; // armoire - - case 0x0A97: - return 1; // bookshelf - case 0x0A98: - return 1; // bookshelf - case 0x0A99: - return 1; // bookshelf - case 0x0A9A: - return 1; // bookshelf - case 0x0A9B: - return 1; // bookshelf - case 0x0A9C: - return 1; // bookshelf - case 0x0A9D: - return 1; // bookshelf - case 0x0A9E: - return 1; // bookshelf case 0x0e3c: - return 2; case 0x0e3d: - return 2; case 0x0e3e: - return 2; case 0x0e3f: return 2; case 0x0e40: - return 3; case 0x0e41: - return 3; case 0x0e42: - return 3; case 0x0e43: return 3; - case 0x0e75: - return 4; ! case 0x0e76: ! return 1; case 0x0e77: - return 4; - case 0x0e78: - return 2; - case 0x0e79: - return 1; - case 0x0e7a: - return 1; - - case 0x0e7c: - return 3; - case 0x0e7d: - return 1; - case 0x0e7e: - return 2; case 0x0e7f: - return 4; - case 0x0e80: - return 1; case 0x0e83: return 4; --- 305,359 ---- * 40 .. 140 for 4 */ ! short cItem::containerGumpType() const { switch ( id() ) { case 0x09a8: case 0x09aa: case 0x09b0: + case 0x0A2C: // chest of drawers + case 0x0A30: // chest of drawers + case 0x0A34: // chest of drawers + case 0x0A38: // chest of drawers + case 0x0A4D: // armoire + case 0x0A4F: // armoire + case 0x0A51: // armoire + case 0x0A53: // armoire + case 0x0A97: // bookshelf + case 0x0A98: // bookshelf + case 0x0A99: // bookshelf + case 0x0A9A: // bookshelf + case 0x0A9B: // bookshelf + case 0x0A9C: // bookshelf + case 0x0A9D: // bookshelf + case 0x0A9E: // bookshelf + case 0x0e76: + case 0x0e79: + case 0x0e7a: + case 0x0e7d: + case 0x0e80: return 1; + case 0x09a9: case 0x0e3c: case 0x0e3d: case 0x0e3e: case 0x0e3f: + case 0x0e78: + case 0x0e7e: return 2; + + case 0x09ab: case 0x0e40: case 0x0e41: case 0x0e42: case 0x0e43: + case 0x0e7c: return 3; ! case 0x09b2: ! case 0x0e75: case 0x0e77: case 0x0e7f: case 0x0e83: return 4; *************** *** 407,410 **** --- 361,365 ---- case 0x2006: return 5; // a corpse/coffin + default: return -1; *************** *** 412,416 **** } ! bool cItem::PileItem( cItem* pItem ) { if ( !canStack( pItem ) ) --- 367,371 ---- } ! bool cItem::pileItem( cItem* pItem ) { if ( !canStack( pItem ) ) *************** *** 433,438 **** } ! // try to find an item in the container to stack with ! bool cItem::ContainerPileItem( cItem* pItem ) { cItem::ContainerContent::const_iterator it( content_.begin() ); --- 388,395 ---- } ! /*! ! Tries to find an item in the container to stack with ! */ ! bool cItem::containerPileItem( cItem* pItem ) { cItem::ContainerContent::const_iterator it( content_.begin() ); *************** *** 440,444 **** for ( ; it != end; ++it ) { ! if ( ( *it )->PileItem( pItem ) ) return true; } --- 397,401 ---- for ( ; it != end; ++it ) { ! if ( ( *it )->pileItem( pItem ) ) return true; } *************** *** 446,452 **** } ! void cItem::SetRandPosInCont( cItem* pCont ) { ! int k = pCont->GetContGumpType(); Coord_cl position = pos(); position.x = RandomNum( 18, 118 ); --- 403,409 ---- } ! void cItem::setRandPosInCont( cItem* pCont ) { ! int k = pCont->containerGumpType(); Coord_cl position = pos(); position.x = RandomNum( 18, 118 ); *************** *** 478,501 **** } - int cItem::CountItems( short id, short color ) const - { - int total = 0; - QPtrList<cItem> content = getContainment(); - - for ( P_ITEM pi = content.first(); pi; pi = content.next() ) - { - if ( !pi || pi->free ) // just to be sure ;-) - continue; - if ( pi->id() == id && ( color == -1 || pi->color() == color ) ) - total += pi->amount(); - } - return total; - } - /*! Recurses through the container given by serial and deletes items of the given id and color(if given) until the given amount is reached */ ! int cItem::DeleteAmount( int amount, unsigned short _id, unsigned short _color ) { int rest = amount; --- 435,443 ---- } /*! Recurses through the container given by serial and deletes items of the given id and color(if given) until the given amount is reached */ ! int cItem::deleteAmount( int amount, unsigned short _id, unsigned short _color ) { int rest = amount; *************** *** 508,512 **** pi = *it; if ( pi->type() == 1 ) ! rest = pi->DeleteAmount( rest, _id, _color ); if ( pi->id() == _id && ( _color == 0 || ( pi->color() == _color ) ) ) rest = pi->reduceAmount( rest ); --- 450,454 ---- pi = *it; if ( pi->type() == 1 ) ! rest = pi->deleteAmount( rest, _id, _color ); if ( pi->id() == _id && ( _color == 0 || ( pi->color() == _color ) ) ) rest = pi->reduceAmount( rest ); *************** *** 1161,1165 **** flags |= 0x20; } ! else if ( isOwnerMovable() && player->Owns( this ) ) { flags |= 0x20; --- 1103,1107 ---- flags |= 0x20; } ! else if ( isOwnerMovable() && player->owns( this ) ) { flags |= 0x20; *************** *** 1192,1196 **** flags |= 0x20; } ! else if ( isOwnerMovable() && player->Owns( this ) ) { flags |= 0x20; --- 1134,1138 ---- flags |= 0x20; } ! else if ( isOwnerMovable() && player->owns( this ) ) { flags |= 0x20; *************** *** 1552,1556 **** } ! void cItem::addItem( cItem* pItem, bool randomPos, bool handleWeight, bool noRemove ) { if ( !pItem ) --- 1494,1498 ---- } ! void cItem::addItem( cItem* pItem, bool randomPos, bool handleWeight, bool noRemove, bool autoStack ) { if ( !pItem ) *************** *** 1579,1583 **** if ( randomPos ) { ! if ( ContainerPileItem( pItem ) ) { // If the Server is running and this happens, resend the tooltip of us and --- 1521,1525 ---- if ( randomPos ) { ! if ( autoStack && containerPileItem( pItem ) ) { // If the Server is running and this happens, resend the tooltip of us and *************** *** 1598,1602 **** else { ! pItem->SetRandPosInCont( this ); } } --- 1540,1544 ---- else { ! pItem->setRandPosInCont( this ); } } *************** *** 2173,2177 **** nItem->setBaseid( id.latin1() ); nItem->applyDefinition( section ); ! nItem->onCreate( id ); } else --- 2115,2120 ---- nItem->setBaseid( id.latin1() ); nItem->applyDefinition( section ); ! cDelayedOnCreateCall* onCreateCall = new cDelayedOnCreateCall( nItem, id ); ! Timers::instance()->insert( onCreateCall ); } else *************** *** 2274,2278 **** } ! unsigned int cItem::countItems( const QStringList& baseids ) { unsigned int count = 0; --- 2217,2225 ---- } ! /*! ! Counts the items in this container which match a list of ! specific \p baseids. ! */ ! unsigned int cItem::countItems( const QStringList& baseids ) const { unsigned int count = 0; *************** *** 2282,2294 **** } ! ContainerContent::iterator it = content_.begin(); ! while ( it != content_.end() ) { count += ( *it )->countItems( baseids ); - ++it; } return count; } unsigned int cItem::removeItems( const QStringList& baseids, unsigned int amount ) { --- 2229,2263 ---- } ! ContainerContent::const_iterator it(content_.begin()); ! ContainerContent::const_iterator end(content_.end()); ! for ( ; it != end; ++it ) { count += ( *it )->countItems( baseids ); } return count; } + unsigned int cItem::countItems( short id, short color ) const + { + unsigned int total = 0; + QPtrList<cItem> content = getContainment(); + + for ( P_ITEM pi = content.first(); pi; pi = content.next() ) + { + if ( !pi || pi->free ) // just to be sure ;-) + continue; + if ( pi->id() == id && ( color == -1 || pi->color() == color ) ) + total += pi->amount(); + } + return total; + } + + /*! + \brief Removes a certain amount of items from this container + recursively. + \param baseids The list of baseids that a item can have. + \param amount The amount of items to remove. + \returns The remaining amount of items to be removed. + */ unsigned int cItem::removeItems( const QStringList& baseids, unsigned int amount ) { Index: items.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/items.h,v retrieving revision 1.209 retrieving revision 1.210 diff -C2 -d -r1.209 -r1.210 *** items.h 10 Aug 2004 03:15:57 -0000 1.209 --- items.h 12 Aug 2004 03:02:50 -0000 1.210 *************** *** 180,183 **** --- 180,187 ---- public: + cItem(); + cItem( const cItem& src ); // Copy constructor + + unsigned char getClassid() { *************** *** 352,357 **** } - //***************************END ADDED GETTERS************ - // Setters void setId( ushort nValue ) --- 356,359 ---- *************** *** 404,414 **** { if ( nValue ) - { priv_ |= 0x40; - } else - { priv_ &= ~0x40; - } } --- 406,412 ---- *************** *** 416,423 **** void setTotalweight( float data ); - cItem(); - cItem( const cItem& src ); // Copy constructor - static void registerInFactory(); - bool wearOut(); // The item wears out and true is returned if it's destroyed void toBackpack( P_CHAR pChar ); --- 414,417 ---- *************** *** 466,500 **** UINT16 getWeaponSkill(); - void MoveTo( int newx, int newy, signed char newz ); void moveTo( const Coord_cl& pos, bool noremove = false ); long reduceAmount( short amount = 1 ); ! short GetContGumpType(); ! void SetRandPosInCont( cItem* pCont ); ! bool PileItem( cItem* pItem ); ! bool ContainerPileItem( cItem* pItem ); // try to find an item in the container to stack with bool canStack( cItem* pItem ); // See if this item can stack with another. ! void addItem( cItem* pItem, bool randomPos = true, bool handleWeight = true, bool noRemove = false ); // Add Item to container void removeItem( cItem*, bool handleWeight = true ); void removeFromCont( bool handleWeight = true ); ContainerContent content() const; bool contains( const cItem* ) const; ! /*! ! \brief Counts the items in this container which match a list of ! specific \p baseids. ! \returns The amount of items found. ! */ ! unsigned int countItems( const QStringList& baseids ); - /*! - \brief Removes a certain amount of items from this container - recursively. - \param baseids The list of baseids that a item can have. - \param amount The amount of items to remove. - \returns The remaining amount of items to be removed. - */ unsigned int removeItems( const QStringList& baseids, unsigned int amount ); ! int CountItems( short ID, short col = -1 ) const; ! int DeleteAmount( int amount, ushort _id, ushort _color = 0 ); QString getName( bool shortName = false ); void setAllMovable() --- 460,482 ---- UINT16 getWeaponSkill(); void moveTo( const Coord_cl& pos, bool noremove = false ); long reduceAmount( short amount = 1 ); ! short containerGumpType() const; ! void setRandPosInCont( cItem* pCont ); ! bool pileItem( cItem* pItem ); ! bool containerPileItem( cItem* pItem ); // try to find an item in the container to stack with bool canStack( cItem* pItem ); // See if this item can stack with another. ! void addItem( cItem* pItem, bool randomPos = true, bool handleWeight = true, bool noRemove = false, bool autoStack = true ); // Add Item to container void removeItem( cItem*, bool handleWeight = true ); void removeFromCont( bool handleWeight = true ); ContainerContent content() const; bool contains( const cItem* ) const; ! unsigned int countItems( const QStringList& baseids ) const; ! unsigned int countItems( short ID, short col = -1 ) const; unsigned int removeItems( const QStringList& baseids, unsigned int amount ); + void remove(); ! int deleteAmount( int amount, ushort _id, ushort _color = 0 ); QString getName( bool shortName = false ); void setAllMovable() *************** *** 563,567 **** static P_ITEM createFromList( const QString& list ); static P_ITEM createFromId( unsigned short id ); ! void remove(); protected: --- 545,549 ---- static P_ITEM createFromList( const QString& list ); static P_ITEM createFromId( unsigned short id ); ! static void registerInFactory(); protected: Index: player.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** player.cpp 10 Aug 2004 03:15:57 -0000 1.117 --- player.cpp 12 Aug 2004 03:02:50 -0000 1.118 *************** *** 435,448 **** } - void cPlayer::turnTo( cUObject* object ) - { - cBaseChar::turnTo( object->pos() ); - } - - void cPlayer::turnTo( const Coord_cl& pos ) - { - cBaseChar::turnTo( pos ); - } - P_NPC cPlayer::unmount() { --- 435,438 ---- *************** *** 691,698 **** } ! int cPlayer::CountBankGold() { P_ITEM pi = getBankbox(); //we want gold bankbox. ! return pi->CountItems( 0x0EED ); } --- 681,688 ---- } ! int cPlayer::countBankGold() { P_ITEM pi = getBankbox(); //we want gold bankbox. ! return pi->countItems( 0x0EED ); } *************** *** 713,717 **** } ! if ( ( pi->isOwnerMovable() || pi->isLockedDown() ) && !this->Owns( pi ) ) // owner movable or locked down ? return false; --- 703,707 ---- } ! if ( ( pi->isOwnerMovable() || pi->isLockedDown() ) && !this->owns( pi ) ) // owner movable or locked down ? return false; *************** *** 780,784 **** if ( pPack ) ! dAmount = pPack->DeleteAmount( amount, 0xEED, 0 ); if ( ( dAmount > 0 ) && useBank ) --- 770,774 ---- if ( pPack ) ! dAmount = pPack->deleteAmount( amount, 0xEED, 0 ); if ( ( dAmount > 0 ) && useBank ) *************** *** 787,791 **** if ( pBank ) ! dAmount += pBank->DeleteAmount( ( amount - dAmount ), 0xEED, 0 ); } --- 777,781 ---- if ( pBank ) ! dAmount += pBank->deleteAmount( ( amount - dAmount ), 0xEED, 0 ); } Index: basechar.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** basechar.h 10 Aug 2004 03:15:56 -0000 1.77 --- basechar.h 12 Aug 2004 03:02:50 -0000 1.78 *************** *** 272,283 **** virtual bool isInnocent(); void unhide(); ! int CountItems( short ID, short col = -1 ); ! int CountGold(); ! P_ITEM GetItemOnLayer( unsigned char layer ); P_ITEM getBackpack(); P_ITEM getBankbox(); void setSerial( SERIAL ser ); ! void MoveTo( short newx, short newy, signed char newz ); ! bool Wears( P_ITEM pi ); unsigned int getSkillSum() const; void Init( bool ser = true ); --- 272,282 ---- virtual bool isInnocent(); void unhide(); ! int countItems( short ID, short col = -1 ); ! int countGold(); ! P_ITEM getItemOnLayer( unsigned char layer ); P_ITEM getBackpack(); P_ITEM getBankbox(); void setSerial( SERIAL ser ); ! bool wears( P_ITEM pi ); unsigned int getSkillSum() const; void Init( bool ser = true ); *************** *** 292,296 **** virtual bool checkSkill( UI16 skill, SI32 min, SI32 max, bool advance = true ); cItem* atLayer( enLayer layer ) const; ! bool Owns( P_ITEM pi ) const; virtual void callGuards(); virtual void flagUnchanged(); --- 291,295 ---- virtual bool checkSkill( UI16 skill, SI32 min, SI32 max, bool advance = true ); cItem* atLayer( enLayer layer ) const; ! bool owns( P_ITEM pi ) const; virtual void callGuards(); virtual void flagUnchanged(); Index: npc.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** npc.cpp 10 Aug 2004 03:15:57 -0000 1.103 --- npc.cpp 12 Aug 2004 03:02:50 -0000 1.104 *************** *** 618,622 **** if ( pPack ) ! dAmount = pPack->DeleteAmount( amount, 0xEED, 0 ); return dAmount; --- 618,622 ---- if ( pPack ) ! dAmount = pPack->deleteAmount( amount, 0xEED, 0 ); return dAmount; *************** *** 685,689 **** continue; ! P_ITEM contItem = this->GetItemOnLayer( contlayer ); if ( contItem != NULL ) contItem->processContainerNode( currNode ); --- 685,689 ---- continue; ! P_ITEM contItem = this->getItemOnLayer( contlayer ); if ( contItem != NULL ) contItem->processContainerNode( currNode ); *************** *** 1199,1203 **** void cNPC::makeShop() { ! P_ITEM currCont = GetItemOnLayer( BuyRestockContainer ); if ( !currCont ) { --- 1199,1203 ---- void cNPC::makeShop() { ! P_ITEM currCont = getItemOnLayer( BuyRestockContainer ); if ( !currCont ) { *************** *** 1208,1212 **** } ! currCont = GetItemOnLayer( BuyNoRestockContainer ); if ( !currCont ) { --- 1208,1212 ---- } ! currCont = getItemOnLayer( BuyNoRestockContainer ); if ( !currCont ) { *************** *** 1217,1221 **** } ! currCont = GetItemOnLayer( SellContainer ); if ( !currCont ) { --- 1217,1221 ---- } ! currCont = getItemOnLayer( SellContainer ); if ( !currCont ) { *************** *** 1289,1294 **** void cNPC::vendorBuy( P_PLAYER player ) { ! P_ITEM pContA = GetItemOnLayer( cBaseChar::BuyRestockContainer ); ! P_ITEM pContB = GetItemOnLayer( cBaseChar::BuyNoRestockContainer ); if ( player->isDead() ) --- 1289,1294 ---- void cNPC::vendorBuy( P_PLAYER player ) { ! P_ITEM pContA = getItemOnLayer( cBaseChar::BuyRestockContainer ); ! P_ITEM pContB = getItemOnLayer( cBaseChar::BuyNoRestockContainer ); if ( player->isDead() ) *************** *** 1307,1311 **** void cNPC::vendorSell( P_PLAYER player ) { ! P_ITEM pContC = GetItemOnLayer( cBaseChar::SellContainer ); if ( !pContC || pContC->content().size() == 0 ) --- 1307,1311 ---- void cNPC::vendorSell( P_PLAYER player ) { ! P_ITEM pContC = getItemOnLayer( cBaseChar::SellContainer ); if ( !pContC || pContC->content().size() == 0 ) *************** *** 1415,1419 **** // Now we call onCreate ! pChar->onCreate( section ); pChar->resend( false ); return pChar; --- 1415,1420 ---- // Now we call onCreate ! cDelayedOnCreateCall* onCreateCall = new cDelayedOnCreateCall( pChar, section ); ! Timers::instance()->insert( onCreateCall ); pChar->resend( false ); return pChar; |
From: Richard M. <dr...@us...> - 2004-08-12 00:57:23
|
Update of /cvsroot/wpdev/xmlscripts/definitions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27363 Modified Files: scripts.xml Log Message: A fix by Incanus that should make healers work! Index: scripts.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/scripts.xml,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** scripts.xml 11 Aug 2004 22:24:10 -0000 1.151 --- scripts.xml 12 Aug 2004 00:57:12 -0000 1.152 *************** *** 152,155 **** --- 152,156 ---- <!-- Context menu scripts --> <script>contextmenus.bankermenu</script> + <script>contextmenus.healermenu</script> <script>contextmenus.paperdollmenu</script> <script>contextmenus.petmenu</script> |
From: Richard M. <dr...@us...> - 2004-08-12 00:57:23
|
Update of /cvsroot/wpdev/xmlscripts/definitions/npcs/humans/vendors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27363/npcs/humans/vendors Modified Files: healer.xml Log Message: A fix by Incanus that should make healers work! Index: healer.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/npcs/humans/vendors/healer.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** healer.xml 4 Feb 2004 03:04:09 -0000 1.3 --- healer.xml 12 Aug 2004 00:57:13 -0000 1.4 *************** *** 12,16 **** <npc id="healer_male"> <inherit>vendor_male</inherit> ! <bindmenu>healer_menu</bindmenu> <title>the Healer</title> <shopkeeper> --- 12,16 ---- <npc id="healer_male"> <inherit>vendor_male</inherit> ! <bindmenu>vendor_menu,train_menu,healer_menu</bindmenu> <title>the Healer</title> <shopkeeper> *************** *** 52,62 **** <swordsmanship><random min="800" max="1000" /></swordsmanship> <category>Vendors\Healer (Male)</category> - <events>npc.healer</events> </npc> ! <npc id="healer_female"> <inherit>vendor_female</inherit> <title>the Healer</title> ! <bindmenu>healer_menu</bindmenu> <shopkeeper> <restockable> --- 52,61 ---- <swordsmanship><random min="800" max="1000" /></swordsmanship> <category>Vendors\Healer (Male)</category> </npc> ! <npc id="healer_female"> <inherit>vendor_female</inherit> <title>the Healer</title> ! <bindmenu>vendor_menu,train_menu,healer_menu</bindmenu> <shopkeeper> <restockable> *************** *** 97,101 **** <swordsmanship><random min="800" max="1000" /></swordsmanship> <category>Vendors\Healer (Female)</category> - <events>npc.healer</events> </npc> --- 96,99 ---- |
From: Richard M. <dr...@us...> - 2004-08-12 00:57:22
|
Update of /cvsroot/wpdev/xmlscripts/definitions/menus In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27363/menus Modified Files: contextmenu.xml Log Message: A fix by Incanus that should make healers work! Index: contextmenu.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/menus/contextmenu.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** contextmenu.xml 2 Jun 2004 15:02:20 -0000 1.16 --- contextmenu.xml 12 Aug 2004 00:57:13 -0000 1.17 *************** *** 78,82 **** <contextmenu id="healer_menu"> ! <option tag="1" msgid="0489"/> </contextmenu> --- 78,83 ---- <contextmenu id="healer_menu"> ! <events>contextmenus.healermenu</events> ! <option tag="1" msgid="0489" checkvisible="true" /> </contextmenu> |
From: Richard M. <dr...@us...> - 2004-08-12 00:56:13
|
Update of /cvsroot/wpdev/xmlscripts/scripts/npc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27222/npc Modified Files: healer.py Log Message: Useful fix by Incanus, healers should work now. Index: healer.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/npc/healer.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** healer.py 9 Jul 2004 10:06:54 -0000 1.6 --- healer.py 12 Aug 2004 00:56:03 -0000 1.7 *************** *** 1,33 **** - ################################################################# - # ) (\_ # WOLFPACK 13.0.0 Scripts # - # (( _/{ "-; # Created by: codex # - # )).-' {{ ;'` # Revised by: # - # ( ( ;._ \\ ctr # Last Modification: Created # - ################################################################# - - import wolfpack - from wolfpack.consts import * - - def onContextEntry( char, healer, tag ): - if( int( tag ) == 1 ): - healer.say("Hold still!") - if not char or not healer: - return False - - if healer.dead: - char.socket.clilocmessage( 501040, "", YELLOW, NORMAL ) # The resurrecter must be alive - return False ! if char.dead: ! char.socket.clilocmessage( 3002069, "", YELLOW, NORMAL ) # Resurrection ! char.soundeffect( 0x215 ) ! char.resurrect() ! return True ! else: ! char.socket.clilocmessage( 1060197, "", YELLOW, NORMAL ) # You are not dead, and thus cannot be resurrected! ! return False ! ! return True ! else: ! char.say("A HEALER! RESURRECT ME!") ! return True --- 1,3 ---- ! # For Later Use ! # Context Menu Hooks are in contextmenus.healermenu |
From: Richard M. <dr...@us...> - 2004-08-12 00:56:12
|
Update of /cvsroot/wpdev/xmlscripts/scripts/contextmenus In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27222/contextmenus Added Files: healermenu.py Log Message: Useful fix by Incanus, healers should work now. --- NEW FILE: healermenu.py --- ################################################################# # ) (\_ # WOLFPACK 13.0.0 Scripts # # (( _/{ "-; # Created by: codex # # )).-' {{ ;'` # Revised by: Incanus # # ( ( ;._ \\ ctr # Last Modification: # ################################################################# def onContextCheckVisible(char, target, tag): if( int( tag ) == 1 ): return char.dead return True def onContextEntry( char, healer, tag ): if( int( tag ) == 1 ): if not char or not healer: return False if healer.dead: char.socket.clilocmessage( 501040 ) # The resurrecter must be alive return False char.socket.clilocmessage( 3002069 ) # Resurrection char.soundeffect( 0x215 ) char.resurrect() return True |
From: Richard M. <dr...@us...> - 2004-08-11 22:24:19
|
Update of /cvsroot/wpdev/xmlscripts/definitions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1900 Modified Files: scripts.xml Log Message: Disabled the optimize/backup scripts from being loaded. Index: scripts.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/scripts.xml,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** scripts.xml 23 Jul 2004 19:42:11 -0000 1.150 --- scripts.xml 11 Aug 2004 22:24:10 -0000 1.151 *************** *** 171,176 **** --- 171,179 ---- <script>system.macro_opendoor</script> <script>system.makemenus</script> + <!-- These require testing --> + <!-- <script>system.mysql_backup_db</script> <script>system.mysql_optimize_db</script> + --> <script>system.poison</script> <script>system.regionchange</script> |
From: Richard M. <dr...@us...> - 2004-08-10 22:07:08
|
Update of /cvsroot/wpdev/xmlscripts/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10458 Modified Files: environment.py Log Message: A test of the locales stuff. Index: environment.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/environment.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** environment.py 16 Jul 2004 07:09:21 -0000 1.14 --- environment.py 10 Aug 2004 22:06:58 -0000 1.15 *************** *** 6,14 **** import random from wolfpack.consts import COTTONPLANTS_REGROW, ANIM_ATTACK5, TINKERING, \ ! MUSICIANSHIP, LAYER_HAIR, LAYER_BEARD from wolfpack.utilities import tobackpack from wolfpack.gumps import cGump from math import floor ! def cotton( char, item ): --- 6,14 ---- import random from wolfpack.consts import COTTONPLANTS_REGROW, ANIM_ATTACK5, TINKERING, \ ! MUSICIANSHIP, LAYER_HAIR, LAYER_BEARD, SYSLOCALE from wolfpack.utilities import tobackpack from wolfpack.gumps import cGump from math import floor ! from wolfpack.locales import localemsg def cotton( char, item ): *************** *** 18,22 **** if lastpick + COTTONPLANTS_REGROW > wolfpack.time.currenttime(): ! char.message( "You can't pick cotton here yet." ) return 1 --- 18,22 ---- if lastpick + COTTONPLANTS_REGROW > wolfpack.time.currenttime(): ! char.message( localemsg( 4 ) ) return 1 *************** *** 29,33 **** cotton.update() ! char.message( "You reach down and pick some cotton." ) # Set a timer for the cotton plant --- 29,33 ---- cotton.update() ! char.message( localemsg( 5 ) ) # Set a timer for the cotton plant *************** *** 38,42 **** if not char.checkskill( TINKERING, 0, 500 ): if random.randint( 1, 100 ) <= 25: ! additional = ' and break the parts' if item.amount > 1: --- 38,42 ---- if not char.checkskill( TINKERING, 0, 500 ): if random.randint( 1, 100 ) <= 25: ! additional = localemsg( 15 ) if item.amount > 1: *************** *** 46,52 **** item.delete() else: ! additional = '' ! char.message( "You don't manage to create the sextant%s" % additional ) else: if item.amount > 1: --- 46,52 ---- item.delete() else: ! additional = localemsg( 16 ) ! char.message( "%s%s" % ( localemsg( 14 ), additional ) ) else: if item.amount > 1: *************** *** 63,72 **** char.getbackpack().additem( item, 1, 1, 0 ) item.update() ! char.message( "You put the sextant into your backpack" ) return 1 def sextant( char, item ): ! char.message( 'Sorry but this feature is not implemented yet' ) return 1 --- 63,72 ---- char.getbackpack().additem( item, 1, 1, 0 ) item.update() ! char.message( localemsg( 17 ) ) return 1 def sextant( char, item ): ! char.message( localemsg( 0 ) ) return 1 *************** *** 117,121 **** def hairdye( char, item ): if item.container != char.getbackpack(): ! char.message( 'This item has to be in your backpack to use it.' ) return 1 --- 117,121 ---- def hairdye( char, item ): if item.container != char.getbackpack(): ! char.message( localemsg( 3 ) ) return 1 *************** *** 167,176 **** if not item or item.container != char.getbackpack(): ! char.message( 'The item has to be in your backpack to use it.' ) return # Check if it's a valid color if len( response.switches ) != 1: ! char.message( 'You have to choose a hair color.' ) return --- 167,176 ---- if not item or item.container != char.getbackpack(): ! char.message( localemsg( 3 ) ) return # Check if it's a valid color if len( response.switches ) != 1: ! char.message( localemsg( 13 ) ) return *************** *** 195,207 **** return ! char.message( 'Thats an invalid color' ) # Dying Tub def dyingtub( char, item ): if not char.canreach( item, 2 ): ! char.socket.sysmessage( "You can't reach this." ) return 1 ! char.socket.sysmessage( 'What do you want to use this on?' ) char.socket.attachtarget( 'environment.dyingtub_response', [ item.serial ] ) return 1 --- 195,207 ---- return ! char.message( localemsg( 12 ) ) # Dying Tub def dyingtub( char, item ): if not char.canreach( item, 2 ): ! char.socket.sysmessage( localemsg( 6 ) ) return 1 ! char.socket.sysmessage( localemsg( 18 ) ) char.socket.attachtarget( 'environment.dyingtub_response', [ item.serial ] ) return 1 *************** *** 211,219 **** if not dyetub or not char.canreach( dyetub, 2 ): ! char.message( "You can't reach the dyetub from here." ) return if not target.item: ! char.message( 'You need to target an item.' ) return --- 211,219 ---- if not dyetub or not char.canreach( dyetub, 2 ): ! char.message( localemsg( 6 ) ) return if not target.item: ! char.message( localemsg( 8 ) ) return *************** *** 221,229 **** if not char.gm: if target.item.getoutmostchar() != char: ! char.socket.sysmessage( "You have to have this in your belongings." ) return if not target.item.dye: ! char.socket.sysmessage( "You cannot dye this." ) return --- 221,229 ---- if not char.gm: if target.item.getoutmostchar() != char: ! char.socket.sysmessage( localemsg( 10 ) ) return if not target.item.dye: ! char.socket.sysmessage( localemsg( 11 ) ) return |
From: Richard M. <dr...@us...> - 2004-08-10 22:06:37
|
Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10360 Modified Files: consts.py Added Files: locales.py Log Message: I figured this might be useful in the future. Index: consts.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/consts.py,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** consts.py 16 Jul 2004 07:09:28 -0000 1.73 --- consts.py 10 Aug 2004 22:06:28 -0000 1.74 *************** *** 776,777 **** --- 776,788 ---- \end """ + + """ + \constants wolfpack.consts Locale Consts + These constants represent the different locale values that can be used with + wolfpack.locales.syslocalemsg( locale, msgnumber ) + """ + LOCALE_EN = 0 + LOCALE_DE = 1 + # Define your system locale here. + SYSLOCALE = LOCALE_EN + --- NEW FILE: locales.py --- # Import Locale Constants Here from wolfpack.consts import SYSLOCALE, LOCALE_EN, LOCALE_DE """ This function's purpose is to allow people to edit common messages for their own languages. The message meanings should match up with others. This will be expanded in time. """ def localemsg( msg, locale=SYSLOCALE ): # Locale Index LOCALE_MESSAGE = { LOCALE_EN: { 0: "Sorry but this feature is not implemented yet!", 1: "Where do you want to create the item ", 2: "Where do you want to create the NPC ", 3: "The item must be in your backpack to use it!", 4: "You can not pick cotton here yet.", 5: "You reach down and pick some cotton.", 6: "You are unable to reach this!", 7: "What do you want to use this on?", 8: "You must target an item.", 9: "You must target a character.", 10: "This needs to be in your belongings to use it.", 11: "You cannot dye this!", 12: "That is an invalid color.", 13: "You have to choose a hair color.", 14: "You fail to create the sextant", 15: " and break the parts.", 16: ".", 17: "You put the sextant into your backpack", 18: "Please select the object you wish to dye." }, LOCALE_DE: { 0: "", 1: "", 2: "", 3: "" } } if LOCALE_MESSAGE[locale][msg]: # Return the message return unicode( LOCALE_MESSAGE[locale][msg] ) else: return unicode( "ERROR: BAD LOCALE DEFINED" ) |
From: Richard M. <dr...@us...> - 2004-08-10 13:44:42
|
Update of /cvsroot/wpdev/xmlscripts/scripts/system In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10362 Modified Files: loot.py Log Message: This fixed the lootpack bug. Index: loot.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/system/loot.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** loot.py 7 Jun 2004 21:53:24 -0000 1.14 --- loot.py 10 Aug 2004 13:44:33 -0000 1.15 *************** *** 2,8 **** import wolfpack from wolfpack.consts import * from wolfpack import console, utilities import random - from system.lootlists import * # Indices --- 2,8 ---- import wolfpack from wolfpack.consts import * + from system.lootlists import * from wolfpack import console, utilities import random # Indices *************** *** 464,488 **** # A pack is actually a list of lists for item in pack: ! if item[PACK_CHANCE] >= random.random(): ! if type(item[PACK_AMOUNT]) == str: ! amount = utilities.rolldice(item[PACK_AMOUNT]) else: ! amount = int(item[PACK_AMOUNT]) ! if item[PACK_STACKABLE]: ! if type(item[PACK_ITEM]) == list: ! itemid = random.choice(item[PACK_ITEM]) ! else: ! itemid = str(item[PACK_ITEM]) ! item = wolfpack.additem(itemid) item.amount = amount dropitem(item, char, corpse) else: for i in range(0, amount): ! if type(item[PACK_ITEM]) == list: ! itemid = random.choice(item[PACK_ITEM]) ! else: ! itemid = str(item[PACK_ITEM]) item = wolfpack.additem(itemid) --- 464,495 ---- # A pack is actually a list of lists for item in pack: ! packchance = item[ PACK_CHANCE ] ! packstackable = item[ PACK_STACKABLE ] ! packamount = item[ PACK_AMOUNT ] ! packitem = item[ PACK_ITEM ] ! ! ! if packchance >= random.random(): ! if type( packamount ) == str: ! amount = utilities.rolldice( packamount ) else: ! amount = int( packamount ) ! if packstackable == True: ! if type( packitem ) == list: ! itemid = random.choice( packitem ) ! elif type( packitem ) == str: ! itemid = str( packitem ) ! item = wolfpack.additem( itemid ) item.amount = amount dropitem(item, char, corpse) + else: for i in range(0, amount): ! if type( packitem ) == list: ! itemid = random.choice( packitem ) ! elif type( packitem ) == str: ! itemid = str( packitem ) item = wolfpack.additem(itemid) *************** *** 505,513 **** # Create the items for each pack for pack in packs: ! if not PACKS.has_key(pack): console.log(LOG_ERROR, "Trying to create an unknown loot pack %s.\n" % pack) continue ! ! createpack(char, killer, corpse, PACKS[pack]) # --- 512,519 ---- # Create the items for each pack for pack in packs: ! if not PACKS.has_key( pack ): console.log(LOG_ERROR, "Trying to create an unknown loot pack %s.\n" % pack) continue ! createpack( char, killer, corpse, PACKS[ pack ] ) # |
From: Correa <thi...@us...> - 2004-08-10 03:28:17
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19603 Modified Files: char.cpp content.h engine.cpp engine.h global.cpp gump.h item.cpp pyaccount.cpp pyai.cpp pycoord.cpp pypacket.cpp pyregion.cpp pyspawnregion.cpp pytooltip.cpp regioniterator.h skills.h socket.cpp target.h worlditerator.cpp Log Message: applied coding standard rules. Index: content.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/content.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** content.h 20 Jul 2004 04:40:51 -0000 1.16 --- content.h 10 Aug 2004 03:27:52 -0000 1.17 *************** *** 64,74 **** goto error; cBaseChar::ItemContainer container = pc->content(); ! if ( id < 0 || static_cast<uint>(id) >= container.size() ) goto error; cBaseChar::ItemContainer::const_iterator it( container.begin() ); /* ! * Ask Correa before trying to `optimize` this, ! * there isn't much standard complient options here. ! */ for ( int i = 0; i < id && it != container.end(); ++i ) ++it; --- 64,74 ---- goto error; cBaseChar::ItemContainer container = pc->content(); ! if ( id < 0 || static_cast<uint>( id ) >= container.size() ) goto error; cBaseChar::ItemContainer::const_iterator it( container.begin() ); /* ! * Ask Correa before trying to `optimize` this, ! * there isn't much standard complient options here. ! */ for ( int i = 0; i < id && it != container.end(); ++i ) ++it; *************** *** 85,95 **** goto error; cItem::ContainerContent container = pi->content(); ! if ( id < 0 || static_cast<uint>(id) >= container.size() ) goto error; cItem::ContainerContent::const_iterator it( container.begin() ); /* ! * Ask Correa before trying to `optimize` this, ! * there isn't much standard complient options here. ! */ for ( int i = 0; i < id && it != container.end(); ++i ) ++it; --- 85,95 ---- goto error; cItem::ContainerContent container = pi->content(); ! if ( id < 0 || static_cast<uint>( id ) >= container.size() ) goto error; cItem::ContainerContent::const_iterator it( container.begin() ); /* ! * Ask Correa before trying to `optimize` this, ! * there isn't much standard complient options here. ! */ for ( int i = 0; i < id && it != container.end(); ++i ) ++it; *************** *** 106,115 **** static PySequenceMethods wpContentSequence = { ! ( inquiry ) wpContent_length, ! 0, ! 0, ! ( intargfunc ) wpContent_get, ! 0, ! 0, }; --- 106,115 ---- static PySequenceMethods wpContentSequence = { ! ( inquiry ) wpContent_length, ! 0, ! 0, ! ( intargfunc ) wpContent_get, ! 0, ! 0, }; *************** *** 117,134 **** static PyTypeObject wpContentType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpContent", ! sizeof( wpContentType ), ! 0, ! wpDealloc, ! 0, ! 0, ! 0, ! 0, ! 0, ! 0, ! & wpContentSequence, ! 0, }; --- 117,133 ---- static PyTypeObject wpContentType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpContent", ! sizeof( wpContentType ), ! 0, ! wpDealloc, ! 0, ! 0, ! 0, ! 0, ! 0, ! 0,& wpContentSequence, ! 0, }; Index: pypacket.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/pypacket.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pypacket.cpp 20 Jul 2004 04:40:51 -0000 1.13 --- pypacket.cpp 10 Aug 2004 03:27:54 -0000 1.14 *************** *** 62,74 **** static PyTypeObject wpPacketType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wppacket", ! sizeof( wpPacketType ), ! 0, ! wpPacketDestructor, ! 0, ! wpPacket_getattr, ! 0, }; --- 62,74 ---- static PyTypeObject wpPacketType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wppacket", ! sizeof( wpPacketType ), ! 0, ! wpPacketDestructor, ! 0, ! wpPacket_getattr, ! 0, }; *************** *** 330,347 **** PyMethodDef wpPacketMethods[] = { ! {"resize", wpPacket_resize, METH_VARARGS, NULL}, ! {"setbyte", wpPacket_setbyte, METH_VARARGS, NULL}, ! {"setshort", wpPacket_setshort, METH_VARARGS, NULL}, ! {"setint", wpPacket_setint, METH_VARARGS, NULL}, ! {"getascii", wpPacket_getascii, METH_VARARGS, NULL}, ! {"getunicode", wpPacket_getunicode, METH_VARARGS, NULL}, ! {"setascii", wpPacket_setascii, METH_VARARGS, NULL}, ! {"setunicode", wpPacket_setunicode, METH_VARARGS, NULL}, ! {"send", wpPacket_send, METH_VARARGS, NULL}, ! {"dump", wpPacket_dump, METH_VARARGS, NULL}, ! {"getbyte", wpPacket_getbyte, METH_VARARGS, NULL}, ! {"getshort", wpPacket_getshort, METH_VARARGS, NULL}, ! {"getint", wpPacket_getint, METH_VARARGS, NULL}, ! {NULL, NULL, 0, NULL} }; --- 330,347 ---- PyMethodDef wpPacketMethods[] = { ! {"resize", wpPacket_resize, METH_VARARGS, NULL}, ! {"setbyte", wpPacket_setbyte, METH_VARARGS, NULL}, ! {"setshort", wpPacket_setshort, METH_VARARGS, NULL}, ! {"setint", wpPacket_setint, METH_VARARGS, NULL}, ! {"getascii", wpPacket_getascii, METH_VARARGS, NULL}, ! {"getunicode", wpPacket_getunicode, METH_VARARGS, NULL}, ! {"setascii", wpPacket_setascii, METH_VARARGS, NULL}, ! {"setunicode", wpPacket_setunicode, METH_VARARGS, NULL}, ! {"send", wpPacket_send, METH_VARARGS, NULL}, ! {"dump", wpPacket_dump, METH_VARARGS, NULL}, ! {"getbyte", wpPacket_getbyte, METH_VARARGS, NULL}, ! {"getshort", wpPacket_getshort, METH_VARARGS, NULL}, ! {"getint", wpPacket_getint, METH_VARARGS, NULL}, ! {NULL, NULL, 0, NULL} }; Index: engine.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/engine.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** engine.cpp 4 Aug 2004 23:17:39 -0000 1.33 --- engine.cpp 10 Aug 2004 03:27:52 -0000 1.34 *************** *** 166,170 **** Py_DECREF( mList ); Py_DECREF( modules ); - } --- 166,169 ---- *************** *** 174,180 **** if ( PyErr_Occurred() ) { ! PyObject* exception, ! * value, ! * traceback; PyErr_Fetch( &exception, &value, &traceback ); --- 173,177 ---- if ( PyErr_Occurred() ) { ! PyObject* exception,* value,* traceback; PyErr_Fetch( &exception, &value, &traceback ); Index: pyspawnregion.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/pyspawnregion.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pyspawnregion.cpp 29 Jul 2004 19:36:22 -0000 1.2 --- pyspawnregion.cpp 10 Aug 2004 03:27:54 -0000 1.3 *************** *** 50,63 **** static PyTypeObject wpSpawnRegionType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpspawnregion", ! sizeof( wpSpawnRegionType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpSpawnRegion_getAttr, ! ( setattrfunc ) wpSpawnRegion_setAttr, ! 0, }; --- 50,63 ---- static PyTypeObject wpSpawnRegionType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpspawnregion", ! sizeof( wpSpawnRegionType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpSpawnRegion_getAttr, ! ( setattrfunc ) wpSpawnRegion_setAttr, ! 0, }; *************** *** 77,81 **** QPtrList<cUObject> objects; ! if ( isItemSerial(serial) ) { objects = self->pRegion->spawnedItems(); // Copy --- 77,81 ---- QPtrList<cUObject> objects; ! if ( isItemSerial( serial ) ) { objects = self->pRegion->spawnedItems(); // Copy *************** *** 87,91 **** cUObject *object; ! for (object = objects.first(); object; object = objects.next()) { if ( object->serial() == serial ) --- 87,91 ---- cUObject *object; ! for ( object = objects.first(); object; object = objects.next() ) { if ( object->serial() == serial ) *************** *** 112,118 **** static PyMethodDef wpSpawnRegionMethods[] = { ! { "remove", ( getattrofunc ) wpSpawnRegion_remove, METH_VARARGS, NULL }, ! { "spawn", ( getattrofunc ) wpSpawnRegion_spawn, METH_VARARGS, NULL }, ! { NULL, NULL, 0, NULL } }; --- 112,118 ---- static PyMethodDef wpSpawnRegionMethods[] = { ! { "remove", ( getattrofunc ) wpSpawnRegion_remove, METH_VARARGS, NULL }, ! { "spawn", ( getattrofunc ) wpSpawnRegion_spawn, METH_VARARGS, NULL }, ! { NULL, NULL, 0, NULL } }; *************** *** 189,193 **** cUObject *object; ! for (object = objects.first(); object; object = objects.next() ) PyList_Append( list, PyInt_FromLong( object->serial() ) ); return list; --- 189,193 ---- cUObject *object; ! for ( object = objects.first(); object; object = objects.next() ) PyList_Append( list, PyInt_FromLong( object->serial() ) ); return list; *************** *** 202,206 **** cUObject *object; ! for (object = objects.first(); object; object = objects.next() ) PyList_Append( list, PyInt_FromLong( object->serial() ) ); return list; --- 202,206 ---- cUObject *object; ! for ( object = objects.first(); object; object = objects.next() ) PyList_Append( list, PyInt_FromLong( object->serial() ) ); return list; Index: regioniterator.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/regioniterator.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** regioniterator.h 20 Jul 2004 04:40:51 -0000 1.12 --- regioniterator.h 10 Aug 2004 03:27:54 -0000 1.13 *************** *** 75,91 **** static PyTypeObject wpRegionIteratorItemsType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpItemRegionIterator", ! sizeof( wpRegionIteratorItemsType ), ! 0, ! wpItemIteratorDealloc, ! 0, ! ( getattrfunc ) wpRegionIteratorItems_getAttr, ! 0, ! 0, ! 0, ! 0, ! 0, }; --- 75,91 ---- static PyTypeObject wpRegionIteratorItemsType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpItemRegionIterator", ! sizeof( wpRegionIteratorItemsType ), ! 0, ! wpItemIteratorDealloc, ! 0, ! ( getattrfunc ) wpRegionIteratorItems_getAttr, ! 0, ! 0, ! 0, ! 0, ! 0, }; *************** *** 151,167 **** static PyTypeObject wpRegionIteratorCharsType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpCharRegionIterator", ! sizeof( wpRegionIteratorCharsType ), ! 0, ! wpCharIteratorDealloc, ! 0, ! ( getattrfunc ) wpRegionIteratorChars_getAttr, ! 0, ! 0, ! 0, ! 0, ! 0, }; --- 151,167 ---- static PyTypeObject wpRegionIteratorCharsType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpCharRegionIterator", ! sizeof( wpRegionIteratorCharsType ), ! 0, ! wpCharIteratorDealloc, ! 0, ! ( getattrfunc ) wpRegionIteratorChars_getAttr, ! 0, ! 0, ! 0, ! 0, ! 0, }; Index: skills.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/skills.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** skills.h 20 Jul 2004 04:40:51 -0000 1.20 --- skills.h 10 Aug 2004 03:27:54 -0000 1.21 *************** *** 92,101 **** static PySequenceMethods wpSkillsSequence = { ! ( inquiry ) wpSkills_length, ! 0, ! 0, ! ( intargfunc ) wpSkills_get, ! 0, ! ( intobjargproc ) wpSkills_set, }; --- 92,101 ---- static PySequenceMethods wpSkillsSequence = { ! ( inquiry ) wpSkills_length, ! 0, ! 0, ! ( intargfunc ) wpSkills_get, ! 0, ! ( intobjargproc ) wpSkills_set, }; *************** *** 103,119 **** static PyTypeObject wpSkillsType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpSkills", ! sizeof( wpSkillsType ), ! 0, ! wpDealloc, ! 0, ! 0, ! 0, ! 0, ! 0, ! 0, ! &wpSkillsSequence, ! 0, }; --- 103,118 ---- static PyTypeObject wpSkillsType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "wpSkills", ! sizeof( wpSkillsType ), ! 0, ! wpDealloc, ! 0, ! 0, ! 0, ! 0, ! 0, ! 0,& wpSkillsSequence, ! 0, }; Index: pycoord.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/pycoord.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pycoord.cpp 20 Jul 2004 11:35:38 -0000 1.17 --- pycoord.cpp 10 Aug 2004 03:27:54 -0000 1.18 *************** *** 42,48 **** // Return a string representation for a coord object. ! static PyObject *wpCoord_str(wpCoord *object) { const Coord_cl &pos = object->coord; ! return PyString_FromFormat("%i,%i,%i,%i", pos.x, pos.y, (int)pos.z, pos.map); } --- 42,49 ---- // Return a string representation for a coord object. ! static PyObject* wpCoord_str( wpCoord* object ) ! { const Coord_cl &pos = object->coord; ! return PyString_FromFormat( "%i,%i,%i,%i", pos.x, pos.y, ( int ) pos.z, pos.map ); } *************** *** 51,55 **** static PyObject* wpCoord_getAttr( wpCoord* self, char* name ); static int wpCoord_setAttr( wpCoord* self, char* name, PyObject* value ); ! static int wpCoord_compare(PyObject *a, PyObject *b); /*! --- 52,56 ---- static PyObject* wpCoord_getAttr( wpCoord* self, char* name ); static int wpCoord_setAttr( wpCoord* self, char* name, PyObject* value ); ! static int wpCoord_compare( PyObject* a, PyObject* b ); /*! *************** *** 57,90 **** */ PyTypeObject wpCoordType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "WPCoord", ! sizeof( wpCoordType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpCoord_getAttr, ! ( setattrfunc ) wpCoord_setAttr, ! (cmpfunc)wpCoord_compare, ! 0, ! 0, ! 0, ! 0, ! 0, ! 0, // Call ! (reprfunc)wpCoord_str }; ! static int wpCoord_compare(PyObject *a, PyObject *b) { // Both have to be coordinates ! if (a->ob_type != &wpCoordType || b->ob_type != &wpCoordType) return -1; ! const Coord_cl &posa = ((wpCoord*)a)->coord; ! const Coord_cl &posb = ((wpCoord*)b)->coord; ! ! if (posa.x != posb.x || posa.y != posb.y || posa.z != posb.z || posa.map != posb.map) { return -1; ! } else { return 0; } --- 58,95 ---- */ PyTypeObject wpCoordType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "WPCoord", ! sizeof( wpCoordType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpCoord_getAttr, ! ( setattrfunc ) wpCoord_setAttr, ! ( cmpfunc ) wpCoord_compare, ! 0, ! 0, ! 0, ! 0, ! 0, ! 0, // Call ! ( reprfunc ) wpCoord_str }; ! static int wpCoord_compare( PyObject* a, PyObject* b ) ! { // Both have to be coordinates ! if ( a->ob_type != &wpCoordType || b->ob_type != &wpCoordType ) return -1; ! const Coord_cl &posa = ( ( wpCoord* ) a )->coord; ! const Coord_cl &posb = ( ( wpCoord* ) b )->coord; ! ! if ( posa.x != posb.x || posa.y != posb.y || posa.z != posb.z || posa.map != posb.map ) ! { return -1; ! } ! else ! { return 0; } *************** *** 169,182 **** if ( self->coord.lineOfSight( pos, targetheight, touch ) ) return Py_True; ! return Py_False; } static PyMethodDef wpCoordMethods[] = { ! { "distance", ( getattrofunc ) wpCoord_distance, METH_VARARGS, "Whats the distance between Point A and Point B" }, ! { "direction", ( getattrofunc ) wpCoord_direction, METH_VARARGS, NULL }, ! { "validspawnspot", ( getattrofunc ) wpCoord_validspawnspot, METH_VARARGS, NULL }, ! { "lineofsight", ( getattrofunc ) wpCoord_lineofsight, METH_VARARGS, NULL }, ! { 0, 0, 0, 0 } }; --- 174,187 ---- if ( self->coord.lineOfSight( pos, targetheight, touch ) ) return Py_True; ! return Py_False; } static PyMethodDef wpCoordMethods[] = { ! { "distance", ( getattrofunc ) wpCoord_distance, METH_VARARGS, "Whats the distance between Point A and Point B" }, ! { "direction", ( getattrofunc ) wpCoord_direction, METH_VARARGS, NULL }, ! { "validspawnspot", ( getattrofunc ) wpCoord_validspawnspot, METH_VARARGS, NULL }, ! { "lineofsight", ( getattrofunc ) wpCoord_lineofsight, METH_VARARGS, NULL }, ! { 0, 0, 0, 0 } }; Index: socket.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/socket.cpp,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** socket.cpp 20 Jul 2004 04:40:51 -0000 1.80 --- socket.cpp 10 Aug 2004 03:27:54 -0000 1.81 *************** *** 51,64 **** static PyTypeObject wpSocketType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wpsocket", ! sizeof( wpSocketType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpSocket_getAttr, ! ( setattrfunc ) wpSocket_setAttr, ! 0, }; --- 51,64 ---- static PyTypeObject wpSocketType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wpsocket", ! sizeof( wpSocketType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpSocket_getAttr, ! ( setattrfunc ) wpSocket_setAttr, ! 0, }; *************** *** 386,392 **** nodispose; unsigned int serial, type; ! PyObject* layout, ! * texts, ! * py_args; char* callback; --- 386,390 ---- nodispose; unsigned int serial, type; ! PyObject* layout,* texts,* py_args; char* callback; *************** *** 759,763 **** static PyObject* wpSocket_updateplayer( wpSocket* self, PyObject* args ) { ! Q_UNUSED(args); self->pSock->updatePlayer(); return PyTrue(); --- 757,761 ---- static PyObject* wpSocket_updateplayer( wpSocket* self, PyObject* args ) { ! Q_UNUSED( args ); self->pSock->updatePlayer(); return PyTrue(); *************** *** 779,809 **** static PyMethodDef wpSocketMethods[] = { ! { "useitem", ( getattrofunc ) wpSocket_useitem, METH_VARARGS, NULL }, ! { "updateskill", ( getattrofunc ) wpSocket_updateskill, METH_VARARGS, NULL }, ! { "updateplayer", ( getattrofunc ) wpSocket_updateplayer, METH_VARARGS, NULL }, ! { "questarrow", ( getattrofunc ) wpSocket_questarrow, METH_VARARGS, NULL }, ! { "sysmessage", ( getattrofunc ) wpSocket_sysmessage, METH_VARARGS, "Sends a system message to the char." }, ! { "clilocmessage", ( getattrofunc ) wpSocket_clilocmessage, METH_VARARGS, "Sends a localized message to the socket." }, ! { "showspeech", ( getattrofunc ) wpSocket_showspeech, METH_VARARGS, "Sends raw speech to the socket." }, ! { "disconnect", ( getattrofunc ) wpSocket_disconnect, METH_VARARGS, "Disconnects the socket." }, ! { "attachtarget", ( getattrofunc ) wpSocket_attachtarget, METH_VARARGS, "Adds a target request to the socket" }, ! { "attachmultitarget", ( getattrofunc ) wpSocket_attachmultitarget, METH_VARARGS, "Adds a multi target request to the socket" }, ! { "attachitemtarget", ( getattrofunc ) wpSocket_attachitemtarget, METH_VARARGS, "Adds a target request to the socket" }, ! { "sendgump", ( getattrofunc ) wpSocket_sendgump, METH_VARARGS, "INTERNAL! Sends a gump to this socket." }, ! { "closegump", ( getattrofunc ) wpSocket_closegump, METH_VARARGS, "Closes a gump that has been sent to the client." }, ! { "resendworld", ( getattrofunc ) wpSocket_resendworld, METH_VARARGS, "Sends the surrounding world to this socket." }, ! { "resendplayer", ( getattrofunc ) wpSocket_resendplayer, METH_VARARGS, "Resends the player only." }, ! { "sendcontainer", ( getattrofunc ) wpSocket_sendcontainer, METH_VARARGS, "Sends a container to the socket." }, ! { "sendpacket", ( getattrofunc ) wpSocket_sendpacket, METH_VARARGS, "Sends a packet to this socket." }, ! { "sendpaperdoll", ( getattrofunc ) wpSocket_sendpaperdoll, METH_VARARGS, "Sends a char's paperdool to this socket." }, ! { "gettag", ( getattrofunc ) wpSocket_gettag, METH_VARARGS, "Gets a tag from a socket." }, ! { "settag", ( getattrofunc ) wpSocket_settag, METH_VARARGS, "Sets a tag to a socket." }, ! { "hastag", ( getattrofunc ) wpSocket_hastag, METH_VARARGS, "Checks if a socket has a specific tag." }, ! { "deltag", ( getattrofunc ) wpSocket_deltag, METH_VARARGS, "Delete specific tag." }, ! { "resendstatus", ( getattrofunc ) wpSocket_resendstatus, METH_VARARGS, "Resends the status windows to this client." }, ! { "customize", ( getattrofunc ) wpSocket_customize, METH_VARARGS, "Begin house customization." }, ! { "log", ( getattrofunc ) wpSocket_log, METH_VARARGS, NULL }, ! { "updatelightlevel", ( getattrofunc ) wpSocket_updatelightlevel, METH_VARARGS, NULL }, ! { NULL, NULL, 0, NULL } }; --- 777,807 ---- static PyMethodDef wpSocketMethods[] = { ! { "useitem", ( getattrofunc ) wpSocket_useitem, METH_VARARGS, NULL }, ! { "updateskill", ( getattrofunc ) wpSocket_updateskill, METH_VARARGS, NULL }, ! { "updateplayer", ( getattrofunc ) wpSocket_updateplayer, METH_VARARGS, NULL }, ! { "questarrow", ( getattrofunc ) wpSocket_questarrow, METH_VARARGS, NULL }, ! { "sysmessage", ( getattrofunc ) wpSocket_sysmessage, METH_VARARGS, "Sends a system message to the char." }, ! { "clilocmessage", ( getattrofunc ) wpSocket_clilocmessage, METH_VARARGS, "Sends a localized message to the socket." }, ! { "showspeech", ( getattrofunc ) wpSocket_showspeech, METH_VARARGS, "Sends raw speech to the socket." }, ! { "disconnect", ( getattrofunc ) wpSocket_disconnect, METH_VARARGS, "Disconnects the socket." }, ! { "attachtarget", ( getattrofunc ) wpSocket_attachtarget, METH_VARARGS, "Adds a target request to the socket" }, ! { "attachmultitarget", ( getattrofunc ) wpSocket_attachmultitarget, METH_VARARGS, "Adds a multi target request to the socket" }, ! { "attachitemtarget", ( getattrofunc ) wpSocket_attachitemtarget, METH_VARARGS, "Adds a target request to the socket" }, ! { "sendgump", ( getattrofunc ) wpSocket_sendgump, METH_VARARGS, "INTERNAL! Sends a gump to this socket." }, ! { "closegump", ( getattrofunc ) wpSocket_closegump, METH_VARARGS, "Closes a gump that has been sent to the client." }, ! { "resendworld", ( getattrofunc ) wpSocket_resendworld, METH_VARARGS, "Sends the surrounding world to this socket." }, ! { "resendplayer", ( getattrofunc ) wpSocket_resendplayer, METH_VARARGS, "Resends the player only." }, ! { "sendcontainer", ( getattrofunc ) wpSocket_sendcontainer, METH_VARARGS, "Sends a container to the socket." }, ! { "sendpacket", ( getattrofunc ) wpSocket_sendpacket, METH_VARARGS, "Sends a packet to this socket." }, ! { "sendpaperdoll", ( getattrofunc ) wpSocket_sendpaperdoll, METH_VARARGS, "Sends a char's paperdool to this socket." }, ! { "gettag", ( getattrofunc ) wpSocket_gettag, METH_VARARGS, "Gets a tag from a socket." }, ! { "settag", ( getattrofunc ) wpSocket_settag, METH_VARARGS, "Sets a tag to a socket." }, ! { "hastag", ( getattrofunc ) wpSocket_hastag, METH_VARARGS, "Checks if a socket has a specific tag." }, ! { "deltag", ( getattrofunc ) wpSocket_deltag, METH_VARARGS, "Delete specific tag." }, ! { "resendstatus", ( getattrofunc ) wpSocket_resendstatus, METH_VARARGS, "Resends the status windows to this client." }, ! { "customize", ( getattrofunc ) wpSocket_customize, METH_VARARGS, "Begin house customization." }, ! { "log", ( getattrofunc ) wpSocket_log, METH_VARARGS, NULL }, ! { "updatelightlevel", ( getattrofunc ) wpSocket_updatelightlevel, METH_VARARGS, NULL }, ! { NULL, NULL, 0, NULL } }; *************** *** 844,850 **** \rproperty socket.address A string containing the IP address this socket is connected to. */ ! else if (!strcmp(name, "address")) { ! return QString2Python(self->pSock->ip()); ! } else { return Py_FindMethod( wpSocketMethods, ( PyObject * ) self, name ); } --- 842,851 ---- \rproperty socket.address A string containing the IP address this socket is connected to. */ ! else if ( !strcmp( name, "address" ) ) ! { ! return QString2Python( self->pSock->ip() ); ! } ! else ! { return Py_FindMethod( wpSocketMethods, ( PyObject * ) self, name ); } Index: pyai.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/pyai.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pyai.cpp 20 Jul 2004 04:40:51 -0000 1.8 --- pyai.cpp 10 Aug 2004 03:27:54 -0000 1.9 *************** *** 58,76 **** static PyTypeObject wpAIType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wpai", ! sizeof( wpAIType ), ! 0, ! //FreeItemObject, ! wpDealloc, ! 0, ! ( getattrfunc ) wpAI_getAttr, ! ( setattrfunc ) wpAI_setAttr, ! wpAI_compare, ! 0, ! 0, ! 0, ! 0, }; --- 58,76 ---- static PyTypeObject wpAIType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wpai", ! sizeof( wpAIType ), ! 0, ! //FreeItemObject, ! wpDealloc, ! 0, ! ( getattrfunc ) wpAI_getAttr, ! ( setattrfunc ) wpAI_setAttr, ! wpAI_compare, ! 0, ! 0, ! 0, ! 0, }; *************** *** 114,119 **** static PyMethodDef wpAIMethods[] = { ! { "onSpeechInput", ( getattrofunc ) wpAI_onSpeechInput, METH_VARARGS, "Executes the onSpeechInput event" }, ! { NULL, NULL, 0, NULL } }; --- 114,119 ---- static PyMethodDef wpAIMethods[] = { ! { "onSpeechInput", ( getattrofunc ) wpAI_onSpeechInput, METH_VARARGS, "Executes the onSpeechInput event" }, ! { NULL, NULL, 0, NULL } }; *************** *** 129,135 **** { // Special Python things. ! Q_UNUSED(self); ! Q_UNUSED(name); ! Q_UNUSED(value); return 0; } --- 129,135 ---- { // Special Python things. ! Q_UNUSED( self ); ! Q_UNUSED( name ); ! Q_UNUSED( value ); return 0; } Index: gump.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/gump.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** gump.h 20 Jul 2004 04:40:51 -0000 1.21 --- gump.h 10 Aug 2004 03:27:53 -0000 1.22 *************** *** 67,71 **** for ( ; iter != textentries.end(); ++iter ) { ! PyDict_SetItem(dict, PyInt_FromLong(iter->first), QString2Python(iter->second)); } --- 67,71 ---- for ( ; iter != textentries.end(); ++iter ) { ! PyDict_SetItem( dict, PyInt_FromLong( iter->first ), QString2Python( iter->second ) ); } *************** *** 94,110 **** static PyTypeObject wpGumpResponseType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wpGumpResponse", ! sizeof( wpGumpResponseType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpGumpResponse_getAttr, ! 0, ! 0, ! 0, ! 0, ! 0, }; --- 94,110 ---- static PyTypeObject wpGumpResponseType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wpGumpResponse", ! sizeof( wpGumpResponseType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpGumpResponse_getAttr, ! 0, ! 0, ! 0, ! 0, ! 0, }; Index: item.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/item.cpp,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** item.cpp 27 Jul 2004 06:35:23 -0000 1.118 --- item.cpp 10 Aug 2004 03:27:53 -0000 1.119 *************** *** 68,73 **** // Return a string representation for an item object. ! static PyObject *wpItem_str(wpItem *object) { ! return PyString_FromFormat("0x%x", object->pItem->serial()); } --- 68,74 ---- // Return a string representation for an item object. ! static PyObject* wpItem_str( wpItem* object ) ! { ! return PyString_FromFormat( "0x%x", object->pItem->serial() ); } *************** *** 77,97 **** static PyTypeObject wpItemType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wpitem", ! sizeof( wpItemType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpItem_getAttr, ! ( setattrfunc ) wpItem_setAttr, ! wpItem_compare, ! 0, ! 0, ! 0, ! 0, ! ( hashfunc ) wpItem_hash, ! 0, ! (reprfunc)wpItem_str }; --- 78,98 ---- static PyTypeObject wpItemType = { ! PyObject_HEAD_INIT( &PyType_Type ) ! 0, ! "wpitem", ! sizeof( wpItemType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpItem_getAttr, ! ( setattrfunc ) wpItem_setAttr, ! wpItem_compare, ! 0, ! 0, ! 0, ! 0, ! ( hashfunc ) wpItem_hash, ! 0, ! ( reprfunc ) wpItem_str }; *************** *** 187,191 **** return 0; } ! pos.z = (signed char)z; self->pItem->moveTo( pos, noRemove ? true : false ); } --- 188,192 ---- return 0; } ! pos.z = ( signed char ) z; self->pItem->moveTo( pos, noRemove ? true : false ); } *************** *** 440,444 **** return 0; ! QString key(pKey); return self->pItem->getTag( key ).isValid() ? PyTrue() : PyFalse(); --- 441,445 ---- return 0; ! QString key( pKey ); return self->pItem->getTag( key ).isValid() ? PyTrue() : PyFalse(); *************** *** 728,732 **** static PyObject* wpItem_multi( wpItem* self, PyObject* args ) { ! Q_UNUSED(args); /* if( self->pItem->free ) --- 729,733 ---- static PyObject* wpItem_multi( wpItem* self, PyObject* args ) { ! Q_UNUSED( args ); /* if( self->pItem->free ) *************** *** 793,797 **** static PyObject* wpItem_isblessed( wpItem* self, PyObject* args ) { ! Q_UNUSED(args); if ( self->pItem->free ) { --- 794,798 ---- static PyObject* wpItem_isblessed( wpItem* self, PyObject* args ) { ! Q_UNUSED( args ); if ( self->pItem->free ) { *************** *** 991,1001 **** static char* kwlist[] = { ! "clilocid", ! "args", ! "affix", ! "prepend", ! "color", ! "socket", ! NULL }; --- 992,1002 ---- static char* kwlist[] = { ! "clilocid", ! "args", ! "affix", ! "prepend", ! "color", ! "socket", ! NULL }; *************** *** 1085,1132 **** static PyMethodDef wpItemMethods[] = { ! { "additem", ( getattrofunc ) wpItem_additem, METH_VARARGS, "Adds an item to this container." }, ! { "countitem", ( getattrofunc ) wpItem_countItem, METH_VARARGS, "Counts how many items are inside this container." }, ! { "countitems", ( getattrofunc ) wpItem_countitems, METH_VARARGS, "Counts the items inside of this container based on a list of baseids." }, ! { "removeitems", ( getattrofunc ) wpItem_removeitems, METH_VARARGS, "Removes items inside of this container based on a list of baseids." }, ! { "update", ( getattrofunc ) wpItem_update, METH_VARARGS, "Sends the item to all clients in range." }, ! { "removefromview", ( getattrofunc ) wpItem_removefromview, METH_VARARGS, "Removes the item from the view of all in-range clients." }, ! { "delete", ( getattrofunc ) wpItem_delete, METH_VARARGS, "Deletes the item and the underlying reference." }, ! { "moveto", ( getattrofunc ) wpItem_moveto, METH_VARARGS, "Moves the item to the specified location." }, ! { "soundeffect", ( getattrofunc ) wpItem_soundeffect, METH_VARARGS, "Sends a soundeffect to the surrounding sockets." }, ! { "distanceto", ( getattrofunc ) wpItem_distanceto, METH_VARARGS, "Distance to another object or a given position." }, ! { "canstack", ( getattrofunc ) wpItem_canstack, METH_VARARGS, "Sees if the item can be stacked on another item." }, ! { "useresource", ( getattrofunc ) wpItem_useresource, METH_VARARGS, "Consumes a given resource from within the current item." }, ! { "countresource", ( getattrofunc ) wpItem_countresource, METH_VARARGS, "Returns the amount of a given resource available in this container." }, ! { "addtimer", ( getattrofunc ) wpItem_addtimer, METH_VARARGS, "Attaches a timer to this object." }, ! { "getoutmostchar", ( getattrofunc ) wpItem_getoutmostchar, METH_VARARGS, "Get the outmost character." }, ! { "getoutmostitem", ( getattrofunc ) wpItem_getoutmostitem, METH_VARARGS, "Get the outmost item." }, ! { "getname", ( getattrofunc ) wpItem_getname, METH_VARARGS, "Get item name." }, ! { "multi", ( getattrofunc ) wpItem_multi, METH_VARARGS, 0 }, ! { "lightning", ( getattrofunc ) wpItem_lightning, METH_VARARGS, 0 }, ! { "resendtooltip", ( getattrofunc ) wpItem_resendtooltip, METH_VARARGS, 0 }, ! { "dupe", ( getattrofunc ) wpItem_dupe, METH_VARARGS, 0 }, ! { "say", ( getattrofunc ) wpItem_say, METH_VARARGS | METH_KEYWORDS, 0 }, ! { "effect", ( getattrofunc ) wpItem_effect, METH_VARARGS, 0 }, ! // Event handling ! { "callevent", ( getattrofunc ) wpItem_callevent, METH_VARARGS, 0 }, ! { "addevent", ( getattrofunc ) wpItem_addevent, METH_VARARGS, 0}, ! { "removeevent", ( getattrofunc ) wpItem_removeevent, METH_VARARGS, 0}, ! { "hasevent", ( getattrofunc ) wpItem_hasevent, METH_VARARGS, 0}, ! // Effects ! { "movingeffect", ( getattrofunc ) wpItem_movingeffect, METH_VARARGS, "Shows a moving effect moving toward a given object or coordinate." }, ! // Tag System ! { "gettag", ( getattrofunc ) wpItem_gettag, METH_VARARGS, "Gets a tag assigned to a specific item." }, ! { "settag", ( getattrofunc ) wpItem_settag, METH_VARARGS, "Sets a tag assigned to a specific item." }, ! { "hastag", ( getattrofunc ) wpItem_hastag, METH_VARARGS, "Checks if a certain item has the specified tag." }, ! { "deltag", ( getattrofunc ) wpItem_deltag, METH_VARARGS, "Deletes the specified tag." }, ! // Is*? Functions ! { "isitem", ( getattrofunc ) wpItem_isitem, METH_VARARGS, "Is this an item." }, ! { "ischar", ( getattrofunc ) wpItem_ischar, METH_VARARGS, "Is this a char." }, ! { "isblessed", ( getattrofunc ) wpItem_isblessed, METH_VARARGS, "Is this item blessed(newbie) "}, ! { NULL, NULL, 0, NULL } }; --- 1086,1133 ---- static PyMethodDef wpItemMethods[] = { ! { "additem", ( getattrofunc ) wpItem_additem, METH_VARARGS, "Adds an item to this container." }, ! { "countitem", ( getattrofunc ) wpItem_countItem, METH_VARARGS, "Counts how many items are inside this container." }, ! { "countitems", ( getattrofunc ) wpItem_countitems, METH_VARARGS, "Counts the items inside of this container based on a list of baseids." }, ! { "removeitems", ( getattrofunc ) wpItem_removeitems, METH_VARARGS, "Removes items inside of this container based on a list of baseids." }, ! { "update", ( getattrofunc ) wpItem_update, METH_VARARGS, "Sends the item to all clients in range." }, ! { "removefromview", ( getattrofunc ) wpItem_removefromview, METH_VARARGS, "Removes the item from the view of all in-range clients." }, ! { "delete", ( getattrofunc ) wpItem_delete, METH_VARARGS, "Deletes the item and the underlying reference." }, ! { "moveto", ( getattrofunc ) wpItem_moveto, METH_VARARGS, "Moves the item to the specified location." }, ! { "soundeffect", ( getattrofunc ) wpItem_soundeffect, METH_VARARGS, "Sends a soundeffect to the surrounding sockets." }, ! { "distanceto", ( getattrofunc ) wpItem_distanceto, METH_VARARGS, "Distance to another object or a given position." }, ! { "canstack", ( getattrofunc ) wpItem_canstack, METH_VARARGS, "Sees if the item can be stacked on another item." }, ! { "useresource", ( getattrofunc ) wpItem_useresource, METH_VARARGS, "Consumes a given resource from within the current item." }, ! { "countresource", ( getattrofunc ) wpItem_countresource, METH_VARARGS, "Returns the amount of a given resource available in this container." }, ! { "addtimer", ( getattrofunc ) wpItem_addtimer, METH_VARARGS, "Attaches a timer to this object." }, ! { "getoutmostchar", ( getattrofunc ) wpItem_getoutmostchar, METH_VARARGS, "Get the outmost character." }, ! { "getoutmostitem", ( getattrofunc ) wpItem_getoutmostitem, METH_VARARGS, "Get the outmost item." }, ! { "getname", ( getattrofunc ) wpItem_getname, METH_VARARGS, "Get item name." }, ! { "multi", ( getattrofunc ) wpItem_multi, METH_VARARGS, 0 }, ! { "lightning", ( getattrofunc ) wpItem_lightning, METH_VARARGS, 0 }, ! { "resendtooltip", ( getattrofunc ) wpItem_resendtooltip, METH_VARARGS, 0 }, ! { "dupe", ( getattrofunc ) wpItem_dupe, METH_VARARGS, 0 }, ! { "say", ( getattrofunc ) wpItem_say, METH_VARARGS | METH_KEYWORDS, 0 }, ! { "effect", ( getattrofunc ) wpItem_effect, METH_VARARGS, 0 }, ! // Event handling ! { "callevent", ( getattrofunc ) wpItem_callevent, METH_VARARGS, 0 }, ! { "addevent", ( getattrofunc ) wpItem_addevent, METH_VARARGS, 0}, ! { "removeevent", ( getattrofunc ) wpItem_removeevent, METH_VARARGS, 0}, ! { "hasevent", ( getattrofunc ) wpItem_hasevent, METH_VARARGS, 0}, ! // Effects ! { "movingeffect", ( getattrofunc ) wpItem_movingeffect, METH_VARARGS, "Shows a moving effect moving toward a given object or coordinate." }, ! // Tag System ! { "gettag", ( getattrofunc ) wpItem_gettag, METH_VARARGS, "Gets a tag assigned to a specific item." }, ! { "settag", ( getattrofunc ) wpItem_settag, METH_VARARGS, "Sets a tag assigned to a specific item." }, ! { "hastag", ( getattrofunc ) wpItem_hastag, METH_VARARGS, "Checks if a certain item has the specified tag." }, ! { "deltag", ( getattrofunc ) wpItem_deltag, METH_VARARGS, "Deletes the specified tag." }, ! // Is*? Functions ! { "isitem", ( getattrofunc ) wpItem_isitem, METH_VARARGS, "Is this an item." }, ! { "ischar", ( getattrofunc ) wpItem_ischar, METH_VARARGS, "Is this a char." }, ! { "isblessed", ( getattrofunc ) wpItem_isblessed, METH_VARARGS, "Is this item blessed(newbie) "}, ! { NULL, NULL, 0, NULL } }; *************** *** 1193,1197 **** \rproperty item.events Returns a list of all event names the object has. */ ! else if ( !strcmp( "events", name ) ) { QStringList events = QStringList::split( ",", self->pItem->eventList() ); PyObject* list = PyList_New( events.count() ); --- 1194,1199 ---- \rproperty item.events Returns a list of all event names the object has. */ ! else if ( !strcmp( "events", name ) ) ! { QStringList events = QStringList::split( ",", self->pItem->eventList() ); PyObject* list = PyList_New( events.count() ); *************** *** 1199,1205 **** PyList_SetItem( list, i, PyString_FromString( events[i].latin1() ) ); return list; ! } else { ! PyObject* result = self->pItem->getProperty(name); ! if (result) { return result; } --- 1201,1210 ---- PyList_SetItem( list, i, PyString_FromString( events[i].latin1() ) ); return list; ! } ! else ! { ! PyObject* result = self->pItem->getProperty( name ); ! if ( result ) ! { return result; } Index: global.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/global.cpp,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** global.cpp 4 Aug 2004 23:17:39 -0000 1.144 --- global.cpp 10 Aug 2004 03:27:52 -0000 1.145 *************** *** 68,72 **** PyObject* PyGetObjectObject( cUObject* object ) { ! if (!object) { Py_RETURN_NONE; } --- 68,73 ---- PyObject* PyGetObjectObject( cUObject* object ) { ! if ( !object ) ! { Py_RETURN_NONE; } *************** *** 181,185 **** Q_UNUSED( self ); char* message; ! if (!PyArg_ParseTuple( args, "es", "utf-8", &message)) { return 0; } --- 182,187 ---- Q_UNUSED( self ); char* message; ! if ( !PyArg_ParseTuple( args, "es", "utf-8", &message ) ) ! { return 0; } *************** *** 267,279 **** static PyMethodDef wpConsole[] = { ! { "send", wpConsole_send, METH_VARARGS, 0 }, ! { "sendprogress", wpConsole_sendprogress, METH_VARARGS, 0 }, ! { "senddone", wpConsole_senddone, METH_NOARGS, 0 }, ! { "sendfail", wpConsole_sendfail, METH_NOARGS, 0 }, ! { "sendskip", wpConsole_sendskip, METH_NOARGS, 0 }, ! { "getbuffer", wpConsole_getbuffer, METH_NOARGS, 0 }, ! { "log", wpConsole_log, METH_VARARGS, 0 }, ! { "shutdown", wpConsole_shutdown, METH_NOARGS, 0 }, ! { NULL, NULL, 0, NULL } // Terminator }; --- 269,281 ---- static PyMethodDef wpConsole[] = { ! { "send", wpConsole_send, METH_VARARGS, 0 }, ! { "sendprogress", wpConsole_sendprogress, METH_VARARGS, 0 }, ! { "senddone", wpConsole_senddone, METH_NOARGS, 0 }, ! { "sendfail", wpConsole_sendfail, METH_NOARGS, 0 }, ! { "sendskip", wpConsole_sendskip, METH_NOARGS, 0 }, ! { "getbuffer", wpConsole_getbuffer, METH_NOARGS, 0 }, ! { "log", wpConsole_log, METH_VARARGS, 0 }, ! { "shutdown", wpConsole_shutdown, METH_NOARGS, 0 }, ! { NULL, NULL, 0, NULL } // Terminator }; *************** *** 342,351 **** static PyMethodDef wpTime[] = { ! { "minute", wpTime_minute, METH_NOARGS, "Returns the current time-minutes" }, ! { "hour", wpTime_hour, METH_NOARGS, "Returns the current time-hour" }, ! { "days", wpTime_days, METH_NOARGS, "Returns the current date-day" }, ! { "minutes", wpTime_minutes, METH_NOARGS, "Returns the current timestamp" }, ! { "currentlightlevel", wpTime_currentlightlevel, METH_NOARGS, "Returns the current light level" }, ! { NULL, NULL, 0, NULL } // Terminator }; --- 344,353 ---- static PyMethodDef wpTime[] = { ! { "minute", wpTime_minute, METH_NOARGS, "Returns the current time-minutes" }, ! { "hour", wpTime_hour, METH_NOARGS, "Returns the current time-hour" }, ! { "days", wpTime_days, METH_NOARGS, "Returns the current date-day" }, ! { "minutes", wpTime_minutes, METH_NOARGS, "Returns the current timestamp" }, ! { "currentlightlevel", wpTime_currentlightlevel, METH_NOARGS, "Returns the current light level" }, ! { NULL, NULL, 0, NULL } // Terminator }; *************** *** 643,647 **** over all items registered in the world. */ ! static PyObject* wpAllItemsIterator(PyObject* self, PyObject* args) { Q_UNUSED( args ); Q_UNUSED( self ); --- 645,650 ---- over all items registered in the world. */ ! static PyObject* wpAllItemsIterator( PyObject* self, PyObject* args ) ! { Q_UNUSED( args ); Q_UNUSED( self ); *************** *** 655,659 **** over all characters registered in the world. */ ! static PyObject* wpAllCharsIterator(PyObject* self, PyObject* args) { Q_UNUSED( args ); Q_UNUSED( self ); --- 658,663 ---- over all characters registered in the world. */ ! static PyObject* wpAllCharsIterator( PyObject* self, PyObject* args ) ! { Q_UNUSED( args ); Q_UNUSED( self ); *************** *** 1677,1686 **** static PyObject* wpGetOption( PyObject* self, PyObject* args ) { ! Q_UNUSED(self); ! QString arg_key = getArgStr(0); ! QString arg_def = getArgStr(1); QString value; ! World::instance()->getOption(arg_key, value, arg_def); ! return PyString_FromString(value); } --- 1681,1690 ---- static PyObject* wpGetOption( PyObject* self, PyObject* args ) { ! Q_UNUSED( self ); ! QString arg_key = getArgStr( 0 ); ! QString arg_def = getArgStr( 1 ); QString value; ! World::instance()->getOption( arg_key, value, arg_def ); ! return PyString_FromString( value ); } *************** *** 1722,1750 **** \description Retrieve information about a given character baseid. */ ! static PyObject* wpCharBase(PyObject* self, PyObject* args) { char *baseid; ! if (!PyArg_ParseTuple(args, "s:wolfpack.charbase(baseid)", &baseid)) { return 0; } ! cCharBaseDef *basedef = CharBaseDefs::instance()->get(baseid); ! if (!basedef) { ! return PyErr_Format(PyExc_RuntimeError, "An error occured while retrieving the character basedefinition %s.", baseid); } PyObject *dict = PyDict_New(); ! PyDict_SetItemString(dict, "basesound", PyInt_FromLong(basedef->basesound())); ! PyDict_SetItemString(dict, "soundmode", PyInt_FromLong(basedef->soundmode())); ! PyDict_SetItemString(dict, "flags", PyInt_FromLong(basedef->flags())); ! PyDict_SetItemString(dict, "figurine", PyInt_FromLong(basedef->figurine())); ! PyDict_SetItemString(dict, "mindamage", PyInt_FromLong(basedef->minDamage())); ! PyDict_SetItemString(dict, "maxdamage", PyInt_FromLong(basedef->maxDamage())); ! PyDict_SetItemString(dict, "mintaming", PyInt_FromLong(basedef->minTaming())); ! PyDict_SetItemString(dict, "carve", QString2Python(basedef->carve())); ! PyDict_SetItemString(dict, "lootpacks", QString2Python(basedef->lootPacks())); ! PyDict_SetItemString(dict, "bindmenu", QString2Python(basedef->bindmenu())); ! PyDict_SetItemString(dict, "controlslots", PyInt_FromLong(basedef->controlSlots())); ! PyDict_SetItemString(dict, "criticalhealth", PyInt_FromLong(basedef->criticalHealth())); return dict; } --- 1726,1757 ---- \description Retrieve information about a given character baseid. */ ! static PyObject* wpCharBase( PyObject* self, PyObject* args ) ! { char *baseid; ! if ( !PyArg_ParseTuple( args, "s:wolfpack.charbase(baseid)", &baseid ) ) ! { return 0; } ! cCharBaseDef *basedef = CharBaseDefs::instance()->get( baseid ); ! if ( !basedef ) ! { ! return PyErr_Format( PyExc_RuntimeError, "An error occured while retrieving the character basedefinition %s.", baseid ); } PyObject *dict = PyDict_New(); ! PyDict_SetItemString( dict, "basesound", PyInt_FromLong( basedef->basesound() ) ); ! PyDict_SetItemString( dict, "soundmode", PyInt_FromLong( basedef->soundmode() ) ); ! PyDict_SetItemString( dict, "flags", PyInt_FromLong( basedef->flags() ) ); ! PyDict_SetItemString( dict, "figurine", PyInt_FromLong( basedef->figurine() ) ); ! PyDict_SetItemString( dict, "mindamage", PyInt_FromLong( basedef->minDamage() ) ); ! PyDict_SetItemString( dict, "maxdamage", PyInt_FromLong( basedef->maxDamage() ) ); ! PyDict_SetItemString( dict, "mintaming", PyInt_FromLong( basedef->minTaming() ) ); ! PyDict_SetItemString( dict, "carve", QString2Python( basedef->carve() ) ); ! PyDict_SetItemString( dict, "lootpacks", QString2Python( basedef->lootPacks() ) ); ! PyDict_SetItemString( dict, "bindmenu", QString2Python( basedef->bindmenu() ) ); ! PyDict_SetItemString( dict, "controlslots", PyInt_FromLong( basedef->controlSlots() ) ); ! PyDict_SetItemString( dict, "criticalhealth", PyInt_FromLong( basedef->criticalHealth() ) ); return dict; } *************** *** 1752,1809 **** static PyMethodDef wpGlobal[] = { ! { "npccount", wpNpcCount, METH_VARARGS, 0 }, ! { "playercount", wpPlayerCount, METH_VARARGS, 0 }, ! { "charbase", wpCharBase, METH_VARARGS, 0 }, ! { "getoption", wpGetOption, METH_VARARGS, "Reads a string value from the database." }, ! { "setoption", wpSetOption, METH_VARARGS, "Sets a string value and a key to the database." }, ! { "callevent", wpCallEvent, METH_VARARGS, "Call an event in a script and return the result." }, ! { "hasevent", wpHasEvent, METH_VARARGS, "If the given script has the given event. Return true." }, ! { "callnamedevent", wpCallNamedEvent, METH_VARARGS, "Call an event in a script and return the result." }, ! { "hasnamedevent", wpHasNamedEvent, METH_VARARGS, "If the given script has the given event. Return true." }, ! { "getdefinition", wpGetDefinition, METH_VARARGS, "Gets a certain definition by it's id." }, ! { "getdefinitions", wpGetDefinitions, METH_VARARGS, "Gets all definitions by type." }, ! { "packet", wpPacket, METH_VARARGS, NULL }, ! { "charregion", wpCharRegion, METH_VARARGS, NULL }, ! { "itemregion", wpItemRegion, METH_VARARGS, NULL }, ! { "additem", wpAdditem, METH_VARARGS, "Adds an item with the specified script-section" }, ! { "newnpc", wpNewNpc, METH_VARARGS, "Creates an entirely new npc." }, ! { "newitem", wpNewItem, METH_VARARGS, "Creates an entirely new item." }, ! { "newplayer", wpNewPlayer, METH_VARARGS, "Creates an entirely new player." }, ! { "addnpc", wpAddnpc, METH_VARARGS, "Adds a npc with the specified script-section" }, ! { "finditem", wpFinditem, METH_VARARGS, "Tries to find an item based on it's serial" }, ! { "guilds", wpGuilds, METH_VARARGS, 0}, ! { "findguild", wpFindguild, METH_VARARGS, 0}, ! { "findchar", wpFindchar, METH_VARARGS, "Tries to find a char based on it's serial" }, ! { "findmulti", wpFindmulti, METH_VARARGS, "Tries to find a multi based on it's position" }, ! { "addtimer", wpAddtimer, METH_VARARGS, "Adds a timed effect" }, ! { "effect", wpEffect, METH_VARARGS, "Shows a graphical effect." }, ! { "region", wpRegion, METH_VARARGS, "Gets the region at a specific position" }, ! { "currenttime", wpCurrenttime, METH_NOARGS, "Time in ms since server-start" }, ! { "newguild", wpNewguild, METH_VARARGS, 0}, ! { "statics", wpStatics, METH_VARARGS, "Returns a list of static-item at a given position" }, ! { "map", wpMap, METH_VARARGS, "Returns a dictionary with information about a given map tile" }, ! { "hasmap", wpHasMap, METH_VARARGS, "Returns true if the map specified is present" }, ! { "items", wpItems, METH_VARARGS, "Returns a list of items in a specific sector." }, ! { "itemiterator", wpAllItemsIterator, METH_NOARGS, "Returns an iterator for all items in the world." }, ! { "chariterator", wpAllCharsIterator, METH_NOARGS, "Returns an iterator for all chars in the world." }, ! { "chars", wpChars, METH_VARARGS, "Returns a list of chars in a specific sector." }, ! { "landdata", wpLanddata, METH_VARARGS, "Returns the landdata information for a given tile stored on the server." }, ! { "tiledata", wpTiledata, METH_VARARGS, "Returns the tiledata information for a given tile stored on the server." }, ! { "coord", wpCoord, METH_VARARGS, "Creates a coordinate object from the given parameters (x,y,z,map)." }, ! { "addmulti", wpAddMulti, METH_VARARGS, "Creates a multi object by given type CUSTOMHOUSE, HOUSE, BOAT." }, ! { "list", wpList, METH_VARARGS, "Returns a list defined in the definitions as a Python List" }, ! { "registerglobal", wpRegisterGlobal, METH_VARARGS, "Registers a global script hook." }, ! { "registerpackethook", wpRegisterPacketHook, METH_VARARGS, "Registers a packet hook." }, ! { "registercommand", wpRegisterCommand, METH_VARARGS, "Registers a global command hook." }, ! { "serverversion", wpServerVersion, METH_NOARGS, "Returns the server version string." }, ! { "isstarting", wpIsStarting, METH_NOARGS, "Returns if the server is in starting state" }, ! { "isrunning", wpIsRunning, METH_NOARGS, "Returns if the server is in running state" }, ! { "isreloading", wpIsReloading, METH_NOARGS, "Returns if the server is in reload state" }, ! { "isclosing", wpIsClosing, METH_NOARGS, "Returns if the server is in closing state" }, ! { "tickcount", wpTickcount, METH_NOARGS, "Returns the current Tickcount on Windows" }, ! { "queueaction", wpQueueAction, METH_VARARGS, NULL }, ! { "charcount", wpCharCount, METH_NOARGS, "Returns the number of chars in the world" }, ! { "itemcount", wpItemCount, METH_NOARGS, "Returns the number of items in the world" }, ! { NULL, NULL, 0, NULL } // Terminator }; --- 1759,1816 ---- static PyMethodDef wpGlobal[] = { ! { "npccount", wpNpcCount, METH_VARARGS, 0 }, ! { "playercount", wpPlayerCount, METH_VARARGS, 0 }, ! { "charbase", wpCharBase, METH_VARARGS, 0 }, ! { "getoption", wpGetOption, METH_VARARGS, "Reads a string value from the database." }, ! { "setoption", wpSetOption, METH_VARARGS, "Sets a string value and a key to the database." }, ! { "callevent", wpCallEvent, METH_VARARGS, "Call an event in a script and return the result." }, ! { "hasevent", wpHasEvent, METH_VARARGS, "If the given script has the given event. Return true." }, ! { "callnamedevent", wpCallNamedEvent, METH_VARARGS, "Call an event in a script and return the result." }, ! { "hasnamedevent", wpHasNamedEvent, METH_VARARGS, "If the given script has the given event. Return true." }, ! { "getdefinition", wpGetDefinition, METH_VARARGS, "Gets a certain definition by it's id." }, ! { "getdefinitions", wpGetDefinitions, METH_VARARGS, "Gets all definitions by type." }, ! { "packet", wpPacket, METH_VARARGS, NULL }, ! { "charregion", wpCharRegion, METH_VARARGS, NULL }, ! { "itemregion", wpItemRegion, METH_VARARGS, NULL }, ! { "additem", wpAdditem, METH_VARARGS, "Adds an item with the specified script-section" }, ! { "newnpc", wpNewNpc, METH_VARARGS, "Creates an entirely new npc." }, ! { "newitem", wpNewItem, METH_VARARGS, "Creates an entirely new item." }, ! { "newplayer", wpNewPlayer, METH_VARARGS, "Creates an entirely new player." }, ! { "addnpc", wpAddnpc, METH_VARARGS, "Adds a npc with the specified script-section" }, ! { "finditem", wpFinditem, METH_VARARGS, "Tries to find an item based on it's serial" }, ! { "guilds", wpGuilds, METH_VARARGS, 0}, ! { "findguild", wpFindguild, METH_VARARGS, 0}, ! { "findchar", wpFindchar, METH_VARARGS, "Tries to find a char based on it's serial" }, ! { "findmulti", wpFindmulti, METH_VARARGS, "Tries to find a multi based on it's position" }, ! { "addtimer", wpAddtimer, METH_VARARGS, "Adds a timed effect" }, ! { "effect", wpEffect, METH_VARARGS, "Shows a graphical effect." }, ! { "region", wpRegion, METH_VARARGS, "Gets the region at a specific position" }, ! { "currenttime", wpCurrenttime, METH_NOARGS, "Time in ms since server-start" }, ! { "newguild", wpNewguild, METH_VARARGS, 0}, ! { "statics", wpStatics, METH_VARARGS, "Returns a list of static-item at a given position" }, ! { "map", wpMap, METH_VARARGS, "Returns a dictionary with information about a given map tile" }, ! { "hasmap", wpHasMap, METH_VARARGS, "Returns true if the map specified is present" }, ! { "items", wpItems, METH_VARARGS, "Returns a list of items in a specific sector." }, ! { "itemiterator", wpAllItemsIterator, METH_NOARGS, "Returns an iterator for all items in the world." }, ! { "chariterator", wpAllCharsIterator, METH_NOARGS, "Returns an iterator for all chars in the world." }, ! { "chars", wpChars, METH_VARARGS, "Returns a list of chars in a specific sector." }, ! { "landdata", wpLanddata, METH_VARARGS, "Returns the landdata information for a given tile stored on the server." }, ! { "tiledata", wpTiledata, METH_VARARGS, "Returns the tiledata information for a given tile stored on the server." }, ! { "coord", wpCoord, METH_VARARGS, "Creates a coordinate object from the given parameters (x,y,z,map)." }, ! { "addmulti", wpAddMulti, METH_VARARGS, "Creates a multi object by given type CUSTOMHOUSE, HOUSE, BOAT." }, ! { "list", wpList, METH_VARARGS, "Returns a list defined in the definitions as a Python List" }, ! { "registerglobal", wpRegisterGlobal, METH_VARARGS, "Registers a global script hook." }, ! { "registerpackethook", wpRegisterPacketHook, METH_VARARGS, "Registers a packet hook." }, ! { "registercommand", wpRegisterCommand, METH_VARARGS, "Registers a global command hook." }, ! { "serverversion", wpServerVersion, METH_NOARGS, "Returns the server version string." }, ! { "isstarting", wpIsStarting, METH_NOARGS, "Returns if the server is in starting state" }, ! { "isrunning", wpIsRunning, METH_NOARGS, "Returns if the server is in running state" }, ! { "isreloading", wpIsReloading, METH_NOARGS, "Returns if the server is in reload state" }, ! { "isclosing", wpIsClosing, METH_NOARGS, "Returns if the server is in closing state" }, ! { "tickcount", wpTickcount, METH_NOARGS, "Returns the current Tickcount on Windows" }, ! { "queueaction", wpQueueAction, METH_VARARGS, NULL }, ! { "charcount", wpCharCount, METH_NOARGS, "Returns the number of chars in the world" }, ! { "itemcount", wpItemCount, METH_NOARGS, "Returns the number of items in the world" }, ! { NULL, NULL, 0, NULL } // Terminator }; *************** *** 1853,1860 **** static PyMethodDef wpSockets[] = { ! { "first", wpSocketsFirst, METH_NOARGS, "Returns the first connected socket." }, ! { "next", wpSocketsNext, METH_NOARGS, "Returns the next connected socket." }, ! { "count", wpSocketsCount, METH_NOARGS, "Returns the number of connected sockets." }, ! { NULL, NULL, 0, NULL } // Terminator }; --- 1860,1867 ---- static PyMethodDef wpSockets[] = { ! { "first", wpSocketsFirst, METH_NOARGS, "Returns the first connected socket." }, ! { "next", wpSocketsNext, METH_NOARGS, "Returns the next connected socket." }, ! { "count", wpSocketsCount, METH_NOARGS, "Returns the number of connected sockets." }, ! { NULL, NULL, 0, NULL } // Terminator }; *************** *** 1865,1870 **** \description This function returns the number of accounts on the server. */ ! static PyObject *wpAccountsCount( PyObject *self, PyObject *args ) { ! return PyInt_FromLong(Accounts::instance()->count()); } --- 1872,1878 ---- \description This function returns the number of accounts on the server. */ ! static PyObject* wpAccountsCount( PyObject* self, PyObject* args ) ! { ! return PyInt_FromLong( Accounts::instance()->count() ); } *************** *** 2000,2015 **** QString password = getArgStr( 1 ); ! if (login.length() < 1 && password.length() < 1) { Py_RETURN_NONE; } ! cAccount* account = Accounts::instance()->getRecord(login); ! if (account) { Py_RETURN_NONE; } ! account = Accounts::instance()->createAccount(login, password); ! return PyGetAccountObject(account); } --- 2008,2025 ---- QString password = getArgStr( 1 ); ! if ( login.length() < 1 && password.length() < 1 ) ! { Py_RETURN_NONE; } ! cAccount* account = Accounts::instance()->getRecord( login ); ! if ( account ) ! { Py_RETURN_NONE; } ! account = Accounts::instance()->createAccount( login, password ); ! return PyGetAccountObject( account ); } *************** *** 2046,2058 **** static PyMethodDef wpAccounts[] = { ! { "count", wpAccountsCount, METH_VARARGS, "" }, ! { "find", wpAccountsFind, METH_VARARGS, "Finds an account object." }, ! { "list", wpAccountsList, METH_NOARGS, "Gets a list of Account names." }, ! { "acls", wpAccountsAcls, METH_NOARGS, "Gets a list of valid ACL names." }, ! { "acl", wpAccountsAcl, METH_VARARGS, "Returns an acl as a double dictionary." }, ! { "add", wpAccountsAdd, METH_VARARGS, "Creates an account." }, ! { "save", wpAccountsSave, METH_NOARGS, "Save accounts." }, ! { "reload", wpAccountsReload, METH_NOARGS, "Reload accounts." }, ! { NULL, NULL, 0, NULL } // Terminator }; --- 2056,2068 ---- static PyMethodDef wpAccounts[] = { ! { "count", wpAccountsCount, METH_VARARGS, "" }, ! { "find", wpAccountsFind, METH_VARARGS, "Finds an account object." }, ! { "list", wpAccountsList, METH_NOARGS, "Gets a list of Account names." }, ! { "acls", wpAccountsAcls, METH_NOARGS, "Gets a list of valid ACL names." }, ! { "acl", wpAccountsAcl, METH_VARARGS, "Returns an acl as a double dictionary." }, ! { "add", wpAccountsAdd, METH_VARARGS, "Creates an account." }, ! { "save", wpAccountsSave, METH_NOARGS, "Save accounts." }, ! { "reload", wpAccountsReload, METH_NOARGS, "Reload accounts." }, ! { NULL, NULL, 0, NULL } // Terminator }; *************** *** 2071,2076 **** { Q_UNUSED( self ); ! char* pyGroup, ! * pyKey, pyDef, create = 0; --- 2081,2085 ---- { Q_UNUSED( self ); ! char* pyGroup,* pyKey, pyDef, create = 0; *************** *** 2091,2096 **** { Q_UNUSED( self ); ! char* pyGroup, ! * pyKey, pyValue; if ( !PyArg_ParseTuple( args, "ssb:setBool(group, key, value)", &pyGroup, &pyKey, &pyValue ) ) --- 2100,2104 ---- { Q_UNUSED( self ); ! char* pyGroup,* pyKey, pyValue; if ( !PyArg_ParseTuple( args, "ssb:setBool(group, key, value)", &pyGroup, &pyKey, &pyValue ) ) *************** *** 2114,2119 **** { Q_UNUSED( self ); ! char* pyGroup, ! * pyKey, create = 0; int pyDef; --- 2122,2126 ---- { Q_UNUSED( self ); ! char* pyGroup,* pyKey, create = 0; int pyDef; *************** *** 2134,2139 **** { Q_UNUSED( self ); ! char* pyGroup, ! * pyKey; int pyValue; if ( !PyArg_ParseTuple( args, "ssi:setNumber(group, key, value)", &pyGroup, &pyKey, &pyValue ) ) --- 2141,2145 ---- { Q_UNUSED( self ); ! char* pyGroup,* pyKey; int pyValue; if ( !PyArg_ParseTuple( args, "ssi:setNumber(group, key, value)", &pyGroup, &pyKey, &pyValue ) ) *************** *** 2157,2163 **** { Q_UNUSED( self ); ! char* pyGroup, ! * pyKey, ! * pyDef, create = 0; if ( !PyArg_ParseTuple( args, "sss|b:getString(group, key, default, create)", &pyGroup, &pyKey, &pyDef, &create ) ) --- 2163,2167 ---- { Q_UNUSED( self ); ! char* pyGroup,* pyKey,* pyDef, create = 0; if ( !PyArg_ParseTuple( args, "sss|b:getString(group, key, default, create)", &pyGroup, &pyKey, &pyDef, &create ) ) *************** *** 2177,2183 **** { Q_UNUSED( self ); ! char* pyGroup, ! * pyKey, ! * pyValue; if ( !PyArg_ParseTuple( args, "sss:setString(group, key, value)", &pyGroup, &pyKey, &pyValue ) ) return 0; --- 2181,2185 ---- { Q_UNUSED( self ); ! char* pyGroup,* pyKey,* pyValue; if ( !PyArg_ParseTuple( args... [truncated message content] |
From: Correa <thi...@us...> - 2004-08-10 03:24:39
|
Update of /cvsroot/wpdev/wolfpack/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19142 Modified Files: asyncnetio.cpp asyncnetio.h encryption.cpp encryption.h uopacket.cpp uorxpackets.h uosocket.cpp uosocket.h uotxpackets.cpp uotxpackets.h Log Message: applied coding standard rules. Index: encryption.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/encryption.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** encryption.h 19 Jun 2004 02:06:51 -0000 1.3 --- encryption.h 10 Aug 2004 03:24:29 -0000 1.4 *************** *** 71,75 **** { public: ! virtual ~cClientEncryption() {} virtual void serverEncrypt( char* buffer, unsigned int length ) = 0; virtual void clientDecrypt( char* buffer, unsigned int length ) = 0; --- 71,77 ---- { public: ! virtual ~cClientEncryption() ! { ! } virtual void serverEncrypt( char* buffer, unsigned int length ) = 0; virtual void clientDecrypt( char* buffer, unsigned int length ) = 0; Index: uorxpackets.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uorxpackets.h,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** uorxpackets.h 2 Jul 2004 06:01:21 -0000 1.64 --- uorxpackets.h 10 Aug 2004 03:24:29 -0000 1.65 *************** *** 1229,1247 **** // 0x98 AllNames ! class cUORxAllNames : public cUOPacket { public: ! cUORxAllNames(const QByteArray &data) : cUOPacket( data ) { } ! unsigned int serial() { ! return getInt(3); } ! const QString name() { ! return getAsciiString(7); } }; --- 1229,1247 ---- // 0x98 AllNames ! class cUORxAllNames : public cUOPacket { public: ! cUORxAllNames( const QByteArray& data ) : cUOPacket( data ) { } ! unsigned int serial() { ! return getInt( 3 ); } ! const QString name() { ! return getAsciiString( 7 ); } }; Index: uotxpackets.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uotxpackets.h,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** uotxpackets.h 27 Jul 2004 06:35:23 -0000 1.111 --- uotxpackets.h 10 Aug 2004 03:24:29 -0000 1.112 *************** *** 2365,2369 **** setShort( 10, 0 ); setInt( 12, 0xFF ); ! ( *this )[16] = static_cast<uchar>(0xFF); } void setSerial( unsigned int data ) --- 2365,2369 ---- setShort( 10, 0 ); setInt( 12, 0xFF ); ! ( *this )[16] = static_cast<uchar>( 0xFF ); } void setSerial( unsigned int data ) *************** *** 2466,2481 **** // 0x98 AllNames ! class cUOTxAllNames : public cUOPacket { public: ! cUOTxAllNames() : cUOPacket(0x98, 37) { ! setShort(1, 37); } ! void setSerial(unsigned int data) { ! setInt(3, data); } ! void setName(const QString &name) { ! setAsciiString(7, name.latin1(), 29); } }; --- 2466,2485 ---- // 0x98 AllNames ! class cUOTxAllNames : public cUOPacket ! { public: ! cUOTxAllNames() : cUOPacket( 0x98, 37 ) ! { ! setShort( 1, 37 ); } ! void setSerial( unsigned int data ) ! { ! setInt( 3, data ); } ! void setName( const QString& name ) ! { ! setAsciiString( 7, name.latin1(), 29 ); } }; Index: uopacket.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uopacket.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** uopacket.cpp 27 Jul 2004 06:35:22 -0000 1.44 --- uopacket.cpp 10 Aug 2004 03:24:29 -0000 1.45 *************** *** 180,184 **** static bitTable[257] = { ! {0x02, 0x00}, {0x05, 0x1F}, {0x06, 0x22}, {0x07, 0x34}, {0x07, 0x75}, {0x06, 0x28}, {0x06, 0x3B}, {0x07, 0x32}, {0x08, 0xE0}, {0x08, 0x62}, {0x07, 0x56}, {0x08, 0x79}, {0x09, 0x19D}, {0x08, 0x97}, {0x06, 0x2A}, {0x07, 0x57}, {0x08, 0x71}, {0x08, 0x5B}, {0x09, 0x1CC}, {0x08, 0xA7}, {0x07, 0x25}, {0x07, 0x4F}, {0x08, 0x66}, {0x08, 0x7D}, {0x09, 0x191}, {0x09, 0x1CE}, {0x07, 0x3F}, {0x09, 0x90}, {0x08, 0x59}, {0x08, 0x7B}, {0x08, 0x91}, {0x08, 0xC6}, {0x06, 0x2D}, {0x09, 0x186}, {0x08, 0x6F}, {0x09, 0x93}, {0x0A, 0x1CC}, {0x08, 0x5A}, {0x0A, 0x1AE}, {0x0A, 0x1C0}, {0x09, 0x148}, {0x09, 0x14A}, {0x09, 0x82}, {0x0A, 0x19F}, {0x09, 0x171}, {0x09, 0x120}, {0x09, 0xE7}, {0x0A, 0x1F3}, {0x09, 0x14B}, {0x09, 0x100}, {0x09, 0x190}, {0x06, 0x13}, {0x09, 0x161}, {0x09, 0x125}, {0x09, 0x133}, {0x09, 0x195}, {0x09, 0x173}, {0x09, 0x1CA}, {0x09, 0x86}, {0x09, 0x1E9}, {0x09, 0xDB}, {0x09, 0x1EC}, {0x09, 0x8B}, {0x09, 0x85}, {0x05, 0x0A}, {0x08, 0x96}, {0x08, 0x9C}, {0x09, 0x1C3}, {0x09, 0x19C}, {0x09, 0x8F}, {0x09, 0x18F}, {0x09, 0x91}, {0x09, 0x87}, {0x09, 0xC6}, {0x09, 0x177}, {0x09, 0x89}, {0x09, 0xD6}, {0x09, 0x8C}, {0x09, 0x1EE}, {0x09, 0x1EB}, {0x09, 0x84}, {0x09, 0x164}, {0x09, 0x175}, {0x09, 0x1CD}, {0x08, 0x5E}, {0x09, 0x88}, {0x09, 0x12B}, {0x09, 0x172}, {0x09, 0x10A}, {0x09, 0x8D}, {0x09, 0x13A}, {0x09, 0x11C}, {0x0A, 0x1E1}, {0x0A, 0x1E0}, {0x09, 0x187}, {0x0A, 0x1DC}, {0x0A, 0x1DF}, {0x07, 0x74}, {0x09, 0x19F}, {0x08, 0x8D}, {0x08, 0xE4}, {0x07, 0x79}, {0x09, 0xEA}, {0x09, 0xE1}, {0x08, 0x40}, {0x07, 0x41}, {0x09, 0x10B}, {0x09, 0xB0}, {0x08, 0x6A}, {0x08, 0xC1}, {0x07, 0x71}, {0x07, 0x78}, {0x08, 0xB1}, {0x09, 0x14C}, {0x07, 0x43}, {0x08, 0x76}, {0x07, 0x66}, {0x07, 0x4D}, {0x09, 0x8A}, {0x06, 0x2F}, {0x08, 0xC9}, {0x09, 0xCE}, {0x09, 0x149}, {0x09, 0x160}, {0x0A, 0x1BA}, {0x0A, 0x19E}, {0x0A, 0x39F}, {0x09, 0xE5}, {0x09, 0x194}, {0x09, 0x184}, {0x09, 0x126}, {0x07, 0x30}, {0x08, 0x6C}, {0x09, 0x121}, {0x09, 0x1E8}, {0x0A, 0x1C1}, {0x0A, 0x11D}, {0x0A, 0x163}, {0x0A, 0x385}, {0x0A, 0x3DB}, {0x0A, 0x17D}, {0x0A, 0x106}, {0x0A, 0x397}, {0x0A, 0x24E}, {0x07, 0x2E}, {0x08, 0x98}, {0x0A, 0x33C}, {0x0A, 0x32E}, {0x0A, 0x1E9}, {0x09, 0xBF}, {0x0A, 0x3DF}, {0x0A, 0x1DD}, {0x0A, 0x32D}, {0x0A, 0x2ED}, {0x0A, 0x30B}, {0x0A, 0x107}, {0x0A, 0x2E8}, {0x0A, 0x3DE}, {0x0A, 0x125}, {0x0A, 0x1E8}, {0x09, 0xE9}, {0x0A, 0x1CD}, {0x0A, 0x1B5}, {0x09, 0x165}, {0x0A, 0x232}, {0x0A, 0x2E1}, {0x0B, 0x3AE}, {0x0B, 0x3C6}, {0x0B, 0x3E2}, {0x0A, 0x205}, {0x0A, 0x29A}, {0x0A, 0x248}, {0x0A, 0x2CD}, {0x0A, 0x23B}, {0x0B, 0x3C5}, {0x0A, 0x251}, {0x0A, 0x2E9}, {0x0A, 0x252}, {0x09, 0x1EA}, {0x0B, 0x3A0}, {0x0B, 0x391}, {0x0A, 0x23C}, {0x0B, 0x392}, {0x0B, 0x3D5}, {0x0A, 0x233}, {0x0A, 0x2CC}, {0x0B, 0x390}, {0x0A, 0x1BB}, {0x0B, 0x3A1}, {0x0B, 0x3C4}, {0x0A, 0x211}, {0x0A, 0x203}, {0x09, 0x12A}, {0x0A, 0x231}, {0x0B, 0x3E0}, {0x0A, 0x29B}, {0x0B, 0x3D7}, {0x0A, 0x202}, {0x0B, 0x3AD}, {0x0A, 0x213}, {0x0A, 0x253}, {0x0A, 0x32C}, {0x0A, 0x23D}, {0x0A, 0x23F}, {0x0A, 0x32F}, {0x0A, 0x11C}, {0x0A, 0x384}, {0x0A, 0x31C}, {0x0A, 0x17C}, {0x0A, 0x30A}, {0x0A, 0x2E0}, {0x0A, 0x276}, {0x0A, 0x250}, {0x0B, 0x3E3}, {0x0A, 0x396}, {0x0A, 0x18F}, {0x0A, 0x204}, {0x0A, 0x206}, {0x0A, 0x230}, {0x0A, 0x265}, {0x0A, 0x212}, {0x0A, 0x23E}, {0x0B, 0x3AC}, {0x0B, 0x393}, {0x0B, 0x3E1}, {0x0A, 0x1DE}, {0x0B, 0x3D6}, {0x0A, 0x31D}, {0x0B, 0x3E5}, {0x0B, 0x3E4}, {0x0A, 0x207}, {0x0B, 0x3C7}, {0x0A, 0x277}, {0x0B, 0x3D4}, {0x08, 0xC0}, {0x0A, 0x162}, {0x0A, 0x3DA}, {0x0A, 0x124}, {0x0A, 0x1B4}, {0x0A, 0x264}, {0x0A, 0x33D}, {0x0A, 0x1D1}, {0x0A, 0x1AF}, {0x0A, 0x39E}, {0x0A, 0x24F}, {0x0B, 0x373}, {0x0A, 0x249}, {0x0B, 0x372}, {0x09, 0x167}, {0x0A, 0x210}, {0x0A, 0x23A}, {0x0A, 0x1B8}, {0x0B, 0x3AF}, {0x0A, 0x18E}, {0x0A, 0x2EC}, {0x07, 0x62}, {0x04, 0x0D} }; --- 180,184 ---- static bitTable[257] = { ! {0x02, 0x00}, {0x05, 0x1F}, {0x06, 0x22}, {0x07, 0x34}, {0x07, 0x75}, {0x06, 0x28}, {0x06, 0x3B}, {0x07, 0x32}, {0x08, 0xE0}, {0x08, 0x62}, {0x07, 0x56}, {0x08, 0x79}, {0x09, 0x19D}, {0x08, 0x97}, {0x06, 0x2A}, {0x07, 0x57}, {0x08, 0x71}, {0x08, 0x5B}, {0x09, 0x1CC}, {0x08, 0xA7}, {0x07, 0x25}, {0x07, 0x4F}, {0x08, 0x66}, {0x08, 0x7D}, {0x09, 0x191}, {0x09, 0x1CE}, {0x07, 0x3F}, {0x09, 0x90}, {0x08, 0x59}, {0x08, 0x7B}, {0x08, 0x91}, {0x08, 0xC6}, {0x06, 0x2D}, {0x09, 0x186}, {0x08, 0x6F}, {0x09, 0x93}, {0x0A, 0x1CC}, {0x08, 0x5A}, {0x0A, 0x1AE}, {0x0A, 0x1C0}, {0x09, 0x148}, {0x09, 0x14A}, {0x09, 0x82}, {0x0A, 0x19F}, {0x09, 0x171}, {0x09, 0x120}, {0x09, 0xE7}, {0x0A, 0x1F3}, {0x09, 0x14B}, {0x09, 0x100}, {0x09, 0x190}, {0x06, 0x13}, {0x09, 0x161}, {0x09, 0x125}, {0x09, 0x133}, {0x09, 0x195}, {0x09, 0x173}, {0x09, 0x1CA}, {0x09, 0x86}, {0x09, 0x1E9}, {0x09, 0xDB}, {0x09, 0x1EC}, {0x09, 0x8B}, {0x09, 0x85}, {0x05, 0x0A}, {0x08, 0x96}, {0x08, 0x9C}, {0x09, 0x1C3}, {0x09, 0x19C}, {0x09, 0x8F}, {0x09, 0x18F}, {0x09, 0x91}, {0x09, 0x87}, {0x09, 0xC6}, {0x09, 0x177}, {0x09, 0x89}, {0x09, 0xD6}, {0x09, 0x8C}, {0x09, 0x1EE}, {0x09, 0x1EB}, {0x09, 0x84}, {0x09, 0x164}, {0x09, 0x175}, {0x09, 0x1CD}, {0x08, 0x5E}, {0x09, 0x88}, {0x09, 0x12B}, {0x09, 0x172}, {0x09, 0x10A}, {0x09, 0x8D}, {0x09, 0x13A}, {0x09, 0x11C}, {0x0A, 0x1E1}, {0x0A, 0x1E0}, {0x09, 0x187}, {0x0A, 0x1DC}, {0x0A, 0x1DF}, {0x07, 0x74}, {0x09, 0x19F}, {0x08, 0x8D}, {0x08, 0xE4}, {0x07, 0x79}, {0x09, 0xEA}, {0x09, 0xE1}, {0x08, 0x40}, {0x07, 0x41}, {0x09, 0x10B}, {0x09, 0xB0}, {0x08, 0x6A}, {0x08, 0xC1}, {0x07, 0x71}, {0x07, 0x78}, {0x08, 0xB1}, {0x09, 0x14C}, {0x07, 0x43}, {0x08, 0x76}, {0x07, 0x66}, {0x07, 0x4D}, {0x09, 0x8A}, {0x06, 0x2F}, {0x08, 0xC9}, {0x09, 0xCE}, {0x09, 0x149}, {0x09, 0x160}, {0x0A, 0x1BA}, {0x0A, 0x19E}, {0x0A, 0x39F}, {0x09, 0xE5}, {0x09, 0x194}, {0x09, 0x184}, {0x09, 0x126}, {0x07, 0x30}, {0x08, 0x6C}, {0x09, 0x121}, {0x09, 0x1E8}, {0x0A, 0x1C1}, {0x0A, 0x11D}, {0x0A, 0x163}, {0x0A, 0x385}, {0x0A, 0x3DB}, {0x0A, 0x17D}, {0x0A, 0x106}, {0x0A, 0x397}, {0x0A, 0x24E}, {0x07, 0x2E}, {0x08, 0x98}, {0x0A, 0x33C}, {0x0A, 0x32E}, {0x0A, 0x1E9}, {0x09, 0xBF}, {0x0A, 0x3DF}, {0x0A, 0x1DD}, {0x0A, 0x32D}, {0x0A, 0x2ED}, {0x0A, 0x30B}, {0x0A, 0x107}, {0x0A, 0x2E8}, {0x0A, 0x3DE}, {0x0A, 0x125}, {0x0A, 0x1E8}, {0x09, 0xE9}, {0x0A, 0x1CD}, {0x0A, 0x1B5}, {0x09, 0x165}, {0x0A, 0x232}, {0x0A, 0x2E1}, {0x0B, 0x3AE}, {0x0B, 0x3C6}, {0x0B, 0x3E2}, {0x0A, 0x205}, {0x0A, 0x29A}, {0x0A, 0x248}, {0x0A, 0x2CD}, {0x0A, 0x23B}, {0x0B, 0x3C5}, {0x0A, 0x251}, {0x0A, 0x2E9}, {0x0A, 0x252}, {0x09, 0x1EA}, {0x0B, 0x3A0}, {0x0B, 0x391}, {0x0A, 0x23C}, {0x0B, 0x392}, {0x0B, 0x3D5}, {0x0A, 0x233}, {0x0A, 0x2CC}, {0x0B, 0x390}, {0x0A, 0x1BB}, {0x0B, 0x3A1}, {0x0B, 0x3C4}, {0x0A, 0x211}, {0x0A, 0x203}, {0x09, 0x12A}, {0x0A, 0x231}, {0x0B, 0x3E0}, {0x0A, 0x29B}, {0x0B, 0x3D7}, {0x0A, 0x202}, {0x0B, 0x3AD}, {0x0A, 0x213}, {0x0A, 0x253}, {0x0A, 0x32C}, {0x0A, 0x23D}, {0x0A, 0x23F}, {0x0A, 0x32F}, {0x0A, 0x11C}, {0x0A, 0x384}, {0x0A, 0x31C}, {0x0A, 0x17C}, {0x0A, 0x30A}, {0x0A, 0x2E0}, {0x0A, 0x276}, {0x0A, 0x250}, {0x0B, 0x3E3}, {0x0A, 0x396}, {0x0A, 0x18F}, {0x0A, 0x204}, {0x0A, 0x206}, {0x0A, 0x230}, {0x0A, 0x265}, {0x0A, 0x212}, {0x0A, 0x23E}, {0x0B, 0x3AC}, {0x0B, 0x393}, {0x0B, 0x3E1}, {0x0A, 0x1DE}, {0x0B, 0x3D6}, {0x0A, 0x31D}, {0x0B, 0x3E5}, {0x0B, 0x3E4}, {0x0A, 0x207}, {0x0B, 0x3C7}, {0x0A, 0x277}, {0x0B, 0x3D4}, {0x08, 0xC0}, {0x0A, 0x162}, {0x0A, 0x3DA}, {0x0A, 0x124}, {0x0A, 0x1B4}, {0x0A, 0x264}, {0x0A, 0x33D}, {0x0A, 0x1D1}, {0x0A, 0x1AF}, {0x0A, 0x39E}, {0x0A, 0x24F}, {0x0B, 0x373}, {0x0A, 0x249}, {0x0B, 0x372}, {0x09, 0x167}, {0x0A, 0x210}, {0x0A, 0x23A}, {0x0A, 0x1B8}, {0x0B, 0x3AF}, {0x0A, 0x18E}, {0x0A, 0x2EC}, {0x07, 0x62}, {0x04, 0x0D} }; Index: asyncnetio.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/asyncnetio.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** asyncnetio.cpp 4 Aug 2004 23:17:38 -0000 1.48 --- asyncnetio.cpp 10 Aug 2004 03:24:29 -0000 1.49 *************** *** 55,90 **** const Q_UINT16 packetLengths[256] = { ! 0x0068, 0x0005, 0x0007, 0x0000, 0x0002, 0x0005, 0x0005, 0x0007, // 0x00 ! 0x000e, 0x0005, 0x000b, 0x010a, 0x0000, 0x0003, 0x0000, 0x003d, // 0x08 ! 0x00d7, 0x0000, 0x0000, 0x000a, 0x0006, 0x0009, 0x0001, 0x0000, // 0x10 ! 0x0000, 0x0000, 0x0000, 0x0025, 0x0000, 0x0005, 0x0004, 0x0008, // 0x18 ! 0x0013, 0x0008, 0x0003, 0x001a, 0x0007, 0x0014, 0x0005, 0x0002, // 0x20 ! 0x0005, 0x0001, 0x0005, 0x0002, 0x0002, 0x0011, 0x000f, 0x000a, // 0x28 ! 0x0005, 0x0001, 0x0002, 0x0002, 0x000a, 0x028d, 0x0000, 0x0008, // 0x30 ! 0x0007, 0x0009, 0x0000, 0x0000, 0x0000, 0x0002, 0x0025, 0x0000, // 0x38 ! 0x00c9, 0x0000, 0x0000, 0x0229, 0x02c9, 0x0005, 0x0000, 0x000b, // 0x40 ! 0x0049, 0x005d, 0x0005, 0x0009, 0x0000, 0x0000, 0x0006, 0x0002, // 0x48 ! 0x0000, 0x0000, 0x0000, 0x0002, 0x000c, 0x0001, 0x000b, 0x006e, // 0x50 ! 0x006a, 0x0000, 0x0000, 0x0004, 0x0002, 0x0049, 0x0000, 0x0031, // 0x58 ! 0x0005, 0x0009, 0x000f, 0x000d, 0x0001, 0x0004, 0x0000, 0x0015, // 0x60 ! 0x0000, 0x0000, 0x0003, 0x0009, 0x0013, 0x0003, 0x000e, 0x0000, // 0x68 ! 0x001c, 0x0000, 0x0005, 0x0002, 0x0000, 0x0023, 0x0010, 0x0011, // 0x70 ! 0x0000, 0x0009, 0x0000, 0x0002, 0x0000, 0x000d, 0x0002, 0x0000, // 0x78 ! 0x003e, 0x0000, 0x0002, 0x0027, 0x0045, 0x0002, 0x0000, 0x0000, // 0x80 ! 0x0042, 0x0000, 0x0000, 0x0000, 0x000b, 0x0000, 0x0000, 0x0000, // 0x88 ! 0x0013, 0x0041, 0x0000, 0x0063, 0x0000, 0x0009, 0x0000, 0x0002, // 0x90 ! 0x0000, 0x001a, 0x0000, 0x0102, 0x0135, 0x0033, 0x0000, 0x0000, // 0x98 ! 0x0003, 0x0009, 0x0009, 0x0009, 0x0095, 0x0000, 0x0000, 0x0004, // 0xA0 ! 0x0000, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x000d, // 0xA8 ! 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0040, 0x0009, 0x0000, // 0xB0 ! 0x0000, 0x0003, 0x0006, 0x0009, 0x0003, 0x0000, 0x0000, 0x0000, // 0xB8 ! 0x0024, 0x0000, 0x0000, 0x0000, 0x0006, 0x00cb, 0x0001, 0x0031, // 0xC0 ! 0x0002, 0x0006, 0x0006, 0x0007, 0x0000, 0x0001, 0x0000, 0x004e, // 0xC8 ! 0x0000, 0x0002, 0x0019, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 ! 0x0000, 0x010C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xD8 ! 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xE0 ! 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xE8 ! 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xF0 ! 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xF8 }; --- 55,90 ---- const Q_UINT16 packetLengths[256] = { ! 0x0068, 0x0005, 0x0007, 0x0000, 0x0002, 0x0005, 0x0005, 0x0007, // 0x00 ! 0x000e, 0x0005, 0x000b, 0x010a, 0x0000, 0x0003, 0x0000, 0x003d, // 0x08 ! 0x00d7, 0x0000, 0x0000, 0x000a, 0x0006, 0x0009, 0x0001, 0x0000, // 0x10 ! 0x0000, 0x0000, 0x0000, 0x0025, 0x0000, 0x0005, 0x0004, 0x0008, // 0x18 ! 0x0013, 0x0008, 0x0003, 0x001a, 0x0007, 0x0014, 0x0005, 0x0002, // 0x20 ! 0x0005, 0x0001, 0x0005, 0x0002, 0x0002, 0x0011, 0x000f, 0x000a, // 0x28 ! 0x0005, 0x0001, 0x0002, 0x0002, 0x000a, 0x028d, 0x0000, 0x0008, // 0x30 ! 0x0007, 0x0009, 0x0000, 0x0000, 0x0000, 0x0002, 0x0025, 0x0000, // 0x38 ! 0x00c9, 0x0000, 0x0000, 0x0229, 0x02c9, 0x0005, 0x0000, 0x000b, // 0x40 ! 0x0049, 0x005d, 0x0005, 0x0009, 0x0000, 0x0000, 0x0006, 0x0002, // 0x48 ! 0x0000, 0x0000, 0x0000, 0x0002, 0x000c, 0x0001, 0x000b, 0x006e, // 0x50 ! 0x006a, 0x0000, 0x0000, 0x0004, 0x0002, 0x0049, 0x0000, 0x0031, // 0x58 ! 0x0005, 0x0009, 0x000f, 0x000d, 0x0001, 0x0004, 0x0000, 0x0015, // 0x60 ! 0x0000, 0x0000, 0x0003, 0x0009, 0x0013, 0x0003, 0x000e, 0x0000, // 0x68 ! 0x001c, 0x0000, 0x0005, 0x0002, 0x0000, 0x0023, 0x0010, 0x0011, // 0x70 ! 0x0000, 0x0009, 0x0000, 0x0002, 0x0000, 0x000d, 0x0002, 0x0000, // 0x78 ! 0x003e, 0x0000, 0x0002, 0x0027, 0x0045, 0x0002, 0x0000, 0x0000, // 0x80 ! 0x0042, 0x0000, 0x0000, 0x0000, 0x000b, 0x0000, 0x0000, 0x0000, // 0x88 ! 0x0013, 0x0041, 0x0000, 0x0063, 0x0000, 0x0009, 0x0000, 0x0002, // 0x90 ! 0x0000, 0x001a, 0x0000, 0x0102, 0x0135, 0x0033, 0x0000, 0x0000, // 0x98 ! 0x0003, 0x0009, 0x0009, 0x0009, 0x0095, 0x0000, 0x0000, 0x0004, // 0xA0 ! 0x0000, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x000d, // 0xA8 ! 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0040, 0x0009, 0x0000, // 0xB0 ! 0x0000, 0x0003, 0x0006, 0x0009, 0x0003, 0x0000, 0x0000, 0x0000, // 0xB8 ! 0x0024, 0x0000, 0x0000, 0x0000, 0x0006, 0x00cb, 0x0001, 0x0031, // 0xC0 ! 0x0002, 0x0006, 0x0006, 0x0007, 0x0000, 0x0001, 0x0000, 0x004e, // 0xC8 ! 0x0000, 0x0002, 0x0019, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 ! 0x0000, 0x010C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xD8 ! 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xE0 ! 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xE8 ! 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xF0 ! 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0xF8 }; *************** *** 402,406 **** { mapsMutex.lock(); // do not disturb me here. ! for ( const_iterator it(buffers.begin()); it != buffers.end(); ++it ) { // Read all avaliable data. --- 402,406 ---- { mapsMutex.lock(); // do not disturb me here. ! for ( const_iterator it( buffers.begin() ); it != buffers.end(); ++it ) { // Read all avaliable data. *************** *** 752,761 **** Requeues a packet to the front of the queue for a socket. */ ! void cAsyncNetIO::pushfrontPacket( QSocketDevice *socket, cUOPacket *packet ) { ! iterator it = buffers.find(socket); ! if (it != buffers.end()) { ! QMutexLocker lock(&(it.data()->packetsMutex)); ! it.data()->packets.push_front(packet); } } --- 752,763 ---- Requeues a packet to the front of the queue for a socket. */ ! void cAsyncNetIO::pushfrontPacket( QSocketDevice* socket, cUOPacket* packet ) ! { ! iterator it = buffers.find( socket ); ! if ( it != buffers.end() ) ! { ! QMutexLocker lock( &( it.data()->packetsMutex ) ); ! it.data()->packets.push_front( packet ); } } Index: uosocket.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.h,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** uosocket.h 27 Jul 2004 06:35:22 -0000 1.121 --- uosocket.h 10 Aug 2004 03:24:29 -0000 1.122 *************** *** 222,226 **** void handleExtendedStats( cUORxExtendedStats* packet ); void handleAction( cUORxAction* packet ); ! void handleAllNames( cUORxAllNames *packet ); void handleGumpResponse( cUORxGumpResponse* packet ); void handleHelpRequest( cUORxHelpRequest* packet ); --- 222,226 ---- void handleExtendedStats( cUORxExtendedStats* packet ); void handleAction( cUORxAction* packet ); ! void handleAllNames( cUORxAllNames* packet ); void handleGumpResponse( cUORxGumpResponse* packet ); void handleHelpRequest( cUORxHelpRequest* packet ); Index: encryption.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/encryption.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** encryption.cpp 2 Jun 2004 15:04:09 -0000 1.2 --- encryption.cpp 10 Aug 2004 03:24:29 -0000 1.3 *************** *** 181,189 **** static const UINT8 xorData[0x10] = { ! // Seed: 7F000001 ! //0x05, 0x92, 0x66, 0x23, 0x67, 0x14, 0xE3, 0x62, 0xDC, 0x60, 0x8C, 0xD6, 0xFE, 0x7C, 0x25, 0x69 ! // Seed: FFFFFFFF ! 0xa9, 0xd5, 0x7d, 0xa4, 0x3e, 0x0c, 0x22, 0xda, 0xde, 0x15, 0xe9, 0x92, 0xdd, 0x99, 0x98, 0x4d }; --- 181,189 ---- static const UINT8 xorData[0x10] = { ! // Seed: 7F000001 ! //0x05, 0x92, 0x66, 0x23, 0x67, 0x14, 0xE3, 0x62, 0xDC, 0x60, 0x8C, 0xD6, 0xFE, 0x7C, 0x25, 0x69 ! // Seed: FFFFFFFF ! 0xa9, 0xd5, 0x7d, 0xa4, 0x3e, 0x0c, 0x22, 0xda, 0xde, 0x15, 0xe9, 0x92, 0xdd, 0x99, 0x98, 0x4d }; Index: uosocket.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v retrieving revision 1.388 retrieving revision 1.389 diff -C2 -d -r1.388 -r1.389 *** uosocket.cpp 7 Aug 2004 15:32:59 -0000 1.388 --- uosocket.cpp 10 Aug 2004 03:24:29 -0000 1.389 *************** *** 106,110 **** PyObject* cUOSocket::handlers[255] = { ! 0, }; --- 106,110 ---- PyObject* cUOSocket::handlers[255] = { ! 0, }; *************** *** 262,272 **** // This is always checked before anything else ! if (packetId == 0x02 && Config::instance()->antiSpeedHack()) { ! if (_player && !_player->isGM()) { // There are two different delays for mounted and unmounted players unsigned int delay; ! if (!_player->atLayer(cBaseChar::Mount)) { delay = Config::instance()->antiSpeedHackDelay(); ! } else { delay = Config::instance()->antiSpeedHackDelayMounted(); } --- 262,277 ---- // This is always checked before anything else ! if ( packetId == 0x02 && Config::instance()->antiSpeedHack() ) ! { ! if ( _player && !_player->isGM() ) ! { // There are two different delays for mounted and unmounted players unsigned int delay; ! if ( !_player->atLayer( cBaseChar::Mount ) ) ! { delay = Config::instance()->antiSpeedHackDelay(); ! } ! else ! { delay = Config::instance()->antiSpeedHackDelayMounted(); } *************** *** 276,282 **** //unsigned int time = getNormalizedTime(); unsigned int time = Server::instance()->time(); ! if (_player->lastMovement() + delay > time) { //sysMessage(QString("Delayed Walk Request, Last WalkRequest was %1 ms ago.").arg(time - _player->lastMovement())); ! Network::instance()->netIo()->pushfrontPacket(_socket, packet); return; } --- 281,288 ---- //unsigned int time = getNormalizedTime(); unsigned int time = Server::instance()->time(); ! if ( _player->lastMovement() + delay > time ) ! { //sysMessage(QString("Delayed Walk Request, Last WalkRequest was %1 ms ago.").arg(time - _player->lastMovement())); ! Network::instance()->netIo()->pushfrontPacket( _socket, packet ); return; } *************** *** 360,364 **** handleServerAttach( dynamic_cast<cUORxServerAttach*>( packet ) ); break; case 0x98: ! handleAllNames(dynamic_cast<cUORxAllNames*>(packet)); break; case 0x9B: handleHelpRequest( dynamic_cast<cUORxHelpRequest*>( packet ) ); break; --- 366,370 ---- handleServerAttach( dynamic_cast<cUORxServerAttach*>( packet ) ); break; case 0x98: ! handleAllNames( dynamic_cast<cUORxAllNames*>( packet ) ); break; case 0x9B: handleHelpRequest( dynamic_cast<cUORxHelpRequest*>( packet ) ); break; *************** *** 444,448 **** void cUOSocket::handleHardwareInfo( cUORxHardwareInfo* packet ) { ! Q_UNUSED(packet); // Do something with the retrieved hardware information here // > Hardware Log ?? --- 450,454 ---- void cUOSocket::handleHardwareInfo( cUORxHardwareInfo* packet ) { ! Q_UNUSED( packet ); // Do something with the retrieved hardware information here // > Hardware Log ?? *************** *** 548,552 **** clientFeatures.setLbr( true ); clientFeatures.setT2a( true ); ! clientFeatures.setShort( 1, 0xFFFF ); // AoS TEST send( &clientFeatures ); --- 554,559 ---- clientFeatures.setLbr( true ); clientFeatures.setT2a( true ); ! //clientFeatures.setShort( 1, 0xFFFF ); // AoS TEST ! clientFeatures.setShort(1, 0x1F); send( &clientFeatures ); *************** *** 568,576 **** charList.compile(); send( &charList ); ! #pragma fixme("Warning: Ugly ugly ugly! Fix me!") // Ask the client for a viewrange ! cUOPacket packet( 0xc8, 2 ); ! packet[1] = VISRANGE; ! send( &packet ); } --- 575,583 ---- charList.compile(); send( &charList ); ! // Ask the client for a viewrange ! cUOTxUpdateRange range; ! range.setRange(VISRANGE); ! send( &range ); } *************** *** 659,667 **** // Enable Sta+Map Diffs cUOTxMapDiffs diffs; ! diffs.addEntry(Maps::instance()->mapPatches(0), Maps::instance()->staticPatches(0)); ! diffs.addEntry(Maps::instance()->mapPatches(1), Maps::instance()->staticPatches(1)); ! diffs.addEntry(Maps::instance()->mapPatches(2), Maps::instance()->staticPatches(2)); ! diffs.addEntry(Maps::instance()->mapPatches(3), Maps::instance()->staticPatches(3)); ! send(&diffs); // Which map are we on --- 666,674 ---- // Enable Sta+Map Diffs cUOTxMapDiffs diffs; ! diffs.addEntry( Maps::instance()->mapPatches( 0 ), Maps::instance()->staticPatches( 0 ) ); ! diffs.addEntry( Maps::instance()->mapPatches( 1 ), Maps::instance()->staticPatches( 1 ) ); ! diffs.addEntry( Maps::instance()->mapPatches( 2 ), Maps::instance()->staticPatches( 2 ) ); ! diffs.addEntry( Maps::instance()->mapPatches( 3 ), Maps::instance()->staticPatches( 3 ) ); ! send( &diffs ); // Which map are we on *************** *** 829,836 **** // If we have more than 6 characters ! const uint maxChars = QMIN(6, Config::instance()->maxCharsPerAccount() ); if ( characters.size() >= maxChars ) { ! cancelCreate( tr( "You already have more than %1 characters" ).arg(maxChars) ) } --- 836,843 ---- // If we have more than 6 characters ! const uint maxChars = QMIN( 6, Config::instance()->maxCharsPerAccount() ); if ( characters.size() >= maxChars ) { ! cancelCreate( tr( "You already have more than %1 characters" ).arg( maxChars ) ) } *************** *** 908,912 **** if ( playerDefinition ) pChar->applyDefinition( playerDefinition ); ! pChar->setName( packet->name() ); --- 915,919 ---- if ( playerDefinition ) pChar->applyDefinition( playerDefinition ); ! pChar->setName( packet->name() ); *************** *** 1244,1248 **** handleCHRevert( packet ); break; /* case cUORxAosMultiPurpose::AbilitySelect: ! handleAbilitySelect( dynamic_cast< */ default: Console::instance()->log( LOG_WARNING, packet->dump( packet->uncompressed() ) ); --- 1251,1255 ---- handleCHRevert( packet ); break; /* case cUORxAosMultiPurpose::AbilitySelect: ! handleAbilitySelect( dynamic_cast< */ default: Console::instance()->log( LOG_WARNING, packet->dump( packet->uncompressed() ) ); *************** *** 1253,1297 **** void cUOSocket::handleCHBackup( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED(packet); } void cUOSocket::handleCHRestore( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED(packet); } void cUOSocket::handleCHCommit( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED(packet); } void cUOSocket::handleCHDelete( cUORxCHDelete* packet ) { ! Q_UNUSED(packet); } void cUOSocket::handleCHAddElement( cUORxCHAddElement* packet ) { ! Q_UNUSED(packet); } void cUOSocket::handleCHClose( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED(packet); } void cUOSocket::handleCHStairs( cUORxCHStairs* packet ) { ! Q_UNUSED(packet); } void cUOSocket::handleCHSync( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED(packet); } void cUOSocket::handleCHClear( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED(packet); } --- 1260,1304 ---- void cUOSocket::handleCHBackup( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED( packet ); } void cUOSocket::handleCHRestore( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED( packet ); } void cUOSocket::handleCHCommit( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED( packet ); } void cUOSocket::handleCHDelete( cUORxCHDelete* packet ) { ! Q_UNUSED( packet ); } void cUOSocket::handleCHAddElement( cUORxCHAddElement* packet ) { ! Q_UNUSED( packet ); } void cUOSocket::handleCHClose( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED( packet ); } void cUOSocket::handleCHStairs( cUORxCHStairs* packet ) { ! Q_UNUSED( packet ); } void cUOSocket::handleCHSync( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED( packet ); } void cUOSocket::handleCHClear( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED( packet ); } *************** *** 1303,1307 **** void cUOSocket::handleCHRevert( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED(packet); } --- 1310,1314 ---- void cUOSocket::handleCHRevert( cUORxAosMultiPurpose* packet ) { ! Q_UNUSED( packet ); } *************** *** 1531,1535 **** changemap.setMap(pos_.map); socket_->send(&changemap); - cUOTxChangeServer changeserver; changeserver.setX(pos_.x); --- 1538,1541 ---- *************** *** 1540,1550 **** socket_->send(&changeserver); } - updatePlayer(); - // Send the equipment Tooltips cBaseChar::ItemContainer content = _player->content(); cBaseChar::ItemContainer::const_iterator it; - for (it = content.begin(); it != content.end(); it++) { P_ITEM pItem = it.data(); --- 1546,1553 ---- *************** *** 1554,1560 **** } } - updateLightLevel(); - // Set the warmode status if (!quick) { --- 1557,1561 ---- *************** *** 1989,1993 **** } ! if ( pCont->objectID() == QString("cCorpse") ) { cCorpse* pCorpse = dynamic_cast<cCorpse*>( pCont ); --- 1990,1994 ---- } ! if ( pCont->objectID() == QString( "cCorpse" ) ) { cCorpse* pCorpse = dynamic_cast<cCorpse*>( pCont ); *************** *** 2580,2587 **** // change how the name is displayed /*QString name = mItem->getName(true); ! name[0] = name[0].upper(); ! for ( uint j = 1; j < name.length() - 1; ++j ) ! if ( name.at(j).isSpace() ) ! name.at(j+1) = name.at(j+1).upper();*/ items.append( mItem ); --- 2581,2588 ---- // change how the name is displayed /*QString name = mItem->getName(true); ! name[0] = name[0].upper(); ! for ( uint j = 1; j < name.length() - 1; ++j ) ! if ( name.at(j).isSpace() ) ! name.at(j+1) = name.at(j+1).upper();*/ items.append( mItem ); *************** *** 3230,3242 **** } ! void cUOSocket::handleAllNames(cUORxAllNames *packet) { ! cUObject *object = World::instance()->findObject(packet->serial()); // Send a packet back with the name of the requested object ! if (object) { cUOTxAllNames allnames; ! allnames.setSerial(object->serial()); ! allnames.setName(object->name()); ! send(&allnames); } } --- 3231,3245 ---- } ! void cUOSocket::handleAllNames( cUORxAllNames* packet ) ! { ! cUObject* object = World::instance()->findObject( packet->serial() ); // Send a packet back with the name of the requested object ! if ( object ) ! { cUOTxAllNames allnames; ! allnames.setSerial( object->serial() ); ! allnames.setName( object->name() ); ! send( &allnames ); } } Index: uotxpackets.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uotxpackets.cpp,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** uotxpackets.cpp 27 Jul 2004 06:35:22 -0000 1.99 --- uotxpackets.cpp 10 Aug 2004 03:24:29 -0000 1.100 *************** *** 366,370 **** bool layers[0x20] = { ! 0, }; --- 366,370 ---- bool layers[0x20] = { ! 0, }; Index: asyncnetio.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/asyncnetio.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** asyncnetio.h 22 Jul 2004 13:38:32 -0000 1.18 --- asyncnetio.h 10 Aug 2004 03:24:29 -0000 1.19 *************** *** 61,65 **** cUOPacket* recvPacket( QSocketDevice* ); ! void pushfrontPacket( QSocketDevice*, cUOPacket *packet ); void sendPacket( QSocketDevice*, cUOPacket*, bool ); --- 61,65 ---- cUOPacket* recvPacket( QSocketDevice* ); ! void pushfrontPacket( QSocketDevice*, cUOPacket* packet ); void sendPacket( QSocketDevice*, cUOPacket*, bool ); |
From: Correa <thi...@us...> - 2004-08-10 03:20:43
|
Update of /cvsroot/wpdev/wolfpack/muls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18793 Modified Files: maps.cpp multiscache.cpp Log Message: applied coding standard rules. Index: maps.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/muls/maps.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** maps.cpp 4 Aug 2004 23:17:38 -0000 1.5 --- maps.cpp 10 Aug 2004 03:20:29 -0000 1.6 *************** *** 49,53 **** #pragma pack (1) ! struct stIndexRecord { unsigned int offset; unsigned int blocklength; --- 49,54 ---- #pragma pack (1) ! struct stIndexRecord ! { unsigned int offset; unsigned int blocklength; *************** *** 147,158 **** QFile stadifindex( basepath + QString( "stadifi%1.mul" ).arg( id ) ); ! if (stadifindex.open(IO_ReadOnly) && stadiflist.open(IO_ReadOnly)) { ! QDataStream listinput(&stadiflist); ! QDataStream indexinput(&stadifindex); ! listinput.setByteOrder(QDataStream::LittleEndian); ! indexinput.setByteOrder(QDataStream::LittleEndian); stIndexRecord record; ! while (!listinput.atEnd()) { unsigned int id; listinput >> id; --- 148,161 ---- QFile stadifindex( basepath + QString( "stadifi%1.mul" ).arg( id ) ); ! if ( stadifindex.open( IO_ReadOnly ) && stadiflist.open( IO_ReadOnly ) ) ! { ! QDataStream listinput( &stadiflist ); ! QDataStream indexinput( &stadifindex ); ! listinput.setByteOrder( QDataStream::LittleEndian ); ! indexinput.setByteOrder( QDataStream::LittleEndian ); stIndexRecord record; ! while ( !listinput.atEnd() ) ! { unsigned int id; listinput >> id; *************** *** 162,176 **** indexinput >> record.extra; ! if (!staticpatches.contains(id)) { ! staticpatches.insert( id, record ); } } } ! if (stadiflist.isOpen()) { stadiflist.close(); } ! if (stadifindex.isOpen()) { stadifindex.close(); } --- 165,182 ---- indexinput >> record.extra; ! if ( !staticpatches.contains( id ) ) ! { ! staticpatches.insert( id, record ); } } } ! if ( stadiflist.isOpen() ) ! { stadiflist.close(); } ! if ( stadifindex.isOpen() ) ! { stadifindex.close(); } *************** *** 625,691 **** #if !defined(_DEBUG) if ( !p ) ! #else ! if ( true ) ! #endif ! { ! QDataStream staticStream; ! staticStream.setByteOrder( QDataStream::LittleEndian ); ! unsigned int blockLength; ! ! // See if this particular block is patched. ! if ( mapRecord->staticpatches.contains( indexPos / 12 ) ) { ! const stIndexRecord& index = mapRecord->staticpatches[indexPos / 12]; ! if ( index.offset == 0xFFFFFFFF ) ! return; // No statics for this block ! mapRecord->stadifdata.at( index.offset ); ! staticStream.setDevice( &mapRecord->stadifdata ); ! blockLength = index.blocklength; ! } ! else ! { ! stIndexRecord indexStructure; ! mapRecord->idxfile.at( indexPos ); ! mapRecord->idxfile.readBlock( ( char * ) &indexStructure, sizeof( indexStructure ) ); ! if ( indexStructure.offset == 0xFFFFFFFF ) ! return; // No statics for this block ! mapRecord->staticsfile.at( indexStructure.offset ); ! staticStream.setDevice( &mapRecord->staticsfile ); ! blockLength = indexStructure.blocklength; ! } ! const uint remainX = x % 8; ! const uint remainY = y % 8; ! for ( Q_UINT32 i = 0; i < blockLength / 7; ++i ) ! { ! staticrecord r; ! staticStream >> r.itemid; ! staticStream >> r.xoff; ! staticStream >> r.yoff; ! staticStream >> r.zoff; ! Q_UINT16 unknown; ! staticStream >> unknown; ! if ( exact ) { ! if ( r.xoff == remainX && r.yoff == remainY ) staticArray.push_back( r ); } - else - staticArray.push_back( r ); - } ! // update cache; ! QValueVector<staticrecord>* temp = new QValueVector<staticrecord>( staticArray ); ! if ( !mapRecord->staticsCache.insert( cachePos, temp ) ) ! delete temp; ! } ! else ! { ! staticArray = *p; ! } } --- 631,697 ---- #if !defined(_DEBUG) if ( !p ) ! #else ! if ( true ) ! #endif { ! QDataStream staticStream; ! staticStream.setByteOrder( QDataStream::LittleEndian ); ! unsigned int blockLength; ! // See if this particular block is patched. ! if ( mapRecord->staticpatches.contains( indexPos / 12 ) ) ! { ! const stIndexRecord& index = mapRecord->staticpatches[indexPos / 12]; ! if ( index.offset == 0xFFFFFFFF ) ! return; // No statics for this block ! mapRecord->stadifdata.at( index.offset ); ! staticStream.setDevice( &mapRecord->stadifdata ); ! blockLength = index.blocklength; ! } ! else ! { ! stIndexRecord indexStructure; ! mapRecord->idxfile.at( indexPos ); ! mapRecord->idxfile.readBlock( ( char * ) &indexStructure, sizeof( indexStructure ) ); ! if ( indexStructure.offset == 0xFFFFFFFF ) ! return; // No statics for this block ! mapRecord->staticsfile.at( indexStructure.offset ); ! staticStream.setDevice( &mapRecord->staticsfile ); ! blockLength = indexStructure.blocklength; ! } ! ! const uint remainX = x % 8; ! const uint remainY = y % 8; ! for ( Q_UINT32 i = 0; i < blockLength / 7; ++i ) { ! staticrecord r; ! staticStream >> r.itemid; ! staticStream >> r.xoff; ! staticStream >> r.yoff; ! staticStream >> r.zoff; ! Q_UINT16 unknown; ! staticStream >> unknown; ! if ( exact ) ! { ! if ( r.xoff == remainX && r.yoff == remainY ) ! staticArray.push_back( r ); ! } ! else staticArray.push_back( r ); } ! // update cache; ! QValueVector<staticrecord>* temp = new QValueVector<staticrecord>( staticArray ); ! if ( !mapRecord->staticsCache.insert( cachePos, temp ) ) ! delete temp; ! } ! else ! { ! staticArray = *p; ! } } Index: multiscache.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/muls/multiscache.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** multiscache.cpp 6 Aug 2004 22:27:03 -0000 1.5 --- multiscache.cpp 10 Aug 2004 03:20:29 -0000 1.6 *************** *** 197,201 **** multiStream.setByteOrder( QDataStream::LittleEndian ); ! for (int i = 0; i < indexData.length / 12; ++i ) { multiItem_st item; --- 197,201 ---- multiStream.setByteOrder( QDataStream::LittleEndian ); ! for ( int i = 0; i < indexData.length / 12; ++i ) { multiItem_st item; |
From: Correa <thi...@us...> - 2004-08-10 03:20:17
|
Update of /cvsroot/wpdev/wolfpack/bugreport In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18671 Modified Files: crashhandler.cpp Log Message: applied coding standard rules. Index: crashhandler.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/bugreport/crashhandler.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** crashhandler.cpp 2 Jun 2004 15:04:09 -0000 1.3 --- crashhandler.cpp 10 Aug 2004 03:20:02 -0000 1.4 *************** *** 396,404 **** } ! #ifdef _ALPHA_ iCurr += wsprintf( g_szBuff + iCurr, _T( " at %08X" ), pExPtrs->ExceptionRecord->ExceptionAddress ); ! #else iCurr += wsprintf( g_szBuff + iCurr, _T( " at %04X:%08X" ), pExPtrs->ContextRecord->SegCs, pExPtrs->ExceptionRecord->ExceptionAddress ); ! #endif szRet = g_szBuff; --- 396,404 ---- } ! #ifdef _ALPHA_ iCurr += wsprintf( g_szBuff + iCurr, _T( " at %08X" ), pExPtrs->ExceptionRecord->ExceptionAddress ); ! #else iCurr += wsprintf( g_szBuff + iCurr, _T( " at %04X:%08X" ), pExPtrs->ContextRecord->SegCs, pExPtrs->ExceptionRecord->ExceptionAddress ); ! #endif szRet = g_szBuff; *************** *** 420,424 **** ZeroMemory( &g_stFrame, sizeof( STACKFRAME ) ) ; ! #ifdef _X86_ g_stFrame.AddrPC.Offset = pExPtrs->ContextRecord->Eip ; g_stFrame.AddrPC.Mode = AddrModeFlat ; --- 420,424 ---- ZeroMemory( &g_stFrame, sizeof( STACKFRAME ) ) ; ! #ifdef _X86_ g_stFrame.AddrPC.Offset = pExPtrs->ContextRecord->Eip ; g_stFrame.AddrPC.Mode = AddrModeFlat ; *************** *** 427,431 **** g_stFrame.AddrFrame.Offset = pExPtrs->ContextRecord->Ebp ; g_stFrame.AddrFrame.Mode = AddrModeFlat ; ! #else g_stFrame.AddrPC.Offset = ( DWORD ) pExPtrs->ContextRecord->Fir ; g_stFrame.AddrPC.Mode = AddrModeFlat ; --- 427,431 ---- g_stFrame.AddrFrame.Offset = pExPtrs->ContextRecord->Ebp ; g_stFrame.AddrFrame.Mode = AddrModeFlat ; ! #else g_stFrame.AddrPC.Offset = ( DWORD ) pExPtrs->ContextRecord->Fir ; g_stFrame.AddrPC.Mode = AddrModeFlat ; *************** *** 436,440 **** g_stFrame.AddrFrame.Offset = ( DWORD ) pExPtrs->ContextRecord->IntFp; g_stFrame.AddrFrame.Mode = AddrModeFlat ; ! #endif return ( InternalGetStackTraceString( dwOpts, pExPtrs ) ) ; --- 436,440 ---- g_stFrame.AddrFrame.Offset = ( DWORD ) pExPtrs->ContextRecord->IntFp; g_stFrame.AddrFrame.Mode = AddrModeFlat ; ! #endif return ( InternalGetStackTraceString( dwOpts, pExPtrs ) ) ; *************** *** 486,512 **** int iCurr = 0 ; /* ! // At a minimum, put the address in. ! #ifdef _ALPHA_ ! iCurr += wsprintf ( g_szBuff + iCurr , ! _T ( "0x%08X" ) , ! g_stFrame.AddrPC.Offset ) ; ! #else ! iCurr += wsprintf ( g_szBuff + iCurr , ! _T ( "%04X:%08X" ) , ! pExPtrs->ContextRecord->SegCs , ! g_stFrame.AddrPC.Offset ) ; ! #endif ! */ // Do the parameters? /*if ( GSTSO_PARAMS == ( dwOpts & GSTSO_PARAMS ) ) ! { ! iCurr += wsprintf ( g_szBuff + iCurr , ! _T ( " (0x%08X 0x%08X "\ ! "0x%08X 0x%08X)" ) , ! g_stFrame.Params[ 0 ] , ! g_stFrame.Params[ 1 ] , ! g_stFrame.Params[ 2 ] , ! g_stFrame.Params[ 3 ] ) ; ! }*/ if ( GSTSO_MODULE == ( dwOpts & GSTSO_MODULE ) ) --- 486,512 ---- int iCurr = 0 ; /* ! // At a minimum, put the address in. ! #ifdef _ALPHA_ ! iCurr += wsprintf ( g_szBuff + iCurr , ! _T ( "0x%08X" ) , ! g_stFrame.AddrPC.Offset ) ; ! #else ! iCurr += wsprintf ( g_szBuff + iCurr , ! _T ( "%04X:%08X" ) , ! pExPtrs->ContextRecord->SegCs , ! g_stFrame.AddrPC.Offset ) ; ! #endif ! */ // Do the parameters? /*if ( GSTSO_PARAMS == ( dwOpts & GSTSO_PARAMS ) ) ! { ! iCurr += wsprintf ( g_szBuff + iCurr , ! _T ( " (0x%08X 0x%08X "\ ! "0x%08X 0x%08X)" ) , ! g_stFrame.Params[ 0 ] , ! g_stFrame.Params[ 1 ] , ! g_stFrame.Params[ 2 ] , ! g_stFrame.Params[ 3 ] ) ; ! }*/ if ( GSTSO_MODULE == ( dwOpts & GSTSO_MODULE ) ) *************** *** 720,725 **** { /*char message[512]; ! sprintf(message, "Couldn't load symbol information for module %s (0x%x).", ModuleName, GetLastError()); ! MessageBox(0, message, "Failure", 0);*/ } --- 720,725 ---- { /*char message[512]; ! sprintf(message, "Couldn't load symbol information for module %s (0x%x).", ModuleName, GetLastError()); ! MessageBox(0, message, "Failure", 0);*/ } |
From: Correa <thi...@us...> - 2004-08-10 03:19:36
|
Update of /cvsroot/wpdev/wolfpack/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18584 Modified Files: ai.cpp Log Message: applied coding standard rules. Index: ai.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ai/ai.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ai.cpp 4 Aug 2004 23:17:37 -0000 1.21 --- ai.cpp 10 Aug 2004 03:19:27 -0000 1.22 *************** *** 492,516 **** // Only try to walk if we're not already out of the spawnregion // Otherwise fall trough to enFreely ! cSpawnRegion *region = m_npc->spawnregion(); ! if (region && region->contains(m_npc->pos().x, m_npc->pos().y, m_npc->pos().map)) { // Calculate the field we're facing. unsigned char dir = m_npc->direction(); ! Coord_cl newpos = Movement::instance()->calcCoordFromDir(dir, m_npc->pos()); // Calculate a new direction. ! if (!region->contains(newpos.x, newpos.y, newpos.map)) { ! unsigned char newdir = RandomNum(0, 7); // Make sure we're not trying to walk in the same // direction or the directions directly beneath if we met the border of a // spawnregion. But we don't want to turn around exactly either. (Looks // to mechanically) ! while (newdir == dir ! || newdir == ((dir == 0) ? 7 : dir - 1) ! || newdir == ((dir == 7) ? 0 : dir + 1) ) { ! newdir += RandomNum(0, 1) ? -1 : 1; } dir = newdir; --- 492,514 ---- // Only try to walk if we're not already out of the spawnregion // Otherwise fall trough to enFreely ! cSpawnRegion* region = m_npc->spawnregion(); ! if ( region && region->contains( m_npc->pos().x, m_npc->pos().y, m_npc->pos().map ) ) { // Calculate the field we're facing. unsigned char dir = m_npc->direction(); ! Coord_cl newpos = Movement::instance()->calcCoordFromDir( dir, m_npc->pos() ); // Calculate a new direction. ! if ( !region->contains( newpos.x, newpos.y, newpos.map ) ) { ! unsigned char newdir = RandomNum( 0, 7 ); // Make sure we're not trying to walk in the same // direction or the directions directly beneath if we met the border of a // spawnregion. But we don't want to turn around exactly either. (Looks // to mechanically) ! while ( newdir == dir || newdir == ( ( dir == 0 ) ? 7 : dir - 1 ) || newdir == ( ( dir == 7 ) ? 0 : dir + 1 ) ) { ! newdir += RandomNum( 0, 1 ) ? -1 : 1; } dir = newdir; *************** *** 520,536 **** // If there's a obstacle, change the direction slightly to see if we can get // around it. ! if (!Movement::instance()->Walking(m_npc, dir, 0xFF)) { signed char newdir = dir; ! newdir += RandomNum(0, 1) ? -1 : 1; ! if (newdir < 0) { newdir = 7; ! } else if (newdir > 7) { newdir = 0; } ! m_npc->setDirection(newdir); m_npc->update(); } --- 518,535 ---- // If there's a obstacle, change the direction slightly to see if we can get // around it. ! if ( !Movement::instance()->Walking( m_npc, dir, 0xFF ) ) { signed char newdir = dir; ! newdir += RandomNum( 0, 1 ) ? -1 : 1; ! if ( newdir < 0 ) { newdir = 7; ! } ! else if ( newdir > 7 ) { newdir = 0; } ! m_npc->setDirection( newdir ); m_npc->update(); } *************** *** 544,551 **** UINT8 dir = m_npc->direction(); if ( RandomNum( 0, 100 ) < 20 ) ! dir = RandomNum(0, 7); ! m_npc->setDirection(dir); ! Movement::instance()->Walking(m_npc, dir, 0xFF); break; } --- 543,550 ---- UINT8 dir = m_npc->direction(); if ( RandomNum( 0, 100 ) < 20 ) ! dir = RandomNum( 0, 7 ); ! m_npc->setDirection( dir ); ! Movement::instance()->Walking( m_npc, dir, 0xFF ); break; } |
From: Correa <thi...@us...> - 2004-08-10 03:19:23
|
Update of /cvsroot/wpdev/wolfpack/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18560 Modified Files: config_win.cpp console_win.cpp Log Message: applied coding standard rules. Index: console_win.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/win/console_win.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** console_win.cpp 20 Jul 2004 12:03:38 -0000 1.24 --- console_win.cpp 10 Aug 2004 03:19:08 -0000 1.25 *************** *** 52,59 **** #include "../sqlite/sqlite.h" #if defined(MYSQL_DRIVER) ! #if defined(Q_OS_WIN32) ! #include <winsock.h> ! #endif ! #include <mysql.h> #endif --- 52,59 ---- #include "../sqlite/sqlite.h" #if defined(MYSQL_DRIVER) ! #if defined(Q_OS_WIN32) ! #include <winsock.h> ! #endif ! #include <mysql.h> #endif *************** *** 226,240 **** pythonBuild = pythonBuild.left( pythonBuild.find( ' ' ) ); ! #if defined(Py_ENABLE_SHARED) credits += QString( "Python: %1 Shared (Compiled: %2)\n" ).arg( pythonBuild ).arg( PY_VERSION ); ! #else credits += QString( "Python: %1 Static (Compiled: %2)\n" ).arg( pythonBuild ).arg( PY_VERSION ); ! #endif credits += "Compiled with SQLite " SQLITE_VERSION "\n"; ! #if defined (MYSQL_DRIVER) ! credits += QString("Compiled for MySQL " MYSQL_SERVER_VERSION " (Using: %1)\n").arg(mysql_get_client_info()); ! #else credits += "MySQL Support: disabled\n"; ! #endif cr.cpMin = GetWindowTextLength( richtext ); --- 226,240 ---- pythonBuild = pythonBuild.left( pythonBuild.find( ' ' ) ); ! #if defined(Py_ENABLE_SHARED) credits += QString( "Python: %1 Shared (Compiled: %2)\n" ).arg( pythonBuild ).arg( PY_VERSION ); ! #else credits += QString( "Python: %1 Static (Compiled: %2)\n" ).arg( pythonBuild ).arg( PY_VERSION ); ! #endif credits += "Compiled with SQLite " SQLITE_VERSION "\n"; ! #if defined (MYSQL_DRIVER) ! credits += QString( "Compiled for MySQL " MYSQL_SERVER_VERSION " (Using: %1)\n" ).arg( mysql_get_client_info() ); ! #else credits += "MySQL Support: disabled\n"; ! #endif cr.cpMin = GetWindowTextLength( richtext ); *************** *** 521,530 **** { /*MSGFILTER *msg = (MSGFILTER*)notify; ! // Append to the Input Control ! if( msg->msg == WM_CHAR ) ! { ! SendMessage( inputWindow, WM_SETFOCUS, 0, 0 ); ! SendMessage( inputWindow, WM_CHAR, msg->wParam, msg->lParam ); ! }*/ } } --- 521,530 ---- { /*MSGFILTER *msg = (MSGFILTER*)notify; ! // Append to the Input Control ! if( msg->msg == WM_CHAR ) ! { ! SendMessage( inputWindow, WM_SETFOCUS, 0, 0 ); ! SendMessage( inputWindow, WM_CHAR, msg->wParam, msg->lParam ); ! }*/ } } *************** *** 579,585 **** QMemArray<pchar> argv( 8 ); /* ! Since Windows programs don't get passed the command name as the ! first argument, we need to fetch it explicitly. ! */ static char appFileName[256]; GetModuleFileNameA( 0, appFileName, sizeof( appFileName ) ); --- 579,585 ---- QMemArray<pchar> argv( 8 ); /* ! Since Windows programs don't get passed the command name as the ! first argument, we need to fetch it explicitly. ! */ static char appFileName[256]; GetModuleFileNameA( 0, appFileName, sizeof( appFileName ) ); *************** *** 588,596 **** /* ! Parse the Windows command line string. If an argument begins with a ! double quote, then spaces are considered part of the argument until the ! next double quote. The argument terminates at the second quote. Note ! that this is different from the usual Unix semantics. ! */ char* p = cmdLine; --- 588,596 ---- /* ! Parse the Windows command line string. If an argument begins with a ! double quote, then spaces are considered part of the argument until the ! next double quote. The argument terminates at the second quote. Note ! that this is different from the usual Unix semantics. ! */ char* p = cmdLine; *************** *** 661,669 **** coninfo.dwSize.Y = 500; SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize); - int hConHandle; long lStdHandle; FILE *fp; - lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE); hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); --- 661,667 ---- *************** *** 671,675 **** *stdout = *fp; setvbuf( stdout, NULL, _IONBF, 0 ); - lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE); hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); --- 669,672 ---- *************** *** 677,681 **** *stderr = *fp; setvbuf( stderr, NULL, _IONBF, 0 ); - QString consoleTitle = QString("%1 %2 %3 - Debug Console").arg(productString()).arg(productBeta()).arg(productVersion()); SetConsoleTitle(consoleTitle.latin1());*/ --- 674,677 ---- *************** *** 778,782 **** char command[512] = { ! 0, }; GetWindowText( inputWindow, command, 512 ); --- 774,778 ---- char command[512] = { ! 0, }; GetWindowText( inputWindow, command, 512 ); *************** *** 887,891 **** char buffer[1024] = { ! 0, }; ( ( short * ) buffer )[0] = 1024; --- 883,887 ---- char buffer[1024] = { ! 0, }; ( ( short * ) buffer )[0] = 1024; Index: config_win.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/win/config_win.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config_win.cpp 4 Aug 2004 23:17:40 -0000 1.4 --- config_win.cpp 10 Aug 2004 03:19:08 -0000 1.5 *************** *** 177,181 **** Q_UINT8 part2 = ( ip & 0x00FF0000 ) >> 16; ! if ( ( part1 == 127 ) || //this one is class A too. ( part1 == 10 ) || ( ( part1 == 192 ) && ( part2 == 168 ) ) || ( ( part1 == 172 ) && ( part2 >= 16 ) && ( part2 <= 31 ) ) || ( ( part1 == 169 ) && ( part2 == 254 ) ) // DHCP Space Stuff ) --- 177,181 ---- Q_UINT8 part2 = ( ip & 0x00FF0000 ) >> 16; ! if ( ( part1 == 127 ) || //this one is class A too. ( part1 == 10 ) || ( ( part1 == 192 ) && ( part2 == 168 ) ) || ( ( part1 == 172 ) && ( part2 >= 16 ) && ( part2 <= 31 ) ) || ( ( part1 == 169 ) && ( part2 == 254 ) ) // DHCP Space Stuff ) |
From: Correa <thi...@us...> - 2004-08-10 03:18:57
|
Update of /cvsroot/wpdev/wolfpack/unix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469 Modified Files: console_unix.cpp Log Message: applied coding standard rules. Index: console_unix.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/unix/console_unix.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** console_unix.cpp 15 Jul 2004 02:23:50 -0000 1.11 --- console_unix.cpp 10 Aug 2004 03:18:48 -0000 1.12 *************** *** 188,192 **** void cConsole::setConsoleTitle( const QString& data ) { ! Q_UNUSED(data); } --- 188,192 ---- void cConsole::setConsoleTitle( const QString& data ) { ! Q_UNUSED( data ); } *************** *** 269,281 **** void cConsole::setAttributes( bool bold, bool italic, bool, unsigned char r, unsigned char g, unsigned char b, unsigned char, enFontType ) { ! Q_UNUSED(bold); ! Q_UNUSED(italic); ! Q_UNUSED(r); ! Q_UNUSED(g); ! Q_UNUSED(b); } void cConsole::notifyServerState( enServerState newstate ) { ! Q_UNUSED(newstate); } --- 269,281 ---- void cConsole::setAttributes( bool bold, bool italic, bool, unsigned char r, unsigned char g, unsigned char b, unsigned char, enFontType ) { ! Q_UNUSED( bold ); ! Q_UNUSED( italic ); ! Q_UNUSED( r ); ! Q_UNUSED( g ); ! Q_UNUSED( b ); } void cConsole::notifyServerState( enServerState newstate ) { ! Q_UNUSED( newstate ); } |
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17239 Modified Files: accounts.cpp basechar.cpp basechar.h basedef.h basics.cpp basics.h commands.cpp contextmenu.cpp coord.cpp corpse.cpp corpse.h customtags.cpp customtags.h dbdriver.cpp defines.h definitions.cpp dragdrop.cpp factory.h guilds.cpp guilds.h gumps.cpp items.cpp items.h log.h multi.cpp multi.h npc.cpp npc.h party.cpp persistentbroker.cpp player.cpp player.h pythonscript.cpp pythonscript.h sectors.cpp server.cpp serverconfig.cpp serverconfig.h singleton.h spawnregions.cpp spawnregions.h speech.cpp targetrequests.cpp territories.cpp timers.cpp timing.cpp timing.h trade.cpp typedefs.h uobject.cpp uobject.h walking.cpp world.cpp world.h Log Message: applied coding standard rules. Index: trade.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/trade.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** trade.cpp 4 Aug 2004 23:17:37 -0000 1.5 --- trade.cpp 10 Aug 2004 03:15:57 -0000 1.6 *************** *** 209,213 **** { pSold = pItem->dupe(); ! pSold->removeTag("restock"); // Remove the restock tag; pSold->setAmount( iter->second ); pPack->addItem( pSold ); --- 209,213 ---- { pSold = pItem->dupe(); ! pSold->removeTag( "restock" ); // Remove the restock tag; pSold->setAmount( iter->second ); pPack->addItem( pSold ); *************** *** 220,224 **** { pSold = pItem->dupe(); ! pSold->removeTag("restock"); // Remove the restock tag; pSold->setAmount( 1 ); pPack->addItem( pSold ); --- 220,224 ---- { pSold = pItem->dupe(); ! pSold->removeTag( "restock" ); // Remove the restock tag; pSold->setAmount( 1 ); pPack->addItem( pSold ); *************** *** 315,319 **** continue; ! if ( ( *it )->id() == pItem->id() && ( *it )->color() == pItem->color() && // (*it)->amount() >= pItem->amount() && ( *it )->eventList() == pItem->eventList() ) --- 315,319 ---- continue; ! if ( ( *it )->id() == pItem->id() && ( *it )->color() == pItem->color() && // (*it)->amount() >= pItem->amount() && ( *it )->eventList() == pItem->eventList() ) *************** *** 357,361 **** { P_ITEM pSold = pItem->dupe(); ! pSold->removeTag("restock"); pSold->setAmount( iter->second ); pBought->addItem( pSold ); --- 357,361 ---- { P_ITEM pSold = pItem->dupe(); ! pSold->removeTag( "restock" ); pSold->setAmount( iter->second ); pBought->addItem( pSold ); Index: basechar.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** basechar.cpp 9 Aug 2004 20:30:21 -0000 1.124 --- basechar.cpp 10 Aug 2004 03:15:56 -0000 1.125 *************** *** 161,170 **** static void characterRegisterAfterLoading( P_CHAR pc ); ! void cBaseChar::load(cBufferedReader &reader, unsigned int version) { ! cUObject::load(reader, version); orgName_ = reader.readUtf8(); title_ = reader.readUtf8(); ! creationDate_ = QDateTime::fromString(reader.readUtf8(), Qt::ISODate); body_ = reader.readShort(); orgBody_ = reader.readShort(); --- 161,171 ---- static void characterRegisterAfterLoading( P_CHAR pc ); ! void cBaseChar::load( cBufferedReader& reader, unsigned int version ) ! { ! cUObject::load( reader, version ); orgName_ = reader.readUtf8(); title_ = reader.readUtf8(); ! creationDate_ = QDateTime::fromString( reader.readUtf8(), Qt::ISODate ); body_ = reader.readShort(); orgBody_ = reader.readShort(); *************** *** 192,200 **** poison_ = reader.readByte(); murdererTime_ = reader.readInt(); ! if (murdererTime_) { murdererTime_ += Server::instance()->time(); } criminalTime_ = reader.readInt(); ! if (criminalTime_) { criminalTime_ += Server::instance()->time(); } --- 193,203 ---- poison_ = reader.readByte(); murdererTime_ = reader.readInt(); ! if ( murdererTime_ ) ! { murdererTime_ += Server::instance()->time(); } criminalTime_ = reader.readInt(); ! if ( criminalTime_ ) ! { criminalTime_ += Server::instance()->time(); } *************** *** 202,206 **** propertyFlags_ = reader.readInt(); murdererSerial_ = reader.readInt(); ! guarding_ = reinterpret_cast<P_CHAR>(reader.readInt()); // PostProcess hitpointsBonus_ = reader.readShort(); staminaBonus_ = reader.readShort(); --- 205,209 ---- propertyFlags_ = reader.readInt(); murdererSerial_ = reader.readInt(); ! guarding_ = reinterpret_cast<P_CHAR>( reader.readInt() ); // PostProcess hitpointsBonus_ = reader.readShort(); staminaBonus_ = reader.readShort(); *************** *** 215,288 **** // Load Skills unsigned int count = ALLSKILLS; ! for (unsigned int s = 0; s < count; ++s) { // Read value, cap, lock ! setSkillValue(s, reader.readShort()); ! setSkillCap(s, reader.readShort()); ! setSkillLock(s, reader.readByte()); } } ! void cBaseChar::postload(unsigned int version) { // Resolve the guarding_ value. ! SERIAL guarding = (SERIAL)guarding_; guarding_ = 0; ! setGuarding(World::instance()->findChar(guarding)); ! ! } ! void cBaseChar::save(cBufferedWriter &writer, unsigned int version) { ! cUObject::save(writer, version); ! writer.writeUtf8(orgName_); ! writer.writeUtf8(title_); ! writer.writeUtf8(creationDate_.toString(Qt::ISODate)); ! writer.writeShort(body_); ! writer.writeShort(orgBody_); ! writer.writeShort(skin_); ! writer.writeShort(orgSkin_); ! writer.writeShort(saycolor_); ! writer.writeShort(emoteColor_); ! writer.writeShort(strength_); ! writer.writeShort(strengthMod_); ! writer.writeShort(dexterity_); ! writer.writeShort(dexterityMod_); ! writer.writeShort(intelligence_); ! writer.writeShort(intelligenceMod_); ! writer.writeShort(maxHitpoints_); ! writer.writeShort(hitpoints_); ! writer.writeShort(maxStamina_); ! writer.writeShort(stamina_); ! writer.writeShort(maxMana_); ! writer.writeShort(mana_); ! writer.writeShort(karma_); ! writer.writeShort(fame_); ! writer.writeShort(kills_); ! writer.writeShort(deaths_); ! writer.writeByte(hunger_); ! writer.writeByte(poison_); ! writer.writeInt(murdererTime_ ? murdererTime_ - Server::instance()->time() : 0); ! writer.writeInt(criminalTime_ ? criminalTime_ - Server::instance()->time() : 0); ! writer.writeByte(gender_); ! writer.writeInt(propertyFlags_); ! writer.writeInt(murdererSerial_); ! writer.writeInt(guarding_ ? guarding_->serial() : INVALID_SERIAL); ! writer.writeShort(hitpointsBonus_); ! writer.writeShort(staminaBonus_); ! writer.writeShort(manaBonus_); ! writer.writeByte(strengthCap_); ! writer.writeByte(dexterityCap_); ! writer.writeByte(intelligenceCap_); ! writer.writeByte(statCap_); ! writer.writeAscii(baseid()); ! writer.writeByte(direction_); // Load Skills unsigned int count = ALLSKILLS; ! for (unsigned int s = 0; s < count; ++s) { // Read value, cap, lock ! writer.writeShort(skillValue(s)); ! writer.writeShort(skillCap(s)); ! writer.writeByte(skillLock(s)); } } --- 218,293 ---- // Load Skills unsigned int count = ALLSKILLS; ! for ( unsigned int s = 0; s < count; ++s ) ! { // Read value, cap, lock ! setSkillValue( s, reader.readShort() ); ! setSkillCap( s, reader.readShort() ); ! setSkillLock( s, reader.readByte() ); } } ! void cBaseChar::postload( unsigned int version ) ! { // Resolve the guarding_ value. ! SERIAL guarding = ( SERIAL ) guarding_; guarding_ = 0; ! setGuarding( World::instance()->findChar( guarding ) ); } ! void cBaseChar::save( cBufferedWriter& writer, unsigned int version ) ! { ! cUObject::save( writer, version ); ! writer.writeUtf8( orgName_ ); ! writer.writeUtf8( title_ ); ! writer.writeUtf8( creationDate_.toString( Qt::ISODate ) ); ! writer.writeShort( body_ ); ! writer.writeShort( orgBody_ ); ! writer.writeShort( skin_ ); ! writer.writeShort( orgSkin_ ); ! writer.writeShort( saycolor_ ); ! writer.writeShort( emoteColor_ ); ! writer.writeShort( strength_ ); ! writer.writeShort( strengthMod_ ); ! writer.writeShort( dexterity_ ); ! writer.writeShort( dexterityMod_ ); ! writer.writeShort( intelligence_ ); ! writer.writeShort( intelligenceMod_ ); ! writer.writeShort( maxHitpoints_ ); ! writer.writeShort( hitpoints_ ); ! writer.writeShort( maxStamina_ ); ! writer.writeShort( stamina_ ); ! writer.writeShort( maxMana_ ); ! writer.writeShort( mana_ ); ! writer.writeShort( karma_ ); ! writer.writeShort( fame_ ); ! writer.writeShort( kills_ ); ! writer.writeShort( deaths_ ); ! writer.writeByte( hunger_ ); ! writer.writeByte( poison_ ); ! writer.writeInt( murdererTime_ ? murdererTime_ - Server::instance()->time() : 0 ); ! writer.writeInt( criminalTime_ ? criminalTime_ - Server::instance()->time() : 0 ); ! writer.writeByte( gender_ ); ! writer.writeInt( propertyFlags_ ); ! writer.writeInt( murdererSerial_ ); ! writer.writeInt( guarding_ ? guarding_->serial() : INVALID_SERIAL ); ! writer.writeShort( hitpointsBonus_ ); ! writer.writeShort( staminaBonus_ ); ! writer.writeShort( manaBonus_ ); ! writer.writeByte( strengthCap_ ); ! writer.writeByte( dexterityCap_ ); ! writer.writeByte( intelligenceCap_ ); ! writer.writeByte( statCap_ ); ! writer.writeAscii( baseid() ); ! writer.writeByte( direction_ ); // Load Skills unsigned int count = ALLSKILLS; ! for ( unsigned int s = 0; s < count; ++s ) ! { // Read value, cap, lock ! writer.writeShort( skillValue( s ) ); ! writer.writeShort( skillCap( s ) ); ! writer.writeByte( skillLock( s ) ); } } *************** *** 379,389 **** } ! void cBaseChar::save(cBufferedWriter &writer) { ! cUObject::save(writer); // Save equipment ItemContainer::iterator it = content_.begin(); ! for (; it != content_.end(); ++it) { ! it.data()->save(writer); } } --- 384,396 ---- } ! void cBaseChar::save( cBufferedWriter& writer ) ! { ! cUObject::save( writer ); // Save equipment ItemContainer::iterator it = content_.begin(); ! for ( ; it != content_.end(); ++it ) ! { ! it.data()->save( writer ); } } *************** *** 1208,1212 **** } ! void cBaseChar::processNode(const cElement* Tag) { changed_ = true; QString TagName = Tag->name(); --- 1215,1220 ---- } ! void cBaseChar::processNode( const cElement* Tag ) ! { changed_ = true; QString TagName = Tag->name(); *************** *** 1579,1583 **** SET_INT_PROPERTY( "skin", skin_ ) ! // \property char.direction This is the direction this character is facing. else SET_INT_PROPERTY( "direction", direction_ ) --- 1587,1591 ---- SET_INT_PROPERTY( "skin", skin_ ) ! // \property char.direction This is the direction this character is facing. else SET_INT_PROPERTY( "direction", direction_ ) *************** *** 1742,1747 **** return 0; /* ! \property char.dexterity This integer property is the dexterity of this character. ! */ } else if ( name == "dexterity" ) --- 1750,1755 ---- return 0; /* ! \property char.dexterity This integer property is the dexterity of this character. ! */ } else if ( name == "dexterity" ) *************** *** 1750,1755 **** return 0; /* ! \property char.intelligence This integer property is the intelligence of this character. ! */ } else if ( name == "intelligence" ) --- 1758,1763 ---- return 0; /* ! \property char.intelligence This integer property is the intelligence of this character. ! */ } else if ( name == "intelligence" ) *************** *** 1758,1764 **** return 0; /* ! \property char.strength2 This integer property contains a modification value applied to strength. This is used to ! determine the real strength of the character if needed. ! */ } else if ( name == "strength2" ) --- 1766,1772 ---- return 0; /* ! \property char.strength2 This integer property contains a modification value applied to strength. This is used to ! determine the real strength of the character if needed. ! */ } else if ( name == "strength2" ) *************** *** 1767,1773 **** return 0; /* ! \property char.dexterity2 This integer property contains a modification value applied to dexterity. This is used to ! determine the real dexterity of the character if needed. ! */ } else if ( name == "dexterity2" ) --- 1775,1781 ---- return 0; /* ! \property char.dexterity2 This integer property contains a modification value applied to dexterity. This is used to ! determine the real dexterity of the character if needed. ! */ } else if ( name == "dexterity2" ) *************** *** 1776,1782 **** return 0; /* ! \property char.intelligence2 This integer property contains a modification value applied to intelligence. This is used to ! determine the real intelligence of the character if needed. ! */ } else if ( name == "intelligence2" ) --- 1784,1790 ---- return 0; /* ! \property char.intelligence2 This integer property contains a modification value applied to intelligence. This is used to ! determine the real intelligence of the character if needed. ! */ } else if ( name == "intelligence2" ) *************** *** 1888,1893 **** return 0; /* ! \property char.staminabonus The integer bonus awarded to the maximum stamina of this character. ! */ } else if ( name == "staminabonus" ) --- 1896,1901 ---- return 0; /* ! \property char.staminabonus The integer bonus awarded to the maximum stamina of this character. ! */ } else if ( name == "staminabonus" ) *************** *** 1896,1901 **** return 0; /* ! \property char.manabonus The integer bonus awarded to the maximum mana of this character. ! */ } else if ( name == "manabonus" ) --- 1904,1909 ---- return 0; /* ! \property char.manabonus The integer bonus awarded to the maximum mana of this character. ! */ } else if ( name == "manabonus" ) *************** *** 1904,1909 **** return 0; /* ! \property char.invulnerable Indicates whether the character is invulnerable or not. ! */ } else if ( name == "invulnerable" ) --- 1912,1917 ---- return 0; /* ! \property char.invulnerable Indicates whether the character is invulnerable or not. ! */ } else if ( name == "invulnerable" ) *************** *** 1962,1970 **** } ! PyObject *cBaseChar::getProperty(const QString &name) { PY_PROPERTY( "orgname", orgName_ ) PY_PROPERTY( "direction", direction_ ) PY_PROPERTY( "baseid", baseid() ) ! PY_PROPERTY( "lastmovement", lastMovement_ ) PY_PROPERTY( "title", title_ ) PY_PROPERTY( "incognito", isIncognito() ) --- 1970,1979 ---- } ! PyObject* cBaseChar::getProperty( const QString& name ) ! { PY_PROPERTY( "orgname", orgName_ ) PY_PROPERTY( "direction", direction_ ) PY_PROPERTY( "baseid", baseid() ) ! PY_PROPERTY( "lastmovement", lastMovement_ ) PY_PROPERTY( "title", title_ ) PY_PROPERTY( "incognito", isIncognito() ) *************** *** 1974,1978 **** PY_PROPERTY( "creationdate", creationDate_.toString() ) PY_PROPERTY( "stealthedsteps", stealthedSteps_ ) ! PY_PROPERTY( "runningsteps", runningSteps_ ) PY_PROPERTY( "tamed", isTamed() ) PY_PROPERTY( "guarding", guarding_ ) --- 1983,1987 ---- PY_PROPERTY( "creationdate", creationDate_.toString() ) PY_PROPERTY( "stealthedsteps", stealthedSteps_ ) ! PY_PROPERTY( "runningsteps", runningSteps_ ) PY_PROPERTY( "tamed", isTamed() ) PY_PROPERTY( "guarding", guarding_ ) *************** *** 1981,1990 **** PY_PROPERTY( "hidden", isHidden() ) PY_PROPERTY( "hunger", hunger_ ) ! PY_PROPERTY( "hungertime", hungerTime_ ) PY_PROPERTY( "poison", poison_ ) PY_PROPERTY( "flag", flag_ ) ! PY_PROPERTY( "propertyflags", propertyFlags_ ) ! PY_PROPERTY( "murderertime", murdererTime_ ) ! PY_PROPERTY( "criminaltime", criminalTime_ ) PY_PROPERTY( "meditating", isMeditating() ) PY_PROPERTY( "weight", weight_ ) --- 1990,1999 ---- PY_PROPERTY( "hidden", isHidden() ) PY_PROPERTY( "hunger", hunger_ ) ! PY_PROPERTY( "hungertime", hungerTime_ ) PY_PROPERTY( "poison", poison_ ) PY_PROPERTY( "flag", flag_ ) ! PY_PROPERTY( "propertyflags", propertyFlags_ ) ! PY_PROPERTY( "murderertime", murdererTime_ ) ! PY_PROPERTY( "criminaltime", criminalTime_ ) PY_PROPERTY( "meditating", isMeditating() ) PY_PROPERTY( "weight", weight_ ) *************** *** 2011,2025 **** PY_PROPERTY( "karma", karma_ ) PY_PROPERTY( "fame", fame_ ) ! PY_PROPERTY( "kills", kills_ ) ! PY_PROPERTY( "deaths", deaths_ ) PY_PROPERTY( "dead", isDead() ) PY_PROPERTY( "war", isAtWar() ) PY_PROPERTY( "attacktarget", attackTarget_ ) ! PY_PROPERTY( "nextswing", nextSwing_ ) ! PY_PROPERTY( "regenhealth", regenHitpointsTime_ ) ! PY_PROPERTY( "regenstamina", regenStaminaTime_ ) ! PY_PROPERTY( "regenmana", regenManaTime_ ) PY_PROPERTY( "region", region_ ) ! PY_PROPERTY( "skilldelay", skillDelay_ ) PY_PROPERTY( "gender", gender_ ) PY_PROPERTY( "id", body_ ) --- 2020,2034 ---- PY_PROPERTY( "karma", karma_ ) PY_PROPERTY( "fame", fame_ ) ! PY_PROPERTY( "kills", kills_ ) ! PY_PROPERTY( "deaths", deaths_ ) PY_PROPERTY( "dead", isDead() ) PY_PROPERTY( "war", isAtWar() ) PY_PROPERTY( "attacktarget", attackTarget_ ) ! PY_PROPERTY( "nextswing", nextSwing_ ) ! PY_PROPERTY( "regenhealth", regenHitpointsTime_ ) ! PY_PROPERTY( "regenstamina", regenStaminaTime_ ) ! PY_PROPERTY( "regenmana", regenManaTime_ ) PY_PROPERTY( "region", region_ ) ! PY_PROPERTY( "skilldelay", skillDelay_ ) PY_PROPERTY( "gender", gender_ ) PY_PROPERTY( "id", body_ ) *************** *** 2132,2159 **** PY_PROPERTY( "controlslots", controlSlots() ) ! if (name.left(6) == "skill.") { QString skill = name.right( name.length() - 6 ); INT16 skillId = Skills::instance()->findSkillByDef( skill ); ! if (skillId != -1) { ! return createPyObject(skillValue(skillId)); } // skillcap. ! } else if (name.left(9) == "skillcap.") { QString skill = name.right( name.length() - 9 ); INT16 skillId = Skills::instance()->findSkillByDef( skill ); ! if (skillId != -1) { ! return createPyObject(skillCap(skillId)); } ! } else { // See if there's a skill by that name INT16 skillId = Skills::instance()->findSkillByDef( name ); ! if (skillId != -1) { ! return createPyObject(skillValue(skillId)); } } ! return cUObject::getProperty(name); } --- 2141,2176 ---- PY_PROPERTY( "controlslots", controlSlots() ) ! if ( name.left( 6 ) == "skill." ) ! { QString skill = name.right( name.length() - 6 ); INT16 skillId = Skills::instance()->findSkillByDef( skill ); ! if ( skillId != -1 ) ! { ! return createPyObject( skillValue( skillId ) ); } // skillcap. ! } ! else if ( name.left( 9 ) == "skillcap." ) ! { QString skill = name.right( name.length() - 9 ); INT16 skillId = Skills::instance()->findSkillByDef( skill ); ! if ( skillId != -1 ) ! { ! return createPyObject( skillCap( skillId ) ); } ! } ! else ! { // See if there's a skill by that name INT16 skillId = Skills::instance()->findSkillByDef( name ); ! if ( skillId != -1 ) ! { ! return createPyObject( skillValue( skillId ) ); } } ! return cUObject::getProperty( name ); } *************** *** 2821,2825 **** // Will display the right color corpse->setTag( "notoriety", cVariant( notoriety( this ) ) ); ! corpse->setCharBaseid(baseid()); corpse->setOwner( this ); corpse->moveTo( pos_, true ); --- 2838,2842 ---- // Will display the right color corpse->setTag( "notoriety", cVariant( notoriety( this ) ) ); ! corpse->setCharBaseid( baseid() ); corpse->setOwner( this ); corpse->moveTo( pos_, true ); *************** *** 2828,2832 **** // stores the time and the murderer's name ! if ( pKiller ) { corpse->setMurderer( pKiller->serial() ); } --- 2845,2850 ---- // stores the time and the murderer's name ! if ( pKiller ) ! { corpse->setMurderer( pKiller->serial() ); } *************** *** 3177,3183 **** bool cBaseChar::sysmessage( const QString& message, unsigned short color, unsigned short font ) { ! Q_UNUSED(message); ! Q_UNUSED(color); ! Q_UNUSED(font); return false; } --- 3195,3201 ---- bool cBaseChar::sysmessage( const QString& message, unsigned short color, unsigned short font ) { ! Q_UNUSED( message ); ! Q_UNUSED( color ); ! Q_UNUSED( font ); return false; } *************** *** 3185,3192 **** bool cBaseChar::sysmessage( unsigned int message, const QString& params, unsigned short color, unsigned short font ) { ! Q_UNUSED(message); ! Q_UNUSED(params); ! Q_UNUSED(color); ! Q_UNUSED(font); return false; } --- 3203,3210 ---- bool cBaseChar::sysmessage( unsigned int message, const QString& params, unsigned short color, unsigned short font ) { ! Q_UNUSED( message ); ! Q_UNUSED( params ); ! Q_UNUSED( color ); ! Q_UNUSED( font ); return false; } *************** *** 3194,3202 **** bool cBaseChar::message( const QString& message, unsigned short color, cUObject* source, unsigned short font, unsigned char mode ) { ! Q_UNUSED(message); ! Q_UNUSED(color); ! Q_UNUSED(source); ! Q_UNUSED(font); ! Q_UNUSED(mode); return false; } --- 3212,3220 ---- bool cBaseChar::message( const QString& message, unsigned short color, cUObject* source, unsigned short font, unsigned char mode ) { ! Q_UNUSED( message ); ! Q_UNUSED( color ); ! Q_UNUSED( source ); ! Q_UNUSED( font ); ! Q_UNUSED( mode ); return false; } *************** *** 3204,3208 **** bool cBaseChar::send( cUOPacket* packet ) { ! Q_UNUSED(packet); return false; } --- 3222,3226 ---- bool cBaseChar::send( cUOPacket* packet ) { ! Q_UNUSED( packet ); return false; } *************** *** 3431,3437 **** } ! void cBaseChar::load(cBufferedReader &reader) { ! load(reader, reader.version()); ! World::instance()->registerObject(this); ! SectorMaps::instance()->add(this); } --- 3449,3456 ---- } ! void cBaseChar::load( cBufferedReader& reader ) ! { ! load( reader, reader.version() ); ! World::instance()->registerObject( this ); ! SectorMaps::instance()->add( this ); } Index: timers.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/timers.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** timers.cpp 9 Aug 2004 20:30:21 -0000 1.6 --- timers.cpp 10 Aug 2004 03:15:57 -0000 1.7 *************** *** 358,362 **** ( *i )->Dispel( pSource, silent ); ! eraselist.append(*i); } --- 358,362 ---- ( *i )->Dispel( pSource, silent ); ! eraselist.append( *i ); } Index: basics.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basics.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** basics.cpp 9 Aug 2004 20:30:21 -0000 1.31 --- basics.cpp 10 Aug 2004 03:15:56 -0000 1.32 *************** *** 187,215 **** // Swap the value in place ! inline void swapBytes(unsigned int &data) { ! data = ((data & 0xFF) << 24) | ((data & 0xFF00) << 8) | ((data & 0xFF0000) >> 8) | ((data & 0xFF000000) >> 24); } ! inline void swapBytes(double &value) { ! unsigned char *ptr = (unsigned char*)&value; ! std::swap(ptr[0], ptr[7]); ! std::swap(ptr[1], ptr[6]); [...1031 lines suppressed...] ! { return d->typemap; } ! unsigned int cBufferedReader::getSkipSize( unsigned char type ) ! { ! if ( !d->sizemap.contains( type ) ) ! { return 0; ! } ! else ! { return d->sizemap[type]; } } ! unsigned int cBufferedReader::objectCount() ! { return d->objectCount; } Index: definitions.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/definitions.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** definitions.cpp 4 Aug 2004 23:17:35 -0000 1.12 --- definitions.cpp 10 Aug 2004 03:15:56 -0000 1.13 *************** *** 66,93 **** stCategory categories[] = { ! { "item", WPDT_ITEM }, ! { "script", WPDT_SCRIPT }, ! { "npc", WPDT_NPC }, ! { "list", WPDT_LIST }, ! { "menu", WPDT_MENU }, ! { "spell", WPDT_SPELL }, ! { "acl", WPDT_PRIVLEVEL }, ! { "spawnregion", WPDT_SPAWNREGION }, ! { "region", WPDT_REGION }, ! { "multi", WPDT_MULTI }, ! { "text", WPDT_TEXT }, ! { "startitems", WPDT_STARTITEMS }, ! { "location", WPDT_LOCATION }, ! { "skill", WPDT_SKILL }, ! { "action", WPDT_ACTION }, ! { "make", WPDT_MAKESECTION }, ! { "makeitem", WPDT_MAKEITEM }, ! { "useitem", WPDT_USEITEM }, ! { "skillcheck", WPDT_SKILLCHECK }, ! { "define", WPDT_DEFINE }, ! { "resource", WPDT_RESOURCE }, ! { "contextmenu", WPDT_CONTEXTMENU }, ! { "ai", WPDT_AI }, ! { 0, WPDT_COUNT }, }; --- 66,93 ---- stCategory categories[] = { ! { "item", WPDT_ITEM }, ! { "script", WPDT_SCRIPT }, ! { "npc", WPDT_NPC }, ! { "list", WPDT_LIST }, ! { "menu", WPDT_MENU }, ! { "spell", WPDT_SPELL }, ! { "acl", WPDT_PRIVLEVEL }, ! { "spawnregion", WPDT_SPAWNREGION }, ! { "region", WPDT_REGION }, ! { "multi", WPDT_MULTI }, ! { "text", WPDT_TEXT }, ! { "startitems", WPDT_STARTITEMS }, ! { "location", WPDT_LOCATION }, ! { "skill", WPDT_SKILL }, ! { "action", WPDT_ACTION }, ! { "make", WPDT_MAKESECTION }, ! { "makeitem", WPDT_MAKEITEM }, ! { "useitem", WPDT_USEITEM }, ! { "skillcheck", WPDT_SKILLCHECK }, ! { "define", WPDT_DEFINE }, ! { "resource", WPDT_RESOURCE }, ! { "contextmenu", WPDT_CONTEXTMENU }, ! { "ai", WPDT_AI }, ! { 0, WPDT_COUNT }, }; *************** *** 729,741 **** PyTypeObject wpElementType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "element", ! sizeof( wpElementType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpElement_getAttr, ! 0, }; --- 729,741 ---- PyTypeObject wpElementType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "element", ! sizeof( wpElementType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpElement_getAttr, ! 0, }; *************** *** 828,832 **** static PyMethodDef methods[] = { ! {"hasattribute", ( getattrofunc ) wpElement_hasattribute, METH_VARARGS, 0}, {"getattribute", ( getattrofunc ) wpElement_getattribute, METH_VARARGS, 0}, {"findchild", ( getattrofunc ) wpElement_findchild, METH_VARARGS, 0}, {"getchild", ( getattrofunc ) wpElement_getchild, METH_VARARGS, 0}, {0, 0, 0, 0} }; --- 828,832 ---- static PyMethodDef methods[] = { ! {"hasattribute", ( getattrofunc ) wpElement_hasattribute, METH_VARARGS, 0}, {"getattribute", ( getattrofunc ) wpElement_getattribute, METH_VARARGS, 0}, {"findchild", ( getattrofunc ) wpElement_findchild, METH_VARARGS, 0}, {"getchild", ( getattrofunc ) wpElement_getchild, METH_VARARGS, 0}, {0, 0, 0, 0} }; Index: corpse.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/corpse.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** corpse.cpp 9 Aug 2004 20:30:21 -0000 1.61 --- corpse.cpp 10 Aug 2004 03:15:56 -0000 1.62 *************** *** 68,73 **** } ! void cCorpse::load(cBufferedReader &reader, unsigned int version) { ! cItem::load(reader, version); bodyId_ = reader.readShort(); hairStyle_ = reader.readShort(); --- 68,74 ---- } ! void cCorpse::load( cBufferedReader& reader, unsigned int version ) ! { ! cItem::load( reader, version ); bodyId_ = reader.readShort(); hairStyle_ = reader.readShort(); *************** *** 82,112 **** // Write a serial for every possible layer (fixed block size) unsigned char layer; ! for (layer = cBaseChar::SingleHandedWeapon; layer <= cBaseChar::Mount; ++layer) { SERIAL serial = reader.readInt(); ! if (serial != INVALID_SERIAL) { ! equipment_.insert(layer, serial); } } } ! void cCorpse::save(cBufferedWriter &writer, unsigned int version) { ! cItem::save(writer, version); ! writer.writeShort(bodyId_); ! writer.writeShort(hairStyle_); ! writer.writeShort(hairColor_); ! writer.writeShort(beardStyle_); ! writer.writeShort(beardColor_); ! writer.writeByte(direction_); ! writer.writeAscii(charbaseid_); ! writer.writeInt(murderer_); ! writer.writeInt(murdertime_); // Write a serial for every possible layer (fixed block size) unsigned char layer; ! for (layer = cBaseChar::SingleHandedWeapon; layer <= cBaseChar::Mount; ++layer) { ! if (equipment_.contains(layer)) { ! writer.writeInt(equipment_[layer]); ! } else { ! writer.writeInt(INVALID_SERIAL); } } --- 83,120 ---- // Write a serial for every possible layer (fixed block size) unsigned char layer; ! for ( layer = cBaseChar::SingleHandedWeapon; layer <= cBaseChar::Mount; ++layer ) ! { SERIAL serial = reader.readInt(); ! if ( serial != INVALID_SERIAL ) ! { ! equipment_.insert( layer, serial ); } } } ! void cCorpse::save( cBufferedWriter& writer, unsigned int version ) ! { ! cItem::save( writer, version ); ! writer.writeShort( bodyId_ ); ! writer.writeShort( hairStyle_ ); ! writer.writeShort( hairColor_ ); ! writer.writeShort( beardStyle_ ); ! writer.writeShort( beardColor_ ); ! writer.writeByte( direction_ ); ! writer.writeAscii( charbaseid_ ); ! writer.writeInt( murderer_ ); ! writer.writeInt( murdertime_ ); // Write a serial for every possible layer (fixed block size) unsigned char layer; ! for ( layer = cBaseChar::SingleHandedWeapon; layer <= cBaseChar::Mount; ++layer ) ! { ! if ( equipment_.contains( layer ) ) ! { ! writer.writeInt( equipment_[layer] ); ! } ! else ! { ! writer.writeInt( INVALID_SERIAL ); } } *************** *** 289,293 **** } ! equipment_.insert(layer, serial); } --- 297,301 ---- } ! equipment_.insert( layer, serial ); } *************** *** 306,310 **** direction_ = 0; id_ = 0x2006; ! setBaseid("2006"); } --- 314,318 ---- direction_ = 0; id_ = 0x2006; ! setBaseid( "2006" ); } *************** *** 317,357 **** SET_INT_PROPERTY( "bodyid", bodyId_ ) else ! /* ! \property item.hairstyle The id of the hairstyle displayed on the corpse. ! For no hair use 0. ! This property only exists for corpses. ! */ SET_INT_PROPERTY( "hairstyle", hairStyle_ ) else ! /* ! \property item.haircolor The color of the hair displayed on the corpse. ! This property only exists for corpses. ! */ SET_INT_PROPERTY( "haircolor", hairColor_ ) else ! /* ! \property item.beardstyle The id of the beardstyle displayed on the corpse. ! For no beard use 0. ! This property only exists for corpses. ! */ SET_INT_PROPERTY( "beardstyle", beardStyle_ ) else ! /* ! \property item.beardcolor The color of the beard displayed on the corpse. ! This property only exists for corpses. ! */ SET_INT_PROPERTY( "beardcolor", beardColor_ ) ! /* \property item.murderer The character who killed this creature. May be None if the character has been deleted or the owner of this corpse accidently died. This property only exists for corpses. ! */ ! else if (name == "murderer") { P_CHAR pChar = value.toChar(); ! if (pChar) { murderer_ = pChar->serial(); ! } else { murderer_ = INVALID_SERIAL; } --- 325,368 ---- SET_INT_PROPERTY( "bodyid", bodyId_ ) else ! /* ! \property item.hairstyle The id of the hairstyle displayed on the corpse. ! For no hair use 0. ! This property only exists for corpses. ! */ SET_INT_PROPERTY( "hairstyle", hairStyle_ ) else ! /* ! \property item.haircolor The color of the hair displayed on the corpse. ! This property only exists for corpses. ! */ SET_INT_PROPERTY( "haircolor", hairColor_ ) else ! /* ! \property item.beardstyle The id of the beardstyle displayed on the corpse. ! For no beard use 0. ! This property only exists for corpses. ! */ SET_INT_PROPERTY( "beardstyle", beardStyle_ ) else ! /* ! \property item.beardcolor The color of the beard displayed on the corpse. ! This property only exists for corpses. ! */ SET_INT_PROPERTY( "beardcolor", beardColor_ ) ! /* \property item.murderer The character who killed this creature. May be None if the character has been deleted or the owner of this corpse accidently died. This property only exists for corpses. ! */ ! else if ( name == "murderer" ) { P_CHAR pChar = value.toChar(); ! if ( pChar ) ! { murderer_ = pChar->serial(); ! } ! else ! { murderer_ = INVALID_SERIAL; } *************** *** 365,380 **** SET_INT_PROPERTY( "murdertime", murdertime_ ) ! /* \property item.direction The direction this corpse is facing. This property only exists for corpses. ! */ else SET_INT_PROPERTY( "direction", direction_ ) ! /* \property item.charbaseid The npc definition id of the murdererd creature. This is used to derive the carve section for this corpse. This property only exists for corpses. ! */ else SET_STR_PROPERTY( "charbaseid", charbaseid_ ) --- 376,391 ---- SET_INT_PROPERTY( "murdertime", murdertime_ ) ! /* \property item.direction The direction this corpse is facing. This property only exists for corpses. ! */ else SET_INT_PROPERTY( "direction", direction_ ) ! /* \property item.charbaseid The npc definition id of the murdererd creature. This is used to derive the carve section for this corpse. This property only exists for corpses. ! */ else SET_STR_PROPERTY( "charbaseid", charbaseid_ ) *************** *** 383,387 **** } ! PyObject* cCorpse::getProperty(const QString& name) { PY_PROPERTY( "bodyid", bodyId_ ) PY_PROPERTY( "hairstyle", hairStyle_ ) --- 394,399 ---- } ! PyObject* cCorpse::getProperty( const QString& name ) ! { PY_PROPERTY( "bodyid", bodyId_ ) PY_PROPERTY( "hairstyle", hairStyle_ ) *************** *** 389,397 **** PY_PROPERTY( "beardstyle", beardStyle_ ) PY_PROPERTY( "beardcolor", beardColor_ ) ! PY_PROPERTY( "murderer", FindCharBySerial(murderer_) ) PY_PROPERTY( "murdertime", murdertime_ ) PY_PROPERTY( "direction", direction_ ) PY_PROPERTY( "charbaseid", charbaseid_ ) ! return cItem::getProperty(name); } --- 401,409 ---- PY_PROPERTY( "beardstyle", beardStyle_ ) PY_PROPERTY( "beardcolor", beardColor_ ) ! PY_PROPERTY( "murderer", FindCharBySerial( murderer_ ) ) PY_PROPERTY( "murdertime", murdertime_ ) PY_PROPERTY( "direction", direction_ ) PY_PROPERTY( "charbaseid", charbaseid_ ) ! return cItem::getProperty( name ); } *************** *** 447,454 **** } ! unsigned int cCorpse::decayDelay() { unsigned int delay = cItem::decayDelay(); ! if (delay == 0) { return 0; } --- 459,468 ---- } ! unsigned int cCorpse::decayDelay() ! { unsigned int delay = cItem::decayDelay(); ! if ( delay == 0 ) ! { return 0; } Index: factory.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/factory.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** factory.h 19 Jun 2004 02:06:51 -0000 1.8 --- factory.h 10 Aug 2004 03:15:57 -0000 1.9 *************** *** 40,44 **** { public: ! virtual ~Factory() {} bool registerType( const keyType& id, productCreator creator ) { --- 40,46 ---- { public: ! virtual ~Factory() ! { ! } bool registerType( const keyType& id, productCreator creator ) { Index: coord.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/coord.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** coord.cpp 2 Jul 2004 06:01:15 -0000 1.49 --- coord.cpp 10 Aug 2004 03:15:56 -0000 1.50 *************** *** 454,485 **** /*another try, but i think its needed for all positions, not only start and end... ! //target ! if( (*pit).y == target.y ) ! { ! if( dz > 0 ) ! { ! zmax = QMIN( zmax, i ); ! //Console::instance()->send( QString( "TargetY, zmax:%1, i:%2\n" ).arg( zmax ).arg( i ) ); ! } ! else ! { ! zmin = QMAX( zmin, i+1 ); ! //Console::instance()->send( QString( "TargetY, zmin:%1, i:%2\n" ).arg( zmin ).arg( i ) ); ! } ! } ! //source ! if( (*pit).y == y ) ! { ! if( dz > 0 ) ! { ! zmin = QMAX( zmin, z ); ! //Console::instance()->send( QString( "SourceY, zmin:%1, i:%2\n" ).arg( zmax ).arg( i ) ); ! } ! else ! { ! zmax = QMIN( zmax, z ); ! //Console::instance()->send( QString( "SourceY, zmax:%1, i:%2\n" ).arg( zmax ).arg( i ) ); ! } ! }*/ if ( dz > 0 ) { --- 454,485 ---- /*another try, but i think its needed for all positions, not only start and end... ! //target ! if( (*pit).y == target.y ) ! { ! if( dz > 0 ) ! { ! zmax = QMIN( zmax, i ); ! //Console::instance()->send( QString( "TargetY, zmax:%1, i:%2\n" ).arg( zmax ).arg( i ) ); ! } ! else ! { ! zmin = QMAX( zmin, i+1 ); ! //Console::instance()->send( QString( "TargetY, zmin:%1, i:%2\n" ).arg( zmin ).arg( i ) ); ! } ! } ! //source ! if( (*pit).y == y ) ! { ! if( dz > 0 ) ! { ! zmin = QMAX( zmin, z ); ! //Console::instance()->send( QString( "SourceY, zmin:%1, i:%2\n" ).arg( zmax ).arg( i ) ); ! } ! else ! { ! zmax = QMIN( zmax, z ); ! //Console::instance()->send( QString( "SourceY, zmax:%1, i:%2\n" ).arg( zmax ).arg( i ) ); ! } ! }*/ if ( dz > 0 ) { *************** *** 624,639 **** /*SI08 zmin = (SI08)floor( i - dz*sqrt( ((double)target.x - (double)(*pit).x)*((double)target.x - (double)(*pit).x) + ((double)target.y - (double)(*pit).y)*((double)target.y - (double)(*pit).y) ) ); ! SI08 zmax; ! //Console::instance()->send( QString( "zmin:%1,dz:%2\n" ).arg( zmin ).arg( dz ) ); ! if( dz > 0 ) ! { ! zmin = QMAX( (SI08)floor( zmin - dz/2 ), z+1 ); ! zmax = QMIN( zmin + dz + 1, target.z+targetheight+1 ); //to prevent floor-mistakes ! } ! else ! { ! zmin = QMIN( (SI08)floor( zmin + dz/2 ), target.z+1 ); ! zmax = QMAX( zmin - dz + 1, z ); //to prevent floor-mistakes ! }*/ // Texture mapping --- 624,639 ---- /*SI08 zmin = (SI08)floor( i - dz*sqrt( ((double)target.x - (double)(*pit).x)*((double)target.x - (double)(*pit).x) + ((double)target.y - (double)(*pit).y)*((double)target.y - (double)(*pit).y) ) ); ! SI08 zmax; ! //Console::instance()->send( QString( "zmin:%1,dz:%2\n" ).arg( zmin ).arg( dz ) ); ! if( dz > 0 ) ! { ! zmin = QMAX( (SI08)floor( zmin - dz/2 ), z+1 ); ! zmax = QMIN( zmin + dz + 1, target.z+targetheight+1 ); //to prevent floor-mistakes ! } ! else ! { ! zmin = QMIN( (SI08)floor( zmin + dz/2 ), target.z+1 ); ! zmax = QMAX( zmin - dz + 1, z ); //to prevent floor-mistakes ! }*/ // Texture mapping *************** *** 657,662 **** //in this case, both dont cut our line, but the mapconnection between them //should do ! if ( ( ( map1.z < map2.z ) && ( map1.z < zmin ) && ( map2.z > zmax + dz ) ) || // 1) lineofsight collides with a map "wall" ! ( ( map1.z > map2.z ) && ( map1.z > zmin ) && ( map2.z < zmax - dz ) ) || ( ( ( map1.id >= 431 && map1.id <= 432 ) || // 3) lineofsight cuts a mountain ( map1.id >= 467 && map1.id <= 475 ) || ( map1.id >= 543 && map1.id <= 560 ) || ( map1.id >= 1754 && map1.id <= 1757 ) || ( map1.id >= 1787 && map1.id <= 1789 ) || ( map1.id >= 1821 && map1.id <= 1824 ) || ( map1.id >= 1851 && map1.id <= 1854 ) || ( map1.id >= 1881 && map1.id <= 1884 ) ) && ( posHigherThanMap ) && ( msi.atEnd() ) ) ) // mountains cut only if we are not beneath them { --- 657,662 ---- //in this case, both dont cut our line, but the mapconnection between them //should do ! if ( ( ( map1.z < map2.z ) && ( map1.z < zmin ) && ( map2.z > zmax + dz ) ) || // 1) lineofsight collides with a map "wall" ! ( ( map1.z > map2.z ) && ( map1.z > zmin ) && ( map2.z < zmax - dz ) ) || ( ( ( map1.id >= 431 && map1.id <= 432 ) || // 3) lineofsight cuts a mountain ( map1.id >= 467 && map1.id <= 475 ) || ( map1.id >= 543 && map1.id <= 560 ) || ( map1.id >= 1754 && map1.id <= 1757 ) || ( map1.id >= 1787 && map1.id <= 1789 ) || ( map1.id >= 1821 && map1.id <= 1824 ) || ( map1.id >= 1851 && map1.id <= 1854 ) || ( map1.id >= 1881 && map1.id <= 1884 ) ) && ( posHigherThanMap ) && ( msi.atEnd() ) ) ) // mountains cut only if we are not beneath them { *************** *** 1218,1222 **** //should do land_st tile = TileCache::instance()->getLand( map1.id ); ! if ( ( ( map1.z < map2.z ) && ( map1.z < zmin ) && ( map2.z > zmax + dz_down ) && !targetpos ) || // 1) lineofsight collides with a map "wall" ( ( map1.z > map2.z ) && ( map1.z > zmin ) && ( map2.z < zmin + dz_down ) && !targetpos ) || ( tile.isBlocking() && posHigherThanMap && msi.atEnd() && rj.atEnd() ) ) { --- 1218,1222 ---- //should do land_st tile = TileCache::instance()->getLand( map1.id ); ! if ( ( ( map1.z < map2.z ) && ( map1.z < zmin ) && ( map2.z > zmax + dz_down ) && !targetpos ) || // 1) lineofsight collides with a map "wall" ( ( map1.z > map2.z ) && ( map1.z > zmin ) && ( map2.z < zmin + dz_down ) && !targetpos ) || ( tile.isBlocking() && posHigherThanMap && msi.atEnd() && rj.atEnd() ) ) { Index: dbdriver.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/dbdriver.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** dbdriver.cpp 20 Jul 2004 04:40:51 -0000 1.38 --- dbdriver.cpp 10 Aug 2004 03:15:56 -0000 1.39 *************** *** 189,201 **** PyTypeObject wpDbResultType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "dbresult", ! sizeof( wpDbResultType ), ! 0, ! wpDeallocDbResult, ! 0, ! ( getattrfunc ) wpDbResult_getAttr, ! 0, }; --- 189,201 ---- PyTypeObject wpDbResultType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "dbresult", ! sizeof( wpDbResultType ), ! 0, ! wpDeallocDbResult, ! 0, ! ( getattrfunc ) wpDbResult_getAttr, ! 0, }; *************** *** 269,273 **** static PyMethodDef wpDbResultMethods[] = { ! {"free", ( getattrofunc ) wpDbResult_free, METH_VARARGS, 0}, {"fetchrow", ( getattrofunc ) wpDbResult_fetchrow, METH_VARARGS, 0}, {"getint", ( getattrofunc ) wpDbResult_getint, METH_VARARGS, 0}, {"getstring", ( getattrofunc ) wpDbResult_getstring, METH_VARARGS, 0}, {0, 0, 0, 0} }; --- 269,273 ---- static PyMethodDef wpDbResultMethods[] = { ! {"free", ( getattrofunc ) wpDbResult_free, METH_VARARGS, 0}, {"fetchrow", ( getattrofunc ) wpDbResult_fetchrow, METH_VARARGS, 0}, {"getint", ( getattrofunc ) wpDbResult_getint, METH_VARARGS, 0}, {"getstring", ( getattrofunc ) wpDbResult_getstring, METH_VARARGS, 0}, {0, 0, 0, 0} }; Index: party.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/party.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** party.cpp 20 Jul 2004 04:40:51 -0000 1.15 --- party.cpp 10 Aug 2004 03:15:57 -0000 1.16 *************** *** 456,470 **** PyTypeObject wpPartyType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "party", ! sizeof( wpPartyType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpParty_getAttr, ! ( setattrfunc ) wpParty_setAttr, ! wpParty_compare, ! 0, }; --- 456,470 ---- PyTypeObject wpPartyType = { ! PyObject_HEAD_INIT( NULL ) ! 0, ! "party", ! sizeof( wpPartyType ), ! 0, ! wpDealloc, ! 0, ! ( getattrfunc ) wpParty_getAttr, ! ( setattrfunc ) wpParty_setAttr, ! wpParty_compare, ! 0, }; *************** *** 533,537 **** static PyMethodDef wpPartyMethods[] = { ! { "tellall", ( getattrofunc ) wpParty_tellall, METH_VARARGS, 0 }, { "tellsingle", ( getattrofunc ) wpParty_tellsingle, METH_VARARGS, 0 }, { 0, 0, 0, 0 } }; --- 533,537 ---- static PyMethodDef wpPartyMethods[] = { ! { "tellall", ( getattrofunc ) wpParty_tellall, METH_VARARGS, 0 }, { "tellsingle", ( getattrofunc ) wpParty_tellsingle, METH_VARARGS, 0 }, { 0, 0, 0, 0 } }; *************** *** 586,592 **** static int wpParty_setAttr( wpParty* self, char* name, PyObject* value ) { ! Q_UNUSED(self); ! Q_UNUSED(name); ! Q_UNUSED(value); return 0; } --- 586,592 ---- static int wpParty_setAttr( wpParty* self, char* name, PyObject* value ) { ! Q_UNUSED( self ); ! Q_UNUSED( name ); ! Q_UNUSED( value ); return 0; } Index: corpse.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/corpse.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** corpse.h 9 Aug 2004 20:30:21 -0000 1.26 --- corpse.h 10 Aug 2004 03:15:56 -0000 1.27 *************** *** 62,80 **** // they're displayed as equipment public: ! unsigned char getClassid() { return cCorpse::classid; } ! cCorpse(bool init = false); ! void setBodyId(UINT16 data); ! void setHairStyle(UINT16 data); ! void setHairColor(UINT16 data); ! void setBeardStyle(UINT16 data); ! void setBeardColor(UINT16 data); ! void setMurderer(SERIAL data); ! void setMurderTime(uint data); ! void setDirection(unsigned char data); ! void setCharBaseid(const QCString &data); bool corpse() const { --- 62,81 ---- // they're displayed as equipment public: ! unsigned char getClassid() ! { return cCorpse::classid; } ! cCorpse( bool init = false ); ! void setBodyId( UINT16 data ); ! void setHairStyle( UINT16 data ); ! void setHairColor( UINT16 data ); ! void setBeardStyle( UINT16 data ); ! void setBeardColor( UINT16 data ); ! void setMurderer( SERIAL data ); ! void setMurderTime( uint data ); ! void setDirection( unsigned char data ); ! void setCharBaseid( const QCString& data ); bool corpse() const { *************** *** 90,94 **** UINT16 beardColor() const; unsigned char direction() const; ! const QCString &charBaseid() const; SERIAL murderer() const; unsigned int murderTime() const; --- 91,95 ---- UINT16 beardColor() const; unsigned char direction() const; ! const QCString& charBaseid() const; SERIAL murderer() const; unsigned int murderTime() const; *************** *** 112,117 **** void save(); bool del(); ! void load(cBufferedReader &reader, unsigned int version); ! void save(cBufferedWriter &reader, unsigned int version); // abstract cDefinable --- 113,118 ---- void save(); bool del(); ! void load( cBufferedReader& reader, unsigned int version ); ! void save( cBufferedWriter& reader, unsigned int version ); // abstract cDefinable *************** *** 122,126 **** virtual stError* setProperty( const QString& name, const cVariant& value ); ! PyObject* getProperty(const QString& name); void createTooltip( cUOTxTooltipList& tooltip, cPlayer* player ); }; --- 123,127 ---- virtual stError* setProperty( const QString& name, const cVariant& value ); ! PyObject* getProperty( const QString& name ); void createTooltip( cUOTxTooltipList& tooltip, cPlayer* player ); }; *************** *** 162,171 **** } ! inline void cCorpse::setDirection(unsigned char data) { direction_ = data; } ! inline void cCorpse::setCharBaseid(const QCString &baseid) { charbaseid_ = baseid; --- 163,172 ---- } ! inline void cCorpse::setDirection( unsigned char data ) { direction_ = data; } ! inline void cCorpse::setCharBaseid( const QCString& baseid ) { charbaseid_ = baseid; *************** *** 197,201 **** } ! inline const QCString &cCorpse::charBaseid() const { return charbaseid_; --- 198,202 ---- } ! inline const QCString& cCorpse::charBaseid() const { return charbaseid_; Index: player.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/player.h,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** player.h 9 Aug 2004 20:30:21 -0000 1.52 --- player.h 10 Aug 2004 03:15:57 -0000 1.53 *************** *** 75,81 **** void save(); bool del(); ! void load(cBufferedReader &reader, unsigned int version); ! void save(cBufferedWriter &writer, unsigned int version); ! void load(cBufferedReader &reader); virtual bool send( cUOPacket* packet ); --- 75,81 ---- void save(); bool del(); ! void load( cBufferedReader& reader, unsigned int version ); ! void save( cBufferedWriter& writer, unsigned int version ); ! void load( cBufferedReader& reader ); virtual bool send( cUOPacket* packet ); *************** *** 101,105 **** // other public methods virtual stError* setProperty( const QString& name, const cVariant& value ); ! PyObject *getProperty(const QString& name); void turnTo( cUObject* object ); // override void turnTo( const Coord_cl& data ); // override --- 101,105 ---- // other public methods virtual stError* setProperty( const QString& name, const cVariant& value ); ! PyObject* getProperty( const QString& name ); void turnTo( cUObject* object ); // override void turnTo( const Coord_cl& data ); // override *************** *** 203,207 **** const char* className() const; ! unsigned char getClassid() { return cPlayer::classid; } --- 203,208 ---- const char* className() const; ! unsigned char getClassid() ! { return cPlayer::classid; } Index: walking.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/walking.cpp,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** walking.cpp 6 Aug 2004 22:27:02 -0000 1.131 --- walking.cpp 10 Aug 2004 03:15:57 -0000 1.132 *************** *** 121,126 **** bool checkWalkable( P_CHAR pChar, UINT16 tileId ) { ! Q_UNUSED(pChar); ! Q_UNUSED(tileId); return false; } --- 121,126 ---- bool checkWalkable( P_CHAR pChar, UINT16 tileId ) { ! Q_UNUSED( pChar ); ! Q_UNUSED( tileId ); return false; } Index: pythonscript.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/pythonscript.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** pythonscript.cpp 27 Jul 2004 04:15:20 -0000 1.44 --- pythonscript.cpp 10 Aug 2004 03:15:57 -0000 1.45 *************** *** 43,513 **** static char* eventNames[] = { ! /* ! \event onUse ! \param player The player who used the item. ! \param item The item that was used. ! \return Return 1 if your function should handle the event. If you return 0, ! the server will try to process the event internally or call other scripts. ! \condition Triggered when a player doubleclicks an item. ! \notes This event is called for the character first and then for the item. [...1032 lines suppressed...] ! bool cPythonScriptable::convertPyObject( PyObject* object, QCString& string ) ! { return false; } ! bool cPythonScriptable::convertPyObject( PyObject* object, unsigned int& data ) ! { return false; } ! bool cPythonScriptable::convertPyObject( PyObject* object, int& data ) ! { return false; } ! bool cPythonScriptable::setPropety( const QString& name, PyObject* value ) ! { return true; } Index: npc.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/npc.h,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** npc.h 9 Aug 2004 20:30:21 -0000 1.53 --- npc.h 10 Aug 2004 03:15:57 -0000 1.54 *************** *** 91,98 **** void save(); bool del(); ! void load(cBufferedReader &reader, unsigned int version); ! void save(cBufferedWriter &writer, unsigned int version); ! void postload(unsigned int version); ! void load(cBufferedReader &reader); virtual enCharTypes objectType(); --- 91,98 ---- void save(); bool del(); ! void load( cBufferedReader& reader, unsigned int version ); ! void save( cBufferedWriter& writer, unsigned int version ); ! void postload( unsigned int version ); ! void load( cBufferedReader& reader ); virtual enCharTypes objectType(); *************** *** 125,129 **** // other public methods virtual stError* setProperty( const QString& name, const cVariant& value ); ! PyObject *getProperty(const QString &name); void setNextMoveTime( void ); virtual void callGuards(); // overriding --- 125,129 ---- // other public methods virtual stError* setProperty( const QString& name, const cVariant& value ); ! PyObject* getProperty( const QString& name ); void setNextMoveTime( void ); virtual void callGuards(); // overriding *************** *** 197,201 **** const char* className() const; ! unsigned char getClassid() { return cNPC::classid; } --- 197,202 ---- const char* className() const; ! unsigned char getClassid() ! { return cNPC::classid; } Index: speech.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/speech.cpp,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -d -r1.182 -r1.183 *** speech.cpp 4 Aug 2004 23:17:36 -0000 1.182 --- speech.cpp 10 Aug 2004 03:15:57 -0000 1.183 *************** *** 269,273 **** PyList_SetItem( pkeywords, i, PyInt_FromLong( keywords[i] ) ); ! PyObject* args = Py_BuildValue( "(NNNO)", pNpc->getPyObject(), pPlayer->getPyObject(), QString2Python(comm), pkeywords ); bool result = cPythonScript::callChainedEventHandler( EVENT_SPEECH, events, args ); --- 269,273 ---- PyList_SetItem( pkeywords, i, PyInt_FromLong( keywords[i] ) ); ! PyObject* args = Py_BuildValue( "(NNNO)", pNpc->getPyObject(), pPlayer->getPyObject(), QString2Python( comm ), pkeywords ); bool result = cPythonScript::callChainedEventHandler( EVENT_SPEECH, events, args ); *************** *** 339,343 **** UINT16 keyword = *iter; ! if (keyword == 0x07) pChar->callGuards(); } --- 339,343 ---- UINT16 keyword = *iter; ! if ( keyword == 0x07 ) pChar->callGuards(); } Index: player.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** player.cpp 9 Aug 2004 20:30:21 -0000 1.116 --- player.cpp 10 Aug 2004 03:15:57 -0000 1.117 *************** *** 113,126 **** static void playerRegisterAfterLoading( P_PLAYER pc ); ! void cPlayer::load(cBufferedReader &reader) { ! load(reader, reader.version()); ! World::instance()->registerObject(this); ! SectorMaps::instance()->add(this); } ! void cPlayer::load(cBufferedReader &reader, unsigned int version) { ! cBaseChar::load(reader, version); ! setAccount(Accounts::instance()->getRecord(reader.readUtf8())); additionalFlags_ = reader.readInt(); visualRange_ = reader.readByte(); --- 113,128 ---- static void playerRegisterAfterLoading( P_PLAYER pc ); ! void cPlayer::load( cBufferedReader& reader ) ! { ! load( reader, reader.version() ); ! World::instance()->registerObject( this ); ! SectorMaps::instance()->add( this ); } ! void cPlayer::load( cBufferedReader& reader, unsigned int version ) ! { ! cBaseChar::load( reader, version ); ! setAccount( Accounts::instance()->getRecord( reader.readUtf8() ) ); additionalFlags_ = reader.readInt(); visualRange_ = reader.readByte(); *************** *** 132,145 **** } ! void cPlayer::save(cBufferedWriter &writer, unsigned int version) { ! cBaseChar::save(writer, version); ! writer.writeUtf8(account_ ? account_->login() : QString::null); ! writer.writeInt(additionalFlags_); ! writer.writeByte(visualRange_); ! writer.writeUtf8(profile_); ! writer.writeByte(fixedLightLevel_); ! writer.writeByte(strengthLock_); ! writer.writeByte(dexterityLock_); ! writer.writeByte(intelligenceLock_); } --- 134,148 ---- } ! void cPlayer::save( cBufferedWriter& writer, unsigned int version ) ! { ! cBaseChar::save( writer, version ); ! writer.writeUtf8( account_ ? account_->login() : QString::null ); ! writer.writeInt( additionalFlags_ ); ! writer.writeByte( visualRange_ ); ! writer.writeUtf8( profile_ ); ! writer.writeByte( fixedLightLevel_ ); ! writer.writeByte( strengthLock_ ); ! writer.writeByte( dexterityLock_ ); ! writer.writeByte( intelligenceLock_ ); } *************** *** 276,280 **** // Send equipment tooltips to other players as well ! for ( ItemContainer::const_iterator it(content_.begin()); it != content_.end(); ++it ) { it.data()->sendTooltip( socket ); --- 279,283 ---- // Send equipment tooltips to other players as well ! for ( ItemContainer::const_iterator it( content_.begin() ); it != content_.end(); ++it ) { it.data()->sendTooltip( socket ); *************** *** 291,295 **** void cPlayer::talk( const QString& message, UI16 color, UINT8 type, bool autospam, cUOSocket* socket ) { ! Q_UNUSED(autospam); if ( color == 0xFFFF ) color = saycolor_; --- 294,298 ---- void cPlayer::talk( const QString& message, UI16 color, UINT8 type, bool autospam, cUOSocket* socket ) { ! Q_UNUSED( autospam ); if ( color == 0xFFFF ) color = saycolor_; *************** *** 603,607 **** charName.prepend( gender_ ? tr( "Lady " ) : tr( "Lord " ) ); ! QString affix(""); if ( !isIncognito() && guild_ && !guild_->abbreviation().isEmpty() ) --- 606,610 ---- charName.prepend( gender_ ? tr( "Lady " ) : tr( "Lord " ) ); ! QString affix( "" ); if ( !isIncognito() && guild_ && !guild_->abbreviation().isEmpty() ) *************** *** 1260,1265 **** } ! PyObject *cPlayer::getProperty(const QString& name) { ! PY_PROPERTY("account", account_) /* \rproperty controlslots The amount of controlslots currently used for this --- 1263,1269 ---- } ! PyObject* cPlayer::getProperty( const QString& name ) ! { ! PY_PROPERTY( "account", account_ ) /* \rproperty controlslots The amount of controlslots currently used for this *************** *** 1267,1275 **** This property is only available for player objects. */ ! PY_PROPERTY( "controlslots", controlslots() ) ! PY_PROPERTY( "logouttime", logoutTime_ ) PY_PROPERTY( "npc", false ) PY_PROPERTY( "lightbonus", fixedLightLevel_ ) ! PY_PROPERTY( "objectdelay", objectDelay_ ) PY_PROPERTY( "visrange", visualRange_ ) PY_PROPERTY( "profile", profile_ ) --- 1271,1279 ---- This property is only available for player objects. */ ! PY_PROPERTY( "controlslots", controlslots() ) ! PY_PROPERTY( "logouttime", logoutTime_ ) PY_PROPERTY( "npc", false ) PY_PROPERTY( "lightbonus", fixedLightLevel_ ) ! PY_PROPERTY( "objectdelay", objectDelay_ ) PY_PROPERTY( "visrange", visualRange_ ) PY_PROPERTY( "profile", profile_ ) *************** *** 1277,1281 **** PY_PROPERTY( "dexteritylock", dexterityLock_ ) PY_PROPERTY( "intelligencelock", intelligenceLock_ ) ! return cBaseChar::getProperty(name); } --- 1281,1285 ---- PY_PROPERTY( "dexteritylock", dexterityLock_ ) PY_PROPERTY( "intelligencelock", intelligenceLock_ ) ! return cBaseChar::getProperty( name ); } *************** *** 1652,1656 **** cUObject::createTooltip( tooltip, player ); ! QString affix(" "); // Append the (frozen) tag --- 1656,1660 ---- cUObject::createTooltip( tooltip, player ); ! QString affix( " " ); // Append the (frozen) tag Index: guilds.h ==========================================... [truncated message content] |
From: Richard M. <dr...@us...> - 2004-08-10 02:00:24
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7948 Modified Files: ChangeLog Log Message: Updates Index: ChangeLog =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ChangeLog 5 Aug 2004 21:21:15 -0000 1.3 --- ChangeLog 10 Aug 2004 02:00:16 -0000 1.4 *************** *** 27,30 **** --- 27,31 ---- - New Windows Release builds should now include MySQL support by default. - Added some additional checking to wolfpack.pro + - Began binary save feature (Incomplete) Wolfpack 12.9.7 Beta (4. July 2004) |
From: Richard M. <dr...@us...> - 2004-08-10 01:59:53
|
Update of /cvsroot/wpdev/xmlscripts/documentation/webroot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7734/documentation/webroot Modified Files: ChangeLog.wolfpack Log Message: Updates Index: ChangeLog.wolfpack =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/documentation/webroot/ChangeLog.wolfpack,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ChangeLog.wolfpack 4 Aug 2004 22:47:22 -0000 1.37 --- ChangeLog.wolfpack 10 Aug 2004 01:59:45 -0000 1.38 *************** *** 29,32 **** --- 29,34 ---- - Property item.magic is now item.movable - (Configurable) Speedhack Countermeasure (See Anti Speed Hack settings in the General group) + - Added some additional checking to wolfpack.pro + - Began binary save feature (Incomplete) * Definition Changes: - Fixed Sheep definitions *************** *** 40,43 **** --- 42,46 ---- - Added trashcan - Inscription Added + - Controlslot values added to many NPCs related to taming. * Python Script Changes: - New Function: wolfpack.findobject(serial) *************** *** 88,91 **** --- 91,95 ---- The effective circle for measuring the skill requirement is lowered by two when casting from a scroll. + - Fixes for controlslots with summon spells. * Misc. Changes: - New Features: |
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17873 Modified Files: basechar.cpp basechar.h basics.cpp basics.h corpse.cpp corpse.h customtags.cpp customtags.h items.cpp items.h multi.cpp multi.h npc.cpp npc.h player.cpp player.h server.cpp timers.cpp uobject.cpp uobject.h wolfpack.vcproj world.cpp world.h Log Message: Incomplete Binary Save Driver Index: world.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/world.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** world.h 27 Jul 2004 06:35:22 -0000 1.16 --- world.h 9 Aug 2004 20:30:22 -0000 1.17 *************** *** 37,40 **** --- 37,42 ---- #include "server.h" + class cBufferedReader; + class cCharIterator { *************** *** 75,78 **** --- 77,81 ---- SERIAL _lastCharSerial, _lastItemSerial; unsigned int _playerCount, _npcCount; + void loadTag(cBufferedReader &reader, unsigned int version); public: Index: uobject.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/uobject.cpp,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** uobject.cpp 7 Aug 2004 15:52:12 -0000 1.170 --- uobject.cpp 9 Aug 2004 20:30:22 -0000 1.171 *************** *** 152,157 **** Performs persistency layer loads. */ ! void cUObject::load( char** result, UINT16& offset ) ! { name_ = ( result[offset] == 0 ) ? QString::null : QString::fromUtf8( result[offset] ); offset++; --- 152,156 ---- Performs persistency layer loads. */ ! void cUObject::load(char** result, UINT16& offset) { name_ = ( result[offset] == 0 ) ? QString::null : QString::fromUtf8( result[offset] ); offset++; *************** *** 223,226 **** --- 222,247 ---- } + void cUObject::save(cBufferedWriter &writer, unsigned int version) { + writer.writeUtf8(name_); + writer.writeInt(serial_); + writer.writeInt(multi_ ? multi_->serial() : INVALID_SERIAL); + writer.writeShort(pos_.x); + writer.writeShort(pos_.y); + writer.writeByte(pos_.z); + writer.writeByte(pos_.map); + writer.writeUtf8(eventList()); + } + + void cUObject::load(cBufferedReader &reader, unsigned int version) { + name_ = reader.readUtf8(); + serial_ = reader.readInt(); + setMulti(dynamic_cast<cMulti*>(World::instance()->findItem(reader.readInt()))); + pos_.x = reader.readShort(); + pos_.y = reader.readShort(); + pos_.z = reader.readByte(); + pos_.map = reader.readByte(); + setEventList(reader.readUtf8()); + } + /*! Performs persistency layer deletion. *************** *** 1038,1039 **** --- 1059,1073 ---- } } + + void cUObject::save(cBufferedWriter &writer) { + writer.setObjectCount(writer.objectCount() + 1); + writer.writeByte(getClassid()); + + unsigned int length = writer.position(); + save(writer, writer.version()); + length = writer.position() - length; + writer.setSkipSize(getClassid(), length); + + // Save tags for this object + tags_.save(serial_, writer); + } Index: uobject.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/uobject.h,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** uobject.h 20 Jul 2004 11:35:37 -0000 1.100 --- uobject.h 9 Aug 2004 20:30:22 -0000 1.101 *************** *** 29,32 **** --- 29,33 ---- #define __UOBJECT_H__ + #include "exceptions.h" #include "platform.h" #include "typedefs.h" *************** *** 59,62 **** --- 60,66 ---- class cMulti; + class cBufferedReader; + class cBufferedWriter; + #pragma pack(1) class cUObject : public PersistentObject, public cDefinable, public cPythonScriptable *************** *** 124,127 **** --- 128,140 ---- bool del(); + // Wrapper + virtual void load(cBufferedReader &reader) = 0; + virtual void save(cBufferedWriter &reader); + + // "Real" ones + virtual void load(cBufferedReader &reader, unsigned int version); + virtual void save(cBufferedWriter &reader, unsigned int version); + virtual void postload(unsigned int version) = 0; + // Utility Methods void effect( UINT16 id, UINT8 speed = 10, UINT8 duration = 5, UINT16 hue = 0, UINT16 renderMode = 0 ); // Moving with this character *************** *** 163,166 **** --- 176,180 ---- // Getter Methods virtual QCString bindmenu() = 0; + virtual unsigned char getClassid() = 0; QString name() const *************** *** 227,234 **** { public: ! void registerSqlQuery( const QString& type, const QString& query ) ! { sql_queries.insert( std::make_pair( type, query ) ); sql_keys.push_back( type ); } --- 241,258 ---- { public: ! cUObjectFactory() { ! lastid = 0; ! } ! ! unsigned int registerSqlQuery( const QString& type, const QString& query ) { sql_queries.insert( std::make_pair( type, query ) ); sql_keys.push_back( type ); + + if (lastid + 1 < lastid) { + throw wpException("Only 256 types can be registered with the UObject factory."); + } + + typemap.insert(lastid, type); + return lastid++; } *************** *** 248,254 **** --- 272,284 ---- } + const QMap<unsigned char, QString> &getTypemap() { + return typemap; + } + private: std::map<QString, QString> sql_queries; + QMap<unsigned char, QString> typemap; QStringList sql_keys; + unsigned char lastid; }; Index: timers.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/timers.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** timers.cpp 4 Aug 2004 23:17:37 -0000 1.5 --- timers.cpp 9 Aug 2004 20:30:21 -0000 1.6 *************** *** 345,348 **** --- 345,349 ---- } + QPtrList<cTimer> eraselist; std::vector<cTimer*>::iterator i = teffects.begin(); for ( i = teffects.begin(); i != teffects.end(); i++ ) *************** *** 357,364 **** ( *i )->Dispel( pSource, silent ); ! teffects.erase( i ); } ! std::make_heap( teffects.begin(), teffects.end(), cTimers::ComparePredicate() ); } --- 358,368 ---- ( *i )->Dispel( pSource, silent ); ! eraselist.append(*i); } ! for ( cTimer*effect = eraselist.first(); effect; effect = eraselist.next() ) ! { ! erase( effect ); ! } } Index: basics.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basics.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** basics.cpp 2 Jun 2004 15:04:03 -0000 1.30 --- basics.cpp 9 Aug 2004 20:30:21 -0000 1.31 *************** *** 29,39 **** --- 29,44 ---- #include "basics.h" #include "coord.h" + #include "exceptions.h" + #include "uobject.h" // Library Includes #include <qstring.h> #include <qstringlist.h> + #include <qfile.h> #include <math.h> #include <stdlib.h> + #include <cstdio> + #include <algorithm> #if defined( Q_OS_WIN32 ) *************** *** 180,181 **** --- 185,689 ---- return getPlatformTime() - startTime; } + + // Swap the value in place + inline void swapBytes(unsigned int &data) { + data = ((data & 0xFF) << 24) | ((data & 0xFF00) << 8) | ((data & 0xFF0000) >> 8) | ((data & 0xFF000000) >> 24); + } + + inline void swapBytes(double &value) { + unsigned char *ptr = (unsigned char*)&value; + std::swap(ptr[0], ptr[7]); + std::swap(ptr[1], ptr[6]); + std::swap(ptr[2], ptr[5]); + std::swap(ptr[3], ptr[4]); + } + + inline void swapBytes(int &data) { + data = ((data & 0xFF) << 24) | ((data & 0xFF00) << 8) | ((data & 0xFF0000) >> 8) | ((data & 0xFF000000) >> 24); + } + + inline void swapBytes(unsigned short &data) { + data = ((data & 0xFF00) >> 8) | ((data & 0xFF) << 8); + } + + inline void swapBytes(short &data) { + data = ((data & 0xFF00) >> 8) | ((data & 0xFF) << 8); + } + + class cBufferedWriterPrivate { + public: + QFile file; + unsigned int version; + QCString magic; + bool needswap; + QByteArray buffer; + unsigned int bufferpos; + QMap<QCString, unsigned int> dictionary; + QMap<unsigned char, unsigned int> skipmap; + QMap<unsigned char, QString> typemap; + unsigned int lastStringId; + unsigned int objectCount; + }; + + #define BUFFERSIZE 4096 + + cBufferedWriter::cBufferedWriter(const QCString &magic, unsigned int version) { + d = new cBufferedWriterPrivate; + d->version = version; + d->magic = magic; + d->buffer.resize(BUFFERSIZE); + d->bufferpos = 0; + d->lastStringId = 0; + d->objectCount = 0; + d->dictionary.insert(QCString(), 0); // Empty String + + // Check Endianess + int wordSize; + qSysInfo(&wordSize, &d->needswap); + } + + cBufferedWriter::~cBufferedWriter() { + close(); + delete d; + } + + void cBufferedWriter::setObjectCount(unsigned int count) { + d->objectCount = count; + } + + unsigned int cBufferedWriter::objectCount() { + return d->objectCount; + } + + void cBufferedWriter::open(const QString &filename) { + close(); + + d->file.setName(filename); + if (!d->file.open(IO_Raw|IO_WriteOnly|IO_Truncate)) { + throw wpException(QString("Couldn't open file %1 for writing.").arg(filename)); + } + + // Reserve space for magic, filesize, version, dictionary offset, objectcount (in that order) + unsigned int headerSize = d->magic.length() + 1 + sizeof(unsigned int) * 4; + + QByteArray header(headerSize); + d->file.writeBlock(header); + + // Start writing the object type list + const QMap<unsigned char, QString> &typemap = UObjectFactory::instance()->getTypemap(); + QMap<unsigned char, QString>::const_iterator it; + + d->skipmap.clear(); + writeByte(typemap.size()); + for (it = typemap.begin(); it != typemap.end(); ++it) { + writeByte(it.key()); + writeInt(0); // SkipSize + writeAscii(it.data().latin1()); // Preinsert into the dictionary + d->skipmap.insert(it.key(), 0); + d->typemap.insert(it.key(), it.data()); + } + } + + void cBufferedWriter::close() { + if (d->file.isOpen()) { + unsigned int dictionary = position(); + + // Flush the string dictionary at the end of the save + writeInt(d->dictionary.count()); + + QMap<QCString, unsigned int>::iterator it; + for (it = d->dictionary.begin(); it != d->dictionary.end(); ++it) { + writeInt(it.data()); + writeInt(it.key().length() + 1); // Counted Strings + if (it.key().data() == 0) { + writeByte(0); + } else { + writeRaw(it.key().data(), it.key().length() + 1); + } + } + + flush(); + + // Seek to the beginning and write the file header + d->file.at(0); + writeRaw(d->magic.data(), d->magic.length() + 1, true); + writeInt(d->file.size(), true); + writeInt(d->version, true); + writeInt(dictionary, true); + writeInt(d->objectCount, true); + + // Write new object type table + QMap<unsigned char, QString>::const_iterator tit; + + writeByte(d->typemap.size(), true); + for (tit = d->typemap.begin(); tit != d->typemap.end(); ++tit) { + writeByte(tit.key(), true); + + unsigned int size = 0; + if (d->skipmap.contains(tit.key())) { + size = d->skipmap[tit.key()]; + } + + writeInt(size, true); // SkipSize + + QCString type = tit.data().latin1(); + writeInt(d->dictionary[type], true); + } + + d->file.close(); + } + } + + void cBufferedWriter::writeInt(unsigned int data, bool unbuffered) { + // Inplace Swapping (data is a copy anyway) + if (d->needswap) { + swapBytes(data); + } + + writeRaw(&data, sizeof(data), unbuffered); + } + + void cBufferedWriter::writeShort(unsigned short data, bool unbuffered) { + // Inplace Swapping (data is a copy anyway) + if (d->needswap) { + swapBytes(data); + } + + writeRaw(&data, sizeof(data), unbuffered); + } + + void cBufferedWriter::writeByte(unsigned char data, bool unbuffered) { + if (unbuffered) { + flush(); + d->file.writeBlock((const char*)&data, sizeof(data)); + } else { + if (d->bufferpos + sizeof(data) >= BUFFERSIZE) { + flush(); // Flush buffer to file + } + + *(unsigned char*)(d->buffer.data() + d->bufferpos) = data; + d->bufferpos += sizeof(data); + } + } + + void cBufferedWriter::flush() { + d->file.writeBlock(d->buffer.data(), d->bufferpos); + d->bufferpos = 0; + } + + void cBufferedWriter::writeUtf8(const QString &data, bool unbuffered) { + QCString utf8 = data.utf8(); + writeAscii(utf8, unbuffered); + } + + void cBufferedWriter::writeAscii(const QCString &data, bool unbuffered) { + QMap<QCString, unsigned int>::iterator it = d->dictionary.find(data); + + if (it != d->dictionary.end()) { + writeInt(it.data(), unbuffered); + } else { + d->dictionary.insert(data, ++d->lastStringId); + writeInt(d->lastStringId, unbuffered); + } + } + + void cBufferedWriter::writeRaw(const void *data, unsigned int size, bool unbuffered) { + if (unbuffered) { + flush(); + d->file.writeBlock((const char*)data, size); + } else { + // Flush out entire blocks if neccesary until we dont + // overflow the buffer anymore, then just append + unsigned int pos = 0; + + while (d->bufferpos + size >= BUFFERSIZE) { + unsigned int bspace = BUFFERSIZE - d->bufferpos; + + // Try putting in some bytes of the remaining data + if (bspace != 0) { + memcpy(d->buffer.data() + d->bufferpos, (unsigned char*)data + pos, bspace); + d->bufferpos = BUFFERSIZE; + pos += bspace; + size -= bspace; + } + + flush(); + } + + // There are still some remaining bytes of our data + if (size != 0) { + memcpy(d->buffer.data() + d->bufferpos, (unsigned char*)data + pos, size); + d->bufferpos += size; + } + } + } + + unsigned int cBufferedWriter::position() { + return d->file.size() + d->bufferpos; + } + + unsigned int cBufferedWriter::version() { + return d->version; + } + + void cBufferedWriter::writeDouble(double value, bool unbuffered) { + if (d->needswap) { + swapBytes(value); + } + + writeRaw(&value, sizeof(value), unbuffered); + } + + void cBufferedWriter::setSkipSize(unsigned char type, unsigned int skipsize) { + d->skipmap.insert(type, skipsize, true); + } + + class cBufferedReaderPrivate { + public: + QFile file; + unsigned int version; + QCString magic; + bool needswap; + QByteArray buffer; + unsigned int bufferpos; + unsigned int buffersize; + QMap<unsigned char, QCString> typemap; + QMap<unsigned char, unsigned int> sizemap; + QMap<unsigned int, QCString> dictionary; + unsigned int objectCount; + }; + + cBufferedReader::cBufferedReader(const QCString &magic, unsigned int version) { + d = new cBufferedReaderPrivate; + d->buffer.resize(BUFFERSIZE); + d->bufferpos = 0; + d->buffersize = 0; // Current amount of data in buffer + d->magic = magic; + d->version = version; + d->objectCount = 0; + + // Check Endianess + int wordSize; + qSysInfo(&wordSize, &d->needswap); + } + + cBufferedReader::~cBufferedReader() { + close(); + delete d; + } + + unsigned int cBufferedReader::version() { + return d->version; + } + + void cBufferedReader::open(const QString &filename) { + close(); + + d->file.setName(filename); + if (!d->file.open(IO_Raw|IO_ReadOnly)) { + throw wpException(QString("Couldn't open file %1 for reading.").arg(filename)); + } + + // Calculate minimum header size (includes typemap count) + unsigned int headerSize = d->magic.length() + 1 + sizeof(unsigned int) * 4 + 1; + + if (d->file.size() < headerSize) { + throw wpException(QString("File doesn't have minimum size of %1 byte.").arg(headerSize)); + } + + // Check the file magic + QCString magic = readAscii(true); + if (magic != d->magic) { + throw wpException(QString("File had unexpected magic '%1'. Expected: '%2'.").arg(magic).arg(d->magic)); + } + + // Check if the file has been truncated or garbage has been appended + unsigned int filesize = readInt(); + if (filesize != d->file.size()) { + throw wpException(QString("The filesize in the header doesn't match. Expected size is %1 byte.").arg(filesize)); + } + + // Check if the worldsave is newer than we can process + unsigned int version = readInt(); + if (version > d->version) { + throw wpException(QString("The file version exceeds the maximum version: %1.").arg(version)); + } + d->version = version; // Save file version + + unsigned int dictionary = readInt(); + + if (!dictionary || dictionary + 4 > d->file.size()) { + throw wpException("Invalid dictionary."); + } + + d->objectCount = readInt(); + + unsigned int dataStart = position(); + + // Seek to the dictionary and read it + d->bufferpos = 0; + d->buffersize = 0; + d->file.at(dictionary); + + unsigned int entries = readInt(); + unsigned int i; + for (i = 0; i < entries; ++i) { + unsigned int id = readInt(); + unsigned int size = readInt(); + if (size <= 1) { + readByte(); + d->dictionary.insert(id, QCString()); + } else { + QCString data(size); + readRaw(data.data(), size); + d->dictionary.insert(id, data); + } + } + + d->bufferpos = 0; + d->buffersize = 0; + d->file.at(dataStart); + + // Read the object type list + unsigned char count = readByte(); + + for (i = 0; i < count; ++i) { + unsigned char id = readByte(); + unsigned int size = readInt(); + QCString type = readAscii(); + + d->typemap.insert(id, type); + d->sizemap.insert(id, size); + } + } + + void cBufferedReader::close() { + if (d->file.isOpen()) { + d->file.close(); + } + } + + unsigned int cBufferedReader::readInt() { + unsigned int result; + readRaw(&result, sizeof(result)); + + if (d->needswap) { + swapBytes(result); + } + + return result; + } + + double cBufferedReader::readDouble() { + double result; + readRaw(&result, sizeof(result)); + + if (d->needswap) { + swapBytes(result); + } + + return result; + } + + unsigned short cBufferedReader::readShort() { + unsigned short result; + readRaw(&result, sizeof(result)); + + if (d->needswap) { + swapBytes(result); + } + + return result; + } + + unsigned char cBufferedReader::readByte() { + unsigned char result; + readRaw(&result, sizeof(result)); + return result; + } + + QString cBufferedReader::readUtf8() { + QCString data = readAscii(); + + if (data.length() == 0 || data.data() == 0 || *(data.data()) == 0) { + return QString::null; + } else { + return QString::fromUtf8(data); + } + } + + QCString cBufferedReader::readAscii(bool nodictionary) { + if (nodictionary) { + unsigned char c; + QCString result; + do { + c = readByte(); + if (c != 0) { + result.insert(result.length(), c); + } + } while (c != 0); + return result; + } else { + unsigned int id = readInt(); + + QMap<unsigned int, QCString>::iterator it = d->dictionary.find(id); + + if (it != d->dictionary.end()) { + return it.data(); + } else { + return QCString(); + } + } + } + + void cBufferedReader::readRaw(void *data, unsigned int size) { + unsigned int pos = 0; + + // Repeat this + do { + unsigned int available = d->buffersize - d->bufferpos; + unsigned int needed = QMIN(available, size); + + // Get as much data as possible + if (needed != 0) { + memcpy(((unsigned char*)data) + pos, d->buffer.data() + d->bufferpos, needed); + size -= needed; + available -= needed; + pos += needed; + d->bufferpos += needed; + } + + // Refill buffer if required + if (available == 0) { + unsigned int read = d->file.readBlock(d->buffer.data(), BUFFERSIZE); + + // We will never be able to statisfy the request + if (read != BUFFERSIZE && read < size) { + throw wpException(QString("Unexpected end of file while reading.")); + } + + d->bufferpos = 0; + d->buffersize = read; + } + } while (size > 0); + } + + unsigned int cBufferedReader::position() { + return (d->file.at() - d->buffersize) + d->bufferpos; + } + + const QMap<unsigned char, QCString> &cBufferedReader::typemap() { + return d->typemap; + } + + unsigned int cBufferedReader::getSkipSize(unsigned char type) { + if (!d->sizemap.contains(type)) { + return 0; + } else { + return d->sizemap[type]; + } + } + + unsigned int cBufferedReader::objectCount() { + return d->objectCount; + } Index: multi.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/multi.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** multi.cpp 20 Jul 2004 11:35:37 -0000 1.10 --- multi.cpp 9 Aug 2004 20:30:21 -0000 1.11 *************** *** 159,165 **** QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cMulti' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); UObjectFactory::instance()->registerType( "cMulti", productCreator ); ! UObjectFactory::instance()->registerSqlQuery( "cMulti", sqlString ); } cMulti* cMulti::find( const Coord_cl& pos ) { --- 159,167 ---- QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cMulti' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); UObjectFactory::instance()->registerType( "cMulti", productCreator ); ! classid = UObjectFactory::instance()->registerSqlQuery( "cMulti", sqlString ); } + unsigned char cMulti::classid; + cMulti* cMulti::find( const Coord_cl& pos ) { *************** *** 186,187 **** --- 188,199 ---- return multi; } + + void cMulti::save(cBufferedWriter &writer) { + cItem::save(writer); + + // Save objects within this multi *after* the multi + cUObject* object; + for (object = objects.first(); object; object = objects.next()) { + object->save(writer); + } + } Index: items.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v retrieving revision 1.428 retrieving revision 1.429 diff -C2 -d -r1.428 -r1.429 *** items.cpp 4 Aug 2004 23:17:35 -0000 1.428 --- items.cpp 9 Aug 2004 20:30:21 -0000 1.429 *************** *** 534,537 **** --- 534,588 ---- } + void cItem::save(cBufferedWriter &writer, unsigned int version) { + cUObject::save(writer, version); + + writer.writeShort(id_); + writer.writeShort(color_); + writer.writeInt(container_ ? container_->serial() : INVALID_SERIAL); + writer.writeByte(layer_); + writer.writeShort(amount_); + writer.writeShort(hp_); + writer.writeShort(maxhp_); + writer.writeByte(magic_); + writer.writeInt(ownserial_); + writer.writeByte(visible_); + writer.writeByte(priv_); + writer.writeAscii(baseid()); + } + + void cItem::postload(unsigned int version) { + } + + void cItem::load(cBufferedReader &reader, unsigned int version) { + cUObject::load(reader, version); + + id_ = reader.readShort(); + color_ = reader.readShort(); + // Here we assume that containers are always before us in the save + cUObject *container = World::instance()->findObject(reader.readInt()); + layer_ = reader.readByte(); + amount_ = reader.readShort(); + hp_ = reader.readShort(); + maxhp_ = reader.readShort(); + magic_ = reader.readByte(); + ownserial_ = reader.readInt(); + visible_ = reader.readByte(); + priv_ = reader.readByte(); + basedef_ = ItemBaseDefs::instance()->get(reader.readAscii()); + + // Add to container and handle weight + if (container) { + P_ITEM iContainer = dynamic_cast<P_ITEM>(container); + if (iContainer) { + iContainer->addItem(this, false, true, true); + } else { + P_CHAR cContainer = dynamic_cast<P_CHAR>(container); + if (cContainer) { + cContainer->addItem((cBaseChar::enLayer)layer(), this, true, true); + } + } + } + } + void cItem::save() { *************** *** 1458,1464 **** QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cItem' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); UObjectFactory::instance()->registerType( "cItem", productCreator ); ! UObjectFactory::instance()->registerSqlQuery( "cItem", sqlString ); } void cItem::load( char** result, UINT16& offset ) { --- 1509,1517 ---- QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cItem' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); UObjectFactory::instance()->registerType( "cItem", productCreator ); ! classid = UObjectFactory::instance()->registerSqlQuery( "cItem", sqlString ); } + unsigned char cItem::classid; + void cItem::load( char** result, UINT16& offset ) { *************** *** 2351,2352 **** --- 2404,2424 ---- } + void cItem::save(cBufferedWriter &writer) { + cUObject::save(writer); + + // Save container content + ContainerContent::iterator it = content_.begin(); + for (; it != content_.end(); ++it) { + (*it)->save(writer); + } + } + + void cItem::load(cBufferedReader &reader) { + load(reader, reader.version()); + + World::instance()->registerObject(this); + + if (!container_) { + SectorMaps::instance()->add(this); + } + } Index: corpse.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/corpse.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** corpse.cpp 4 Aug 2004 23:17:35 -0000 1.60 --- corpse.cpp 9 Aug 2004 20:30:21 -0000 1.61 *************** *** 30,33 **** --- 30,34 ---- #include "network/network.h" #include "network/uotxpackets.h" + #include "basics.h" #include "dbdriver.h" #include "network/uosocket.h" *************** *** 39,43 **** #include <functional> #include <algorithm> - #include <map> using namespace std; --- 40,43 ---- *************** *** 54,60 **** QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cCorpse' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); UObjectFactory::instance()->registerType( "cCorpse", productCreator ); ! UObjectFactory::instance()->registerSqlQuery( "cCorpse", sqlString ); } void cCorpse::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { --- 54,62 ---- QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cCorpse' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); UObjectFactory::instance()->registerType( "cCorpse", productCreator ); ! classid = UObjectFactory::instance()->registerSqlQuery( "cCorpse", sqlString ); } + unsigned char cCorpse::classid; + void cCorpse::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { *************** *** 66,69 **** --- 68,116 ---- } + void cCorpse::load(cBufferedReader &reader, unsigned int version) { + cItem::load(reader, version); + bodyId_ = reader.readShort(); + hairStyle_ = reader.readShort(); + hairColor_ = reader.readShort(); + beardStyle_ = reader.readShort(); + beardColor_ = reader.readShort(); + direction_ = reader.readByte(); + charbaseid_ = reader.readAscii(); + murderer_ = reader.readInt(); + murdertime_ = reader.readInt(); + + // Write a serial for every possible layer (fixed block size) + unsigned char layer; + for (layer = cBaseChar::SingleHandedWeapon; layer <= cBaseChar::Mount; ++layer) { + SERIAL serial = reader.readInt(); + if (serial != INVALID_SERIAL) { + equipment_.insert(layer, serial); + } + } + } + + void cCorpse::save(cBufferedWriter &writer, unsigned int version) { + cItem::save(writer, version); + writer.writeShort(bodyId_); + writer.writeShort(hairStyle_); + writer.writeShort(hairColor_); + writer.writeShort(beardStyle_); + writer.writeShort(beardColor_); + writer.writeByte(direction_); + writer.writeAscii(charbaseid_); + writer.writeInt(murderer_); + writer.writeInt(murdertime_); + + // Write a serial for every possible layer (fixed block size) + unsigned char layer; + for (layer = cBaseChar::SingleHandedWeapon; layer <= cBaseChar::Mount; ++layer) { + if (equipment_.contains(layer)) { + writer.writeInt(equipment_[layer]); + } else { + writer.writeInt(INVALID_SERIAL); + } + } + } + void cCorpse::load( char** result, UINT16& offset ) { *************** *** 89,93 **** // Fetch row-by-row while ( res.fetchrow() ) ! equipment_.insert( make_pair( res.getInt( 0 ), res.getInt( 1 ) ) ); res.free(); --- 136,140 ---- // Fetch row-by-row while ( res.fetchrow() ) ! equipment_.insert( res.getInt( 0 ), res.getInt( 1 ) ); res.free(); *************** *** 119,124 **** } ! for ( map<UINT8, SERIAL>::iterator it = equipment_.begin(); it != equipment_.end(); ++it ) ! PersistentBroker::instance()->executeQuery( QString( "REPLACE INTO corpses_equipment VALUES(%1,%2,%3)" ).arg( serial() ).arg( it->first ).arg( it->second ) ); cItem::save(); --- 166,171 ---- } ! for ( QMap<UINT8, SERIAL>::iterator it = equipment_.begin(); it != equipment_.end(); ++it ) ! PersistentBroker::instance()->executeQuery( QString( "REPLACE INTO corpses_equipment VALUES(%1,%2,%3)" ).arg( serial() ).arg( it.key() ).arg( it.data() ) ); cItem::save(); *************** *** 160,170 **** corpseEquip.setSerial( serial() ); ! for ( map<UINT8, SERIAL>::iterator it = equipment_.begin(); it != equipment_.end(); ++it ) { ! P_ITEM pItem = World::instance()->findItem( it->second ); if ( pItem && pItem->container() == this ) { ! corpseEquip.addItem( it->first, it->second ); corpseContent.addItem( pItem ); } --- 207,217 ---- corpseEquip.setSerial( serial() ); ! for ( QMap<UINT8, SERIAL>::iterator it = equipment_.begin(); it != equipment_.end(); ++it ) { ! P_ITEM pItem = World::instance()->findItem( it.data() ); if ( pItem && pItem->container() == this ) { ! corpseEquip.addItem( it.key(), it.data() ); corpseContent.addItem( pItem ); } *************** *** 242,246 **** } ! equipment_.insert( make_pair( layer, serial ) ); } --- 289,293 ---- } ! equipment_.insert(layer, serial); } Index: items.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/items.h,v retrieving revision 1.207 retrieving revision 1.208 diff -C2 -d -r1.207 -r1.208 *** items.h 24 Jul 2004 18:59:56 -0000 1.207 --- items.h 9 Aug 2004 20:30:21 -0000 1.208 *************** *** 165,168 **** --- 165,169 ---- friend class cBaseChar; private: + static unsigned char classid; unsigned char changed_ : 1; cItemBaseDef* basedef_; *************** *** 174,177 **** --- 175,182 ---- public: + unsigned char getClassid() { + return cItem::classid; + } + typedef QValueVector<cItem*> ContainerContent; *************** *** 188,191 **** --- 193,200 ---- bool del(); + void load(cBufferedReader &reader, unsigned int version); + void save(cBufferedWriter &reader, unsigned int version); + void postload(unsigned int version); + void processContainerNode( const cElement* Tag ); virtual void update( cUOSocket* mSock = NULL ); *************** *** 298,301 **** --- 307,313 ---- } + void save(cBufferedWriter &writer); + void load(cBufferedReader &reader); + // Basedef Properties inline bool isWaterSource() { Index: server.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/server.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** server.cpp 4 Aug 2004 23:17:36 -0000 1.14 --- server.cpp 9 Aug 2004 20:30:21 -0000 1.15 *************** *** 318,322 **** // Open the Worldsave and Account Database drivers. ! if ( !PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver() ) ) { Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); --- 318,322 ---- // Open the Worldsave and Account Database drivers. ! if ( Config::instance()->databaseDriver() != "binary" && !PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver() ) ) { Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); Index: basechar.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** basechar.h 27 Jul 2004 06:35:21 -0000 1.75 --- basechar.h 9 Aug 2004 20:30:21 -0000 1.76 *************** *** 119,122 **** --- 119,127 ---- void save(); bool del(); + void load(cBufferedReader &reader); + void load(cBufferedReader &reader, unsigned int version); + void save(cBufferedWriter &writer, unsigned int version); + void save(cBufferedWriter &writer); + void postload(unsigned int version); // interface methods *************** *** 354,358 **** P_CHAR guarding() const; short hitpoints() const; ! int hunger() const; uint hungerTime() const; short intelligence() const; --- 359,363 ---- P_CHAR guarding() const; short hitpoints() const; ! unsigned char hunger() const; uint hungerTime() const; short intelligence() const; *************** *** 433,437 **** void setGuarding( P_CHAR data ); void setHitpoints( short data ); ! void setHunger( int data ); void setHungerTime( uint data ); void setIntelligence( short data ); --- 438,442 ---- void setGuarding( P_CHAR data ); void setHitpoints( short data ); ! void setHunger( unsigned char data ); void setHungerTime( uint data ); void setIntelligence( short data ); *************** *** 736,740 **** // The hunger value of the char. 6 means not hungry, 0 means starving. // cOldChar::hunger_ ! int hunger_; // Server clocks when next hunger check will be made. --- 741,745 ---- // The hunger value of the char. 6 means not hungry, 0 means starving. // cOldChar::hunger_ ! unsigned char hunger_; // Server clocks when next hunger check will be made. *************** *** 984,993 **** } ! inline int cBaseChar::hunger() const { return hunger_; } ! inline void cBaseChar::setHunger( int data ) { hunger_ = data; --- 989,998 ---- } ! inline unsigned char cBaseChar::hunger() const { return hunger_; } ! inline void cBaseChar::setHunger( unsigned char data ) { hunger_ = data; Index: corpse.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/corpse.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** corpse.h 20 Jul 2004 11:35:36 -0000 1.25 --- corpse.h 9 Aug 2004 20:30:21 -0000 1.26 *************** *** 35,39 **** // System Includes ! #include <map> // Forward declarations --- 35,39 ---- // System Includes ! #include <qmap.h> // Forward declarations *************** *** 45,48 **** --- 45,49 ---- static void buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ); bool changed_; + static unsigned char classid; protected: *************** *** 57,64 **** QCString charbaseid_; ! std::map<UINT8, SERIAL> equipment_; // Serials of the old equipment // The meaning of this is that even if the items are inside of the corpse // they're displayed as equipment public: cCorpse(bool init = false); void setBodyId(UINT16 data); --- 58,69 ---- QCString charbaseid_; ! QMap<UINT8, SERIAL> equipment_; // Serials of the old equipment // The meaning of this is that even if the items are inside of the corpse // they're displayed as equipment public: + unsigned char getClassid() { + return cCorpse::classid; + } + cCorpse(bool init = false); void setBodyId(UINT16 data); *************** *** 107,110 **** --- 112,117 ---- void save(); bool del(); + void load(cBufferedReader &reader, unsigned int version); + void save(cBufferedWriter &reader, unsigned int version); // abstract cDefinable Index: player.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/player.h,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** player.h 7 Aug 2004 15:32:59 -0000 1.51 --- player.h 9 Aug 2004 20:30:21 -0000 1.52 *************** *** 75,78 **** --- 75,81 ---- void save(); bool del(); + void load(cBufferedReader &reader, unsigned int version); + void save(cBufferedWriter &writer, unsigned int version); + void load(cBufferedReader &reader); virtual bool send( cUOPacket* packet ); *************** *** 200,205 **** --- 203,213 ---- const char* className() const; + unsigned char getClassid() { + return cPlayer::classid; + } + private: bool changed_; + static unsigned char classid; protected: Index: basics.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basics.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** basics.h 19 Jun 2004 02:06:51 -0000 1.23 --- basics.h 9 Aug 2004 20:30:21 -0000 1.24 *************** *** 34,37 **** --- 34,38 ---- #include <functional> + #include <qmap.h> // Forward definitions *************** *** 61,64 **** --- 62,121 ---- }; + class QCString; + + class cBufferedWriter { + private: + class cBufferedWriterPrivate *d; + + public: + cBufferedWriter(const QCString &magic, unsigned int version); + ~cBufferedWriter(); + + void open(const QString &filename); + void close(); + void flush(); + + void writeInt(unsigned int data, bool unbuffered = false); + void writeShort(unsigned short data, bool unbuffered = false); + void writeByte(unsigned char data, bool unbuffered = false); + void writeUtf8(const QString &data, bool unbuffered = false); + void writeAscii(const QCString &data, bool unbuffered = false); + void writeRaw(const void *data, unsigned int size, bool unbuffered = false); + void writeDouble(double data, bool unbuffered = false); + + unsigned int position(); + unsigned int version(); + void setSkipSize(unsigned char type, unsigned int skipsize); + void setObjectCount(unsigned int count); + unsigned int objectCount(); + }; + + class cBufferedReader { + private: + class cBufferedReaderPrivate *d; + + public: + cBufferedReader(const QCString &magic, unsigned int version); + ~cBufferedReader(); + + void open(const QString &filename); + void close(); + unsigned int version(); + + unsigned int readInt(); + unsigned short readShort(); + unsigned char readByte(); + double readDouble(); + QString readUtf8(); + QCString readAscii(bool nodictionary = false); + void readRaw(void *data, unsigned int size); + + unsigned int position(); + const QMap<unsigned char, QCString> &typemap(); + unsigned int getSkipSize(unsigned char type); + + unsigned int objectCount(); + }; + #endif Index: customtags.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/customtags.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** customtags.h 19 Jun 2004 02:06:51 -0000 1.30 --- customtags.h 9 Aug 2004 20:30:21 -0000 1.31 *************** *** 45,48 **** --- 45,50 ---- class cVariant; class Coord_cl; + class cBufferedReader; + class cBufferedWriter; class cVariant *************** *** 77,80 **** --- 79,85 ---- cVariant( long int ); + void serialize(cBufferedWriter &writer, unsigned int version); + void serialize(cBufferedReader &reader, unsigned int version); + Type type() const; const char* typeName() const; *************** *** 155,158 **** --- 160,165 ---- QValueList<cVariant> getValues(); + void save(SERIAL serial, cBufferedWriter &writer); + bool getChanged() const { *************** *** 168,172 **** bool operator==( const cCustomTags& ) const; bool operator!=( const cCustomTags& ) const; - private: QMap<QString, cVariant>* tags_; --- 175,178 ---- Index: basechar.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** basechar.cpp 4 Aug 2004 23:17:35 -0000 1.123 --- basechar.cpp 9 Aug 2004 20:30:21 -0000 1.124 *************** *** 161,164 **** --- 161,291 ---- static void characterRegisterAfterLoading( P_CHAR pc ); + void cBaseChar::load(cBufferedReader &reader, unsigned int version) { + cUObject::load(reader, version); + + orgName_ = reader.readUtf8(); + title_ = reader.readUtf8(); + creationDate_ = QDateTime::fromString(reader.readUtf8(), Qt::ISODate); + body_ = reader.readShort(); + orgBody_ = reader.readShort(); + skin_ = reader.readShort(); + orgSkin_ = reader.readShort(); + saycolor_ = reader.readShort(); + emoteColor_ = reader.readShort(); + strength_ = reader.readShort(); + strengthMod_ = reader.readShort(); + dexterity_ = reader.readShort(); + dexterityMod_ = reader.readShort(); + intelligence_ = reader.readShort(); + intelligenceMod_ = reader.readShort(); + maxHitpoints_ = reader.readShort(); + hitpoints_ = reader.readShort(); + maxStamina_ = reader.readShort(); + stamina_ = reader.readShort(); + maxMana_ = reader.readShort(); + mana_ = reader.readShort(); + karma_ = reader.readShort(); + fame_ = reader.readShort(); + kills_ = reader.readShort(); + deaths_ = reader.readShort(); + hunger_ = reader.readByte(); + poison_ = reader.readByte(); + murdererTime_ = reader.readInt(); + if (murdererTime_) { + murdererTime_ += Server::instance()->time(); + } + criminalTime_ = reader.readInt(); + if (criminalTime_) { + criminalTime_ += Server::instance()->time(); + } + gender_ = reader.readByte(); + propertyFlags_ = reader.readInt(); + murdererSerial_ = reader.readInt(); + guarding_ = reinterpret_cast<P_CHAR>(reader.readInt()); // PostProcess + hitpointsBonus_ = reader.readShort(); + staminaBonus_ = reader.readShort(); + manaBonus_ = reader.readShort(); + strengthCap_ = reader.readByte(); + dexterityCap_ = reader.readByte(); + intelligenceCap_ = reader.readByte(); + statCap_ = reader.readByte(); + basedef_ = CharBaseDefs::instance()->get( reader.readAscii() ); + direction_ = reader.readByte(); + + // Load Skills + unsigned int count = ALLSKILLS; + for (unsigned int s = 0; s < count; ++s) { + // Read value, cap, lock + setSkillValue(s, reader.readShort()); + setSkillCap(s, reader.readShort()); + setSkillLock(s, reader.readByte()); + } + } + + void cBaseChar::postload(unsigned int version) { + // Resolve the guarding_ value. + SERIAL guarding = (SERIAL)guarding_; + guarding_ = 0; + setGuarding(World::instance()->findChar(guarding)); + + + } + + void cBaseChar::save(cBufferedWriter &writer, unsigned int version) { + cUObject::save(writer, version); + + writer.writeUtf8(orgName_); + writer.writeUtf8(title_); + writer.writeUtf8(creationDate_.toString(Qt::ISODate)); + writer.writeShort(body_); + writer.writeShort(orgBody_); + writer.writeShort(skin_); + writer.writeShort(orgSkin_); + writer.writeShort(saycolor_); + writer.writeShort(emoteColor_); + writer.writeShort(strength_); + writer.writeShort(strengthMod_); + writer.writeShort(dexterity_); + writer.writeShort(dexterityMod_); + writer.writeShort(intelligence_); + writer.writeShort(intelligenceMod_); + writer.writeShort(maxHitpoints_); + writer.writeShort(hitpoints_); + writer.writeShort(maxStamina_); + writer.writeShort(stamina_); + writer.writeShort(maxMana_); + writer.writeShort(mana_); + writer.writeShort(karma_); + writer.writeShort(fame_); + writer.writeShort(kills_); + writer.writeShort(deaths_); + writer.writeByte(hunger_); + writer.writeByte(poison_); + writer.writeInt(murdererTime_ ? murdererTime_ - Server::instance()->time() : 0); + writer.writeInt(criminalTime_ ? criminalTime_ - Server::instance()->time() : 0); + writer.writeByte(gender_); + writer.writeInt(propertyFlags_); + writer.writeInt(murdererSerial_); + writer.writeInt(guarding_ ? guarding_->serial() : INVALID_SERIAL); + writer.writeShort(hitpointsBonus_); + writer.writeShort(staminaBonus_); + writer.writeShort(manaBonus_); + writer.writeByte(strengthCap_); + writer.writeByte(dexterityCap_); + writer.writeByte(intelligenceCap_); + writer.writeByte(statCap_); + writer.writeAscii(baseid()); + writer.writeByte(direction_); + + // Load Skills + unsigned int count = ALLSKILLS; + for (unsigned int s = 0; s < count; ++s) { + // Read value, cap, lock + writer.writeShort(skillValue(s)); + writer.writeShort(skillCap(s)); + writer.writeByte(skillLock(s)); + } + } + void cBaseChar::load( char** result, UINT16& offset ) { *************** *** 252,255 **** --- 379,392 ---- } + void cBaseChar::save(cBufferedWriter &writer) { + cUObject::save(writer); + + // Save equipment + ItemContainer::iterator it = content_.begin(); + for (; it != content_.end(); ++it) { + it.data()->save(writer); + } + } + void cBaseChar::save() { *************** *** 3293,3294 **** --- 3430,3437 ---- cUObject::remove(); } + + void cBaseChar::load(cBufferedReader &reader) { + load(reader, reader.version()); + World::instance()->registerObject(this); + SectorMaps::instance()->add(this); + } Index: wolfpack.vcproj =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wolfpack.vcproj,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** wolfpack.vcproj 4 Aug 2004 23:17:37 -0000 1.39 --- wolfpack.vcproj 9 Aug 2004 20:30:22 -0000 1.40 *************** *** 695,698 **** --- 695,701 ---- </File> <File + RelativePath=".\python\pyspawnregion.cpp"> + </File> + <File RelativePath=".\python\pytooltip.cpp"> </File> Index: customtags.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/customtags.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** customtags.cpp 5 Jul 2004 18:33:20 -0000 1.50 --- customtags.cpp 9 Aug 2004 20:30:21 -0000 1.51 *************** *** 630,633 **** --- 630,747 ---- } + void cVariant::serialize(cBufferedWriter &writer, unsigned int version) { + writer.writeByte(typ); + char skipper[8]; + + switch (typ) { + case Invalid: + writer.writeRaw(skipper, 8); + break; + + case String: + if (value.ptr) { + writer.writeUtf8(*(QString*)value.ptr); + } else { + writer.writeUtf8(QString::null); + } + writer.writeRaw(skipper, 4); + break; + + case Int: + writer.writeInt(value.i); + writer.writeRaw(skipper, 4); + break; + + case Long: + writer.writeInt(value.i); + writer.writeRaw(skipper, 4); + break; + + case Double: + writer.writeDouble(value.d); + break; + + case BaseChar: + if (value.ptr) { + writer.writeInt(((P_CHAR)value.ptr)->serial()); + } else { + writer.writeInt(INVALID_SERIAL); + } + writer.writeRaw(skipper, 4); + break; + + case Item: + if (value.ptr) { + writer.writeInt(((P_ITEM)value.ptr)->serial()); + } else { + writer.writeInt(INVALID_SERIAL); + } + writer.writeRaw(skipper, 4); + break; + + case Coord: + writer.writeShort(((Coord_cl*)(value.ptr))->x); + writer.writeShort(((Coord_cl*)(value.ptr))->y); + writer.writeByte(((Coord_cl*)(value.ptr))->z); + writer.writeByte(((Coord_cl*)(value.ptr))->map); + writer.writeRaw(skipper, 2); + break; + } + } + + void cVariant::serialize(cBufferedReader &reader, unsigned int version) { + // Only invalid can be loaded + if (typ != Invalid) { + return; + } + + unsigned char type = reader.readByte(); + typ = (Type)type; + switch (typ) { + case Invalid: + reader.readInt(); + reader.readInt(); + break; + + case String: + value.ptr = new QString(reader.readUtf8()); + reader.readInt(); + break; + + case Int: + value.i = reader.readInt(); + reader.readInt(); + break; + + case Long: + value.i = reader.readInt(); + reader.readInt(); + break; + + case Double: + value.d = reader.readDouble(); + break; + + case BaseChar: + value.ptr = World::instance()->findChar(reader.readInt()); + reader.readInt(); + break; + + case Item: + value.ptr = World::instance()->findItem(reader.readInt()); + reader.readInt(); + break; + + case Coord: + value.ptr = new Coord_cl; + ((Coord_cl*)(value.ptr))->x = reader.readShort(); + ((Coord_cl*)(value.ptr))->y = reader.readShort(); + ((Coord_cl*)(value.ptr))->z = reader.readByte(); + ((Coord_cl*)(value.ptr))->map = reader.readByte(); + reader.readShort(); + break; + } + } + /***************************************************************************** cCustomTags member functions *************** *** 903,904 **** --- 1017,1041 ---- return !( this->operator == ( cmp ) ); } + + void cCustomTags::save(SERIAL serial, cBufferedWriter &writer) { + if (tags_) { + QMap<QString, cVariant>::iterator it( tags_->begin() ); + + for (; it != tags_->end(); ++it) { + // Erase invalid tags. + if (!it.data().isValid()) { + continue; + } + + // Save serial and name + writer.writeByte(0xFE); + unsigned int length = writer.position(); + writer.writeInt(serial); + writer.writeUtf8(it.key()); + it.data().serialize(writer, writer.version()); + length = writer.position() - length; + + writer.setSkipSize(0xFE, length); + } + } + } Index: npc.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/npc.h,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** npc.h 20 Jul 2004 11:35:37 -0000 1.52 --- npc.h 9 Aug 2004 20:30:21 -0000 1.53 *************** *** 91,94 **** --- 91,98 ---- void save(); bool del(); + void load(cBufferedReader &reader, unsigned int version); + void save(cBufferedWriter &writer, unsigned int version); + void postload(unsigned int version); + void load(cBufferedReader &reader); virtual enCharTypes objectType(); *************** *** 193,198 **** --- 197,207 ---- const char* className() const; + unsigned char getClassid() { + return cNPC::classid; + } + private: bool changed_; + static unsigned char classid; protected: Index: player.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** player.cpp 7 Aug 2004 15:32:59 -0000 1.115 --- player.cpp 9 Aug 2004 20:30:21 -0000 1.116 *************** *** 96,102 **** QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cPlayer' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); UObjectFactory::instance()->registerType( "cPlayer", productCreator ); ! UObjectFactory::instance()->registerSqlQuery( "cPlayer", sqlString ); } void cPlayer::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { --- 96,104 ---- QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cPlayer' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); UObjectFactory::instance()->registerType( "cPlayer", productCreator ); ! classid = UObjectFactory::instance()->registerSqlQuery( "cPlayer", sqlString ); } + unsigned char cPlayer::classid; + void cPlayer::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { *************** *** 111,114 **** --- 113,147 ---- static void playerRegisterAfterLoading( P_PLAYER pc ); + void cPlayer::load(cBufferedReader &reader) { + load(reader, reader.version()); + + World::instance()->registerObject(this); + SectorMaps::instance()->add(this); + } + + void cPlayer::load(cBufferedReader &reader, unsigned int version) { + cBaseChar::load(reader, version); + setAccount(Accounts::instance()->getRecord(reader.readUtf8())); + additionalFlags_ = reader.readInt(); + visualRange_ = reader.readByte(); + profile_ = reader.readUtf8(); + fixedLightLevel_ = reader.readByte(); + strengthLock_ = reader.readByte(); + dexterityLock_ = reader.readByte(); + intelligenceLock_ = reader.readByte(); + } + + void cPlayer::save(cBufferedWriter &writer, unsigned int version) { + cBaseChar::save(writer, version); + writer.writeUtf8(account_ ? account_->login() : QString::null); + writer.writeInt(additionalFlags_); + writer.writeByte(visualRange_); + writer.writeUtf8(profile_); + writer.writeByte(fixedLightLevel_); + writer.writeByte(strengthLock_); + writer.writeByte(dexterityLock_); + writer.writeByte(intelligenceLock_); + } + void cPlayer::load( char** result, UINT16& offset ) { Index: world.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** world.cpp 4 Aug 2004 23:17:37 -0000 1.107 --- world.cpp 9 Aug 2004 20:30:22 -0000 1.108 *************** *** 81,84 **** --- 81,85 ---- // // ONCE AGAIN, DON'T FORGET TO INCREASE THIS VALUE + #define DATABASE_VERSION 6 #define WP_DATABASE_VERSION "6" *************** *** 388,649 **** } ! void cWorld::load() ! { ! if ( !PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver() ) ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); ! return; ! } ! if ( !PersistentBroker::instance()->connect( Config::instance()->databaseHost(), Config::instance()->databaseName(), Config::instance()->databaseUsername(), Config::instance()->databasePassword() ) ) ! { ! throw QString( "Unable to open the world database." ); } ! QString objectID; ! register unsigned int i = 0; ! while ( tableInfo[i].name ) ! { ! if ( !PersistentBroker::instance()->tableExists( tableInfo[i].name ) ) ! { ! PersistentBroker::instance()->executeQuery( tableInfo[i].create ); ! // create default settings ! if ( !strcmp( tableInfo[i].name, "settings" ) ) ! { ! setOption( "db_version", WP_DATABASE_VERSION, false ); ! } ! } ! ++i; ! } ! QStringList types = UObjectFactory::instance()->objectTypes(); ! for ( uint j = 0; j < types.count(); ++j ) ! { ! QString type = types[j]; ! cDBResult res = PersistentBroker::instance()->query( QString( "SELECT COUNT(*) FROM uobjectmap WHERE type = '%1'" ).arg( type ) ); ! // Find out how many objects of this type are available ! if ( !res.isValid() ) ! throw PersistentBroker::instance()->lastError(); ! res.fetchrow(); ! UINT32 count = res.getInt( 0 ); ! res.free(); ! if ( count == 0 ) ! continue; // Move on... ! Console::instance()->send( "\n" + tr( "Loading " ) + QString::number( count ) + tr( " objects of type " ) + type ); ! res = PersistentBroker::instance()->query( UObjectFactory::instance()->findSqlQuery( type ) ); ! // Error Checking ! if ( !res.isValid() ) ! throw PersistentBroker::instance()->lastError(); ! //UINT32 sTime = getNormalizedTime(); ! cUObject* object; ! progress_display progress( count ); ! // Fetch row-by-row ! PersistentBroker::instance()->driver()->setActiveConnection( CONN_SECOND ); ! while ( res.fetchrow() ) { ! unsigned short offset = 0; ! char** row = res.data(); ! // do something with data ! object = UObjectFactory::instance()->createObject( type ); ! object->load( row, offset ); ! ++progress; ! } ! while ( progress.count() < progress.expected_count() ) ! ++progress; ! res.free(); ! PersistentBroker::instance()->driver()->setActiveConnection(); ! } ! // Load Temporary Effects ! Timers::instance()->load(); ! // It's not possible to use cItemIterator during postprocessing because it skips lingering items ! ItemMap::iterator iter; ! QPtrList<cItem> deleteItems; ! for ( iter = p->items.begin(); iter != p->items.end(); ++iter ) ! { ! P_ITEM pi = iter->second; ! SERIAL contserial = reinterpret_cast<SERIAL>( pi->container() ); ! SERIAL multiserial = ( SERIAL ) ( pi->multi() ); ! cMulti* multi = dynamic_cast<cMulti*>( findItem( multiserial ) ); ! pi->setMulti( multi ); ! if ( multi ) ! { ! multi->addObject( pi ); ! } ! if ( !contserial ) ! { ! pi->setUnprocessed( false ); // This is for safety reasons ! int max_x = Maps::instance()->mapTileWidth( pi->pos().map ) * 8; ! int max_y = Maps::instance()->mapTileHeight( pi->pos().map ) * 8; ! if ( pi->pos().x > max_x || pi->pos().y > max_y ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Item with invalid position %1,%2,%3,%4.\n" ).arg( pi->pos().x ).arg( pi->pos().y ).arg( pi->pos().z ).arg( pi->pos().map ) ); ! deleteItems.append( pi ); ! continue; ! } ! else { ! MapObjects::instance()->add( pi ); } } ! else { ! // 1. Handle the Container Value ! if ( isItemSerial( contserial ) ) { ! P_ITEM pCont = FindItemBySerial( contserial ); ! if ( pCont ) { ! pCont->addItem( pi, false, true, true ); } else { ! Console::instance()->log( LOG_ERROR, QString( "Item with invalid container [0x%1].\n" ).arg( contserial, 0, 16 ) ); ! deleteItems.append( pi ); // Queue this item up for deletion ! continue; // Skip further processing } } ! else if ( isCharSerial( contserial ) ) { ! P_CHAR pCont = FindCharBySerial( contserial ); ! ! if ( pCont ) { ! pCont->addItem( ( cBaseChar::enLayer ) pi->layer(), pi, true, true ); ! } ! if ( !pCont || pi->container() != pCont ) { ! Console::instance()->log( LOG_ERROR, QString( "Item with invalid wearer [%1].\n" ).arg( contserial ) ); ! deleteItems.append( pi ); ! continue; } } ! pi->setUnprocessed( false ); } ! pi->flagUnchanged(); // We've just loaded, nothing changes. ! } ! ! // Post Process Characters ! cCharIterator charIter; ! P_CHAR pChar; ! for ( pChar = charIter.first(); pChar; pChar = charIter.next() ) ! { ! P_NPC pNPC = dynamic_cast<P_NPC>( pChar ); ! ! // Find Owner ! if ( pNPC && pNPC->owner() ) { ! SERIAL owner = pNPC->owner()->serial(); ! P_PLAYER pOwner = dynamic_cast<P_PLAYER>( FindCharBySerial( owner ) ); ! if ( pOwner ) { ! pNPC->setOwner( pOwner ); ! pOwner->addPet( pNPC, true ); } ! else { ! Console::instance()->send( QString( "The owner of Serial 0x%1 is invalid: %2" ).arg( pNPC->serial(), 0, 16 ).arg( owner, 0, 16 ) ); ! pNPC->setOwner( NULL ); } - } ! // Find Guarding ! if ( pChar->guarding() ) ! { ! SERIAL guarding = ( SERIAL ) pChar->guarding(); ! P_CHAR pGuarding = FindCharBySerial( guarding ); ! if ( pGuarding ) ! { ! pChar->setGuarding( pGuarding ); ! pGuarding->addGuard( pChar, true ); ! } ! else { ! Console::instance()->send( tr( "The guard target of Serial 0x%1 is invalid: %2" ).arg( pChar->serial(), 16 ).arg( guarding, 16 ) ); ! pChar->setGuarding( 0 ); } - } - - cTerritory* region = Territories::instance()->region( pChar->pos().x, pChar->pos().y, pChar->pos().map ); - pChar->setRegion( region ); ! SERIAL multiserial = ( SERIAL ) ( pChar->multi() ); ! cMulti* multi = dynamic_cast<cMulti*>( findItem( multiserial ) ); ! pChar->setMulti( multi ); ! if ( multi ) ! { ! multi->addObject( pChar ); } ! pChar->flagUnchanged(); // We've just loaded, nothing changes ! } ! ! if ( deleteItems.count() > 0 ) ! { ! // Do we have to delete items? ! for ( P_ITEM pItem = deleteItems.first(); pItem; pItem = deleteItems.next() ) ! quickdelete( pItem ); ! ! Console::instance()->send( QString::number( deleteItems.count() ) + " deleted due to invalid container or position.\n" ); ! deleteItems.clear(); ! } ! // Load SpawnRegion information ! cDBResult result = PersistentBroker::instance()->query("SELECT spawnregion,serial FROM spawnregions;"); ! while (result.fetchrow()) ! { ! QString spawnregion = result.getSt... [truncated message content] |