forked from mirror/OpenTTD
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
- CodeChange: To correctly accept engine-prototypes, the best-player checking has been moved to its own function, I hope it functions the same as before. - CodeChange: Added symbolic types of PlayerID, OrderID and EngineID. For engines also added GetEngine() and IsEngineIndex(), similar to the other such functions. - CodeChange: To correctly build industries, some tables have been moved to build_industry.h. The only way to find out currently if an industry is valid in a climate is by looping all industries and checking if it matches. Also to comply with the patch setting build_rawmaterial_industries, it is assumed that these industries do not accept any cargo of any type. This can and probably should changed in the future to some flag in their struct. Also use _opt_ptr instead of _opt. - CodeChange: implemented the HQ checking code inspired by MarkR2 in "[ 1190944 ] Many commands not checked for security". Unfortunately it is impossible to prevent only deleting a HQ by a modified client atm. - CodeChange: For insert order and modify order their parameters are implicitely truncated to 8 bits, instead of the 16 bits said in the comments.
This commit is contained in:
@@ -358,7 +358,11 @@ static void DoDeleteAircraft(Vehicle *v)
|
||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||
}
|
||||
|
||||
// p1 = vehicle
|
||||
/** Sell an aircraft.
|
||||
* @param x,y unused
|
||||
* @param p1 vehicle ID to be sold
|
||||
* @param p2 unused
|
||||
*/
|
||||
int32 CmdSellAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
Vehicle *v;
|
||||
@@ -383,7 +387,11 @@ int32 CmdSellAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
return -(int32)v->value;
|
||||
}
|
||||
|
||||
// p1 = vehicle
|
||||
/** Start/Stop an aircraft.
|
||||
* @param x,y unused
|
||||
* @param p1 aircraft to start/stop
|
||||
* @param p2 unused
|
||||
*/
|
||||
int32 CmdStartStopAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
Vehicle *v;
|
||||
@@ -392,13 +400,11 @@ int32 CmdStartStopAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
v = GetVehicle(p1);
|
||||
|
||||
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner))
|
||||
return CMD_ERROR;
|
||||
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
|
||||
|
||||
// cannot stop airplane when in flight, or when taking off / landing
|
||||
if (v->u.air.state >= STARTTAKEOFF) {
|
||||
if (v->u.air.state >= STARTTAKEOFF)
|
||||
return_cmd_error(STR_A017_AIRCRAFT_IS_IN_FLIGHT);
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
v->vehstatus ^= VS_STOPPED;
|
||||
|
Reference in New Issue
Block a user