summaryrefslogtreecommitdiff
path: root/settings_gui.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-05-12 23:46:01 +0000
committerDarkvater <darkvater@openttd.org>2005-05-12 23:46:01 +0000
commit033995ec6ecd443404fa1a236c6763ddc9cce321 (patch)
treedde69a1afcdeffecc49a408ef9164ad83781a82f /settings_gui.c
parent56e7e4cf25929feefc4586dc3ffe1f4471bbdef1 (diff)
downloadopenttd-033995ec6ecd443404fa1a236c6763ddc9cce321.tar.xz
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
- CodeChange: remove cmd-misuses CmdStartScenario() and CmdDestroyCompanyHQ() - Fix (invisible): when parameter checking CmdRestoreOrderIndex() the vehicle did not have its orders yet, so it would fail. So move doing this until AFTER the orders have been added back in RestoreVehicleOrders()
Diffstat (limited to 'settings_gui.c')
-rw-r--r--settings_gui.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/settings_gui.c b/settings_gui.c
index f6af41354..1d4241aad 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -1017,19 +1017,21 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
}
}
-/**
- * Network-safe changing of patch-settings.
- * @param p1 bytes 0 - 7: the patches type (page) that is being changed (construction, network, ai)
- * @param p1 bytes 8 - ..: the actual patch (entry) being set inside the category
+/** Network-safe changing of patch-settings.
+ * @param p1 various bitstuffed elements
+ * - p1 = (bit 0- 7) - the patches type (page) that is being changed (construction, network, ai) (p1 & 0xFF)
+ * - p2 = (bit 8-15) - the actual patch (entry) being set inside the category ((p1>>8) & 0xFF)
* @param p2 the new value for the patch
+ * @todo check that the new value is a valid one. Awful lot of work, but since only
+ * the server is allowed to do this, we trust it on this one :)
*/
int32 CmdChangePatchSetting(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
byte pcat = p1 & 0xFF;
byte pel = (p1 >> 8) & 0xFF;
- if (pcat >= lengthof(_patches_page)) return 0;
- if (pel >= _patches_page[pcat].num) return 0;
+ if (pcat >= lengthof(_patches_page)) return CMD_ERROR;
+ if (pel >= _patches_page[pcat].num) return CMD_ERROR;
if (flags & DC_EXEC) {
const PatchEntry *pe = &_patches_page[pcat].entries[pel];