Changeset - r70:ccf7bc6bc5a2
[Not reviewed]
master
0 5 0
darkvater - 20 years ago 2004-08-16 22:35:17
darkvater@openttd.org
(svn r71) -Cheat: [976127] no extra frequent jet crash on small airports (truesatan)
-Changed some debug messages in aircraft code to DEBUG(misc, 1)
5 files changed with 10 insertions and 7 deletions:
0 comments (0 inline, 0 general)
aircraft_cmd.c
Show inline comments
 
@@ -1123,25 +1123,25 @@ static void HandleAircraftLoading(Vehicl
 

	
 
static void MaybeCrashAirplane(Vehicle *v)
 
{
 
	Station *st;
 
	uint16 prob;
 
	int i;
 
	uint16 amt;
 

	
 
	st = DEREF_STATION(v->u.air.targetairport);
 

	
 
	//FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports
 
	prob = 0x10000 / 1500;
 
	if (st->airport_type == AT_SMALL && (_aircraft_subtype[v->engine_type - AIRCRAFT_ENGINES_INDEX]&2)) {
 
	if (st->airport_type == AT_SMALL && (_aircraft_subtype[v->engine_type - AIRCRAFT_ENGINES_INDEX]&2) && !_cheats.no_jetcrash.value) {
 
		prob = 0x10000 / 20;
 
	}
 

	
 
	if ((uint16)Random() > prob)
 
		return;
 

	
 
	// Crash the airplane. Remove all goods stored at the station.
 
	for(i=0; i!=NUM_CARGO; i++) {
 
		st->goods[i].rating = 1;
 
		st->goods[i].waiting_acceptance &= ~0xFFF;
 
	}
 

	
 
@@ -1382,26 +1382,26 @@ static void AircraftEventHandler_AtTermi
 
			else
 
				v->u.air.state = (v->subtype != 0) ? TAKEOFF : HELITAKEOFF;
 
			break;
 
		default:  // orders have been deleted (no orders), goto depot and don't bother us
 
			v->next_order  = OT_NOTHING;
 
			v->u.air.state = HANGAR;
 
	}
 
	AirportMove(v, Airport);
 
}
 

	
 
static void AircraftEventHandler_General(Vehicle *v, const AirportFTAClass *Airport)
 
{
 
	printf("OK, you shouldn't be here, check your Airport Scheme!\n");
 
	assert(1 == v->u.air.state); // when here state is 0, so this always fails
 
	DEBUG(misc, 0) ("OK, you shouldn't be here, check your Airport Scheme!");
 
	assert(0);
 
}
 

	
 
static void AircraftEventHandler_TakeOff(Vehicle *v, const AirportFTAClass *Airport) {
 
	PlayAircraftSound(v); // play takeoffsound for airplanes
 
	v->u.air.state = STARTTAKEOFF;
 
}
 

	
 
static void AircraftEventHandler_StartTakeOff(Vehicle *v, const AirportFTAClass *Airport)
 
{
 
	v->sprite_width = v->sprite_height = 24; // ??? no idea what this is
 
	v->u.air.state = ENDTAKEOFF;
 
}
 
@@ -1556,25 +1556,25 @@ static void AirportGoToNextPosition(Vehi
 
	AirportMove(v, Airport); // move aircraft to next position
 
}
 

	
 
// gets pos from vehicle and next orders
 
static bool AirportMove(Vehicle *v, const AirportFTAClass *Airport)
 
{
 
	AirportFTA *current;
 
	byte prev_pos;
 
	bool retval = false;
 

	
 
	// error handling
 
	if (v->u.air.pos >= Airport->nofelements) {
 
		printf("position %d is not valid for current airport. Max position is %d\n", v->u.air.pos, Airport->nofelements-1);
 
		DEBUG(misc, 0) ("position %d is not valid for current airport. Max position is %d", v->u.air.pos, Airport->nofelements-1);
 
		assert(v->u.air.pos < Airport->nofelements);
 
	}
 

	
 
	current = &Airport->layout[v->u.air.pos];
 
	// we have arrived in an important state (eg terminal, hangar, etc.)
 
	if (current->heading == v->u.air.state) {
 
		prev_pos = v->u.air.pos; // location could be changed in state, so save it before-hand
 
		_aircraft_state_handlers[v->u.air.state](v, Airport);
 
		if (v->u.air.state != FLYING) {v->u.air.previous_pos = prev_pos;}
 
		return true;
 
	}
 

	
 
@@ -1591,26 +1591,26 @@ static bool AirportMove(Vehicle *v, cons
 
	// there are more choices to choose from, choose the one that
 
	// matches our heading
 
	do {
 
		if (v->u.air.state == current->heading || current->heading == TO_ALL) {
 
					if (AirportSetBlocks(v, current, Airport)) {
 
						v->u.air.pos = current->next_position;
 
					} // move to next position
 
					return retval;
 
		}
 
		current = current->next_in_chain;
 
	} while (current != NULL);
 

	
 
	printf("Cannot move further on Airport...! pos:%d state:%d\n", v->u.air.pos, v->u.air.state);
 
	printf("Airport entry point: %d, Vehicle: %d\n", Airport->entry_point, v->index);
 
	DEBUG(misc, 0) ("Cannot move further on Airport...! pos:%d state:%d", v->u.air.pos, v->u.air.state);
 
	DEBUG(misc, 0) ("Airport entry point: %d, Vehicle: %d", Airport->entry_point, v->index);
 
	assert(0);
 
	return false;
 
}
 

	
 
// returns true if the road ahead is busy, eg. you must wait before proceeding
 
static bool AirportHasBlock(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport)
 
{
 
	Station *st;
 
	uint32 airport_flags;
 
	AirportFTA *next, *reference;
 
	reference = &Airport->layout[v->u.air.pos];
 
	next = &Airport->layout[current_pos->next_position];
lang/english.txt
Show inline comments
 
@@ -1018,24 +1018,25 @@ STR_CONFIG_PATCHES_CURRENCY				:{CURRENC
 

	
 
STR_CONFIG_PATCHES_QUERY_CAPT			:{WHITE}Change setting value
 

	
 

	
 
STR_CHEATS										:{WHITE}Cheats
 
STR_CHEATS_TIP								:{BLACK}Checkboxes indicate if you have used this cheat before
 
STR_CHEATS_WARNING						:{BLACK}Warning! You are about to betray your fellow competitors. Keep in mind that such a disgrace will be remembered for eternity.
 
STR_CHEAT_MONEY								:{LTBLUE}Increase money by {CURRENCY64}
 
STR_CHEAT_CHANGE_PLAYER				:{LTBLUE}Playing as player: {ORANGE}{COMMA16}
 
STR_CHEAT_EXTRA_DYNAMITE			:{LTBLUE}Magic bulldozer (remove industries, unmovables): {ORANGE}{STRING}
 
STR_CHEAT_CROSSINGTUNNELS			:{LTBLUE}Tunnels may cross each other: {ORANGE}{STRING}
 
STR_CHEAT_BUILD_IN_PAUSE			:{LTBLUE}Build while in pause mode: {ORANGE}{STRING}
 
STR_CHEAT_NO_JETCRASH					:{LTBLUE}Jetplanes will not crash (frequently) on small airports: {ORANGE} {STRING}
 

	
 
STR_SORT_BY_POPULATION					:{BLACK}Population
 

	
 
STR_HEADING_FOR_CHECKPOINT				:{LTBLUE}Heading for {CHECKPOINT}
 
STR_HEADING_FOR_CHECKPOINT_VEL			:{LTBLUE}Heading for {CHECKPOINT}, {VELOCITY}
 

	
 
STR_GO_TO_CHECKPOINT					:Go via {CHECKPOINT}
 

	
 
STR_CHECKPOINTNAME_CITY					:Checkpoint {TOWN}
 
STR_CHECKPOINTNAME_CITY_SERIAL			:Checkpoint {TOWN} #{COMMA16}
 
STR_LANDINFO_CHECKPOINT					:Checkpoint
 

	
misc_gui.c
Show inline comments
 
@@ -1394,24 +1394,25 @@ static void WriteCE(const CheatEntry *ce
 
	default:
 
		NOT_REACHED();
 
	}
 
}
 

	
 

	
 
static const CheatEntry _cheats_ui[] = {
 
	{CE_CLICK, 0, STR_CHEAT_MONEY, 					&_cheats.money.value, 					&_cheats.money.been_used, 				&ClickMoneyCheat},
 
	{CE_UINT8, 0, STR_CHEAT_CHANGE_PLAYER, 	&_local_player, 								&_cheats.switch_player.been_used,	&ClickChangePlayerCheat, 0, 11, 1},
 
	{CE_BOOL, 0, STR_CHEAT_EXTRA_DYNAMITE,	&_cheats.magic_bulldozer.value,	&_cheats.magic_bulldozer.been_used},
 
	{CE_BOOL, 0, STR_CHEAT_CROSSINGTUNNELS,	&_cheats.crossing_tunnels.value,&_cheats.crossing_tunnels.been_used},
 
	{CE_BOOL, 0, STR_CHEAT_BUILD_IN_PAUSE,	&_cheats.build_in_pause.value,		&_cheats.build_in_pause.been_used},
 
	{CE_BOOL, 0, STR_CHEAT_NO_JETCRASH,			&_cheats.no_jetcrash.value,			&_cheats.no_jetcrash.been_used},
 
};
 

	
 

	
 
static const Widget _cheat_widgets[] = {
 
{   WWT_CLOSEBOX,    14,     0,    10,     0,    13, STR_00C5,			STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,    14,    11,   399,     0,    13, STR_CHEATS,	STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{      WWT_PANEL,    14,     0,   399,    14,   147, 0x0},
 

	
 
{     WWT_IMGBTN,    14,     0,   399,    14,   147, 0x0, STR_CHEATS_TIP},
 
{      WWT_LAST},
 
};
 

	
variables.h
Show inline comments
 
@@ -167,24 +167,25 @@ typedef struct Cheat {
 

	
 

	
 
// WARNING! Do _not_ remove entries in Cheats struct or change the order 
 
// of the existing ones! Would break downward compatibility.
 
// Only add new entries at the end of the struct!
 

	
 
typedef struct Cheats {
 
	Cheat magic_bulldozer;		// dynamite industries, unmovables
 
	Cheat switch_player;			// change to another player
 
	Cheat money;							// get rich
 
	Cheat crossing_tunnels;		// allow tunnels that cross each other
 
	Cheat	build_in_pause;			// build while in pause mode
 
	Cheat	no_jetcrash;				// no jet will crash on small airports anymore
 
} Cheats;
 

	
 
VARDEF Cheats _cheats;
 

	
 
typedef struct Paths {
 
	char *personal_dir;  // includes cfg file and save folder 
 
	char *game_data_dir; // includes data, gm, lang
 
	char *data_dir;
 
	char *gm_dir;
 
	char *lang_dir;
 
	char *save_dir;
 
	char *autosave_dir;
window.c
Show inline comments
 
@@ -1014,25 +1014,25 @@ void MouseLoop()
 
		return;
 
	w = MaybeBringWindowToFront(w);
 
	vp = IsPtInWindowViewport(w, x, y);
 
	if (vp != NULL) {
 
		if (_game_mode == GM_MENU)
 
			return;
 

	
 
		if (mousewheel && !(w->flags4 & WF_DISABLE_VP_SCROLL)) {
 
			ZoomInOrOutToCursor(mousewheel < 0);
 
		}
 

	
 
		if (click == 1) {
 
			DEBUG(misc, 1) ("cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
 
			DEBUG(misc, 2) ("cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
 
			if (_thd.place_mode != 0 &&
 
					// query button and place sign button work in pause mode
 
					!(_cursor.sprite == 0x2CF || _cursor.sprite == 0x2D2) &&
 
					_pause != 0 &&
 
					!_cheats.build_in_pause.value)
 
						return;
 
			
 
			if (_thd.place_mode == 0) {
 
				HandleViewportClicked(vp, x, y);
 
			} else {
 
				PlaceObject();
 
			}
0 comments (0 inline, 0 general)