settings_gui.c
changeset 1803 8fd9dca6d2c6
parent 1796 614d996f6be7
child 1805 1dba0eb4cb47
equal deleted inserted replaced
1802:da61740cc1e7 1803:8fd9dca6d2c6
    68 	return i;
    68 	return i;
    69 }
    69 }
    70 
    70 
    71 static inline bool RoadVehiclesAreBuilt(void)
    71 static inline bool RoadVehiclesAreBuilt(void)
    72 {
    72 {
    73 	Vehicle *v;
    73 	const Vehicle *v;
    74 	FOR_ALL_VEHICLES(v) {
    74 	FOR_ALL_VEHICLES(v) {
    75 		if (v->type == VEH_Road) return true;
    75 		if (v->type == VEH_Road) return true;
    76 	}
    76 	}
    77 	return false;
    77 	return false;
    78 }
    78 }
   169 			_opt_ptr->kilometers = e->dropdown.index;
   169 			_opt_ptr->kilometers = e->dropdown.index;
   170 			MarkWholeScreenDirty();
   170 			MarkWholeScreenDirty();
   171 			break;
   171 			break;
   172 		case 11: /* Road side */
   172 		case 11: /* Road side */
   173 			if (_opt_ptr->road_side != e->dropdown.index) { // only change if setting changed
   173 			if (_opt_ptr->road_side != e->dropdown.index) { // only change if setting changed
   174 				DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_EMPTY));
   174 				DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_00B4_CAN_T_DO_THIS));
   175 				MarkWholeScreenDirty();
   175 				MarkWholeScreenDirty();
   176 			}
   176 			}
   177 			break;
   177 			break;
   178 		case 14: /* Town names */
   178 		case 14: /* Town names */
   179 			if (_game_mode == GM_MENU) {
   179 			if (_game_mode == GM_MENU) {
   212  * @param p1 the side of the road; 0 = left side and 1 = right side
   212  * @param p1 the side of the road; 0 = left side and 1 = right side
   213  * @param p2 unused
   213  * @param p2 unused
   214  */
   214  */
   215 int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   215 int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   216 {
   216 {
   217 	/* Check boundaries and you can only change this if NO vehicles have been built yet */
   217 	/* Check boundaries and you can only change this if NO vehicles have been built yet,
   218 	if (p1 > 1 || RoadVehiclesAreBuilt()) return CMD_ERROR;
   218 	 * except in the intro-menu where of course it's always possible to do so. */
       
   219 	if (p1 > 1 || (_game_mode != GM_MENU && RoadVehiclesAreBuilt())) return CMD_ERROR;
   219 
   220 
   220 	if (flags & DC_EXEC) {
   221 	if (flags & DC_EXEC) {
   221 		_opt_ptr->road_side = p1;
   222 		_opt_ptr->road_side = p1;
   222 		InvalidateWindow(WC_GAME_OPTIONS,0);
   223 		InvalidateWindow(WC_GAME_OPTIONS,0);
   223 	}
   224 	}