Use p3 for order indices which don't fit into p1

Fix insert/modify order overflowing p1
Don't use text field for change timetable
This commit is contained in:
Jonathan G Rennison
2020-10-17 15:01:44 +01:00
parent bbbda0739b
commit 6e17f9bf5d
7 changed files with 75 additions and 62 deletions

View File

@@ -25,7 +25,6 @@
#include "viewport_func.h"
#include "schdispatch.h"
#include "vehiclelist.h"
#include "core/endian_func.hpp"
#include "widgets/timetable_widget.h"
@@ -714,9 +713,7 @@ struct TimetableWindow : Window {
if (bulk) {
DoCommandP(0, p1, p2, CMD_BULK_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE));
} else {
char text[2];
*reinterpret_cast<uint16 *>(&text) = TO_LE16(order_number);
DoCommandPEx(0, p1, p2, 0, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE), nullptr, text, 2);
DoCommandPEx(0, p1, p2, order_number, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE), nullptr, nullptr, 0);
}
}