1015 DeleteWindowById(WC_QUERY_STRING, 0); |
1015 DeleteWindowById(WC_QUERY_STRING, 0); |
1016 break; |
1016 break; |
1017 } |
1017 } |
1018 } |
1018 } |
1019 |
1019 |
1020 /** |
1020 /** Network-safe changing of patch-settings. |
1021 * Network-safe changing of patch-settings. |
1021 * @param p1 various bitstuffed elements |
1022 * @param p1 bytes 0 - 7: the patches type (page) that is being changed (construction, network, ai) |
1022 * - p1 = (bit 0- 7) - the patches type (page) that is being changed (construction, network, ai) (p1 & 0xFF) |
1023 * @param p1 bytes 8 - ..: the actual patch (entry) being set inside the category |
1023 * - p2 = (bit 8-15) - the actual patch (entry) being set inside the category ((p1>>8) & 0xFF) |
1024 * @param p2 the new value for the patch |
1024 * @param p2 the new value for the patch |
|
1025 * @todo check that the new value is a valid one. Awful lot of work, but since only |
|
1026 * the server is allowed to do this, we trust it on this one :) |
1025 */ |
1027 */ |
1026 int32 CmdChangePatchSetting(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
1028 int32 CmdChangePatchSetting(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
1027 { |
1029 { |
1028 byte pcat = p1 & 0xFF; |
1030 byte pcat = p1 & 0xFF; |
1029 byte pel = (p1 >> 8) & 0xFF; |
1031 byte pel = (p1 >> 8) & 0xFF; |
1030 |
1032 |
1031 if (pcat >= lengthof(_patches_page)) return 0; |
1033 if (pcat >= lengthof(_patches_page)) return CMD_ERROR; |
1032 if (pel >= _patches_page[pcat].num) return 0; |
1034 if (pel >= _patches_page[pcat].num) return CMD_ERROR; |
1033 |
1035 |
1034 if (flags & DC_EXEC) { |
1036 if (flags & DC_EXEC) { |
1035 const PatchEntry *pe = &_patches_page[pcat].entries[pel]; |
1037 const PatchEntry *pe = &_patches_page[pcat].entries[pel]; |
1036 WritePE(pe, (int32)p2); |
1038 WritePE(pe, (int32)p2); |
1037 |
1039 |