Beispiel #1
0
void SelectMouseMode::OnMouseButtonEvent(Viewport *vp, uint8 state)
{
	this->mouse_state = state & MB_CURRENT;
	if (this->mouse_state != 0) {
		FinderData fdata(CS_RIDE | CS_PERSON, false);
		switch (vp->ComputeCursorPosition(&fdata)) {
			case CS_RIDE: {
				RideInstance *ri = _rides_manager.GetRideInstance(fdata.ride);
				if (ri == nullptr) break;
				switch (ri->GetKind()) {
					case RTK_SHOP:
						ShowShopManagementGui(fdata.ride);
						break;

					case RTK_COASTER:
						ShowCoasterManagementGui(ri);
						break;

					default: break; // Other types are not implemented yet.
				}
				break;
			}

			case CS_PERSON:
				ShowGuestInfoGui(fdata.person);
				break;

			default: break;
		}
	}
}
Beispiel #2
0
void RideSelectGui::OnClick(WidgetNumber wid_num, const Point16 &pos)
{
	switch (wid_num) {
		case RSEL_SHOPS:
		case RSEL_GENTLE:
		case RSEL_WET:
		case RSEL_COASTER:
			if (this->SetNewRideKind(wid_num - RSEL_SHOPS)) this->MarkDirty();
			break;

		case RSEL_LIST: {
			const ScrollbarWidget *sb = this->GetWidget<ScrollbarWidget>(RSEL_SCROLL_LIST);
 			this->SetNewRide(sb->GetClickedRow(pos));
			this->MarkDirty();
			break;
		}

		case RSEL_SELECT: {
			if (this->ride_types[this->current_kind] == 0) return;

			if (this->current_ride != -1) {
				const RideType *ride_type = _rides_manager.GetRideType(this->current_ride);
				if (ride_type == nullptr) return;

				uint16 instance = _rides_manager.GetFreeInstance(ride_type);
				if (instance == INVALID_RIDE_INSTANCE) return;

				RideInstance *ri = _rides_manager.CreateInstance(ride_type, instance);

				if (this->current_kind == RTK_SHOP) {
					assert(ride_type->kind == RTK_SHOP);
					ShowRideBuildGui(ri);
				} else {
					assert(ride_type->kind == RTK_COASTER);
					_rides_manager.NewInstanceAdded(instance);
					ShowCoasterManagementGui(ri);
				}
			}
			break;
		}
	}
}