コード例 #1
0
ファイル: client.c プロジェクト: teknoa/freeciv-android
JNIEXPORT void JNICALL Java_net_hackcasual_freeciv_NativeHarness_sendNativeCommand
  (JNIEnv * env, jobject obj, jint command) {

	civ_lock();
	switch (command) {
	case COM_GO_TO: key_unit_goto(); break;
	case COM_BUILD_CITY: key_unit_build_city(); break;
	case COM_END_TURN: dsend_packet_player_phase_done(&client.conn, game.info.turn); break;
	case COM_EXPLORE: key_unit_auto_explore(); break;
	case COM_AUTO_WORKER: key_unit_auto_settle(); break;
	case COM_SENTRY: key_unit_sentry(); break;
	case COM_FORTIFY: key_unit_fortify(); break;
	case COM_DISBAND: key_unit_disband(); break;
	case COM_ROAD: key_unit_road(); break;
	case COM_IRRIGATION: key_unit_irrigate(); break;
	case COM_CONNECT_ROAD: key_unit_connect(ACTIVITY_ROAD); break;
	case COM_CONNECT_IRRIGATION: key_unit_connect(ACTIVITY_IRRIGATE); break;
	case COM_CONNECT_RAILROAD: key_unit_connect(ACTIVITY_RAILROAD); break;
	case COM_WAIT: key_unit_wait(); break;
	case COM_BUILD_WONDER: key_unit_build_wonder(); break;
	case COM_TRADE_ROUTE: key_unit_trade_route(); break;
	case COM_MINE: key_unit_mine(); break;
	case COM_TRANSFORM: key_unit_transform(); break;
	case COM_FORTRESS: key_unit_fortress(); break;
	case COM_AIRBASE: key_unit_airbase(); break;
	case COM_POLLUTION: key_unit_pollution(); break;
	case COM_FALLOUT: key_unit_fallout(); break;
	case COM_PARADROP: key_unit_paradrop(); break;
	case COM_PILLAGE: key_unit_pillage(); break;
	case COM_HOMECITY: key_unit_homecity(); break;
	case COM_UNLOAD_TRANSPORT: key_unit_unload_all(); break;
	case COM_LOAD:
		unit_list_iterate(get_units_in_focus(), punit) {
			request_unit_load(punit, NULL);
		} unit_list_iterate_end;
		break;
	case COM_UNLOAD:
	      unit_list_iterate(get_units_in_focus(), punit) {
	    	  request_unit_unload(punit);
	      } unit_list_iterate_end;
コード例 #2
0
ファイル: menu.c プロジェクト: jheusala/freeciv-extended
/**************************************************************************
  ...
**************************************************************************/
static int unit_order_callback(struct widget *pOrder_Widget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct unit *pUnit = head_of_units_in_focus();
  
    set_wstate(pOrder_Widget, FC_WS_SELLECTED);
    pSellected_Widget = pOrder_Widget;
  
    if (!pUnit) {
      return -1;
    }
  
    switch (pOrder_Widget->ID) {
    case ID_UNIT_ORDER_BUILD_CITY:
      /* Enable the button for adding to a city in all cases, so we
         get an eventual error message from the server if we try. */
      key_unit_build_city();
      break;
    case ID_UNIT_ORDER_BUILD_WONDER:
      key_unit_build_wonder();
      break;
    case ID_UNIT_ORDER_ROAD:
      key_unit_road();
      break;
    case ID_UNIT_ORDER_TRADE_ROUTE:
      key_unit_trade_route();
      break;
    case ID_UNIT_ORDER_IRRIGATE:
      key_unit_irrigate();
      break;
    case ID_UNIT_ORDER_MINE:
      key_unit_mine();
      break;
    case ID_UNIT_ORDER_TRANSFORM:
      key_unit_transform();
      break;
    case ID_UNIT_ORDER_FORTRESS:
      key_unit_fortress();
      break;
    case ID_UNIT_ORDER_FORTIFY:
      key_unit_fortify();
      break;
    case ID_UNIT_ORDER_AIRBASE:
      key_unit_airbase();
      break;
    case ID_UNIT_ORDER_POLLUTION:
      key_unit_pollution();
      break;
    case ID_UNIT_ORDER_PARADROP:
      key_unit_paradrop();
      break;
    case ID_UNIT_ORDER_FALLOUT:
      key_unit_fallout();
      break;
    case ID_UNIT_ORDER_SENTRY:
      key_unit_sentry();
      break;
    case ID_UNIT_ORDER_PILLAGE:
      key_unit_pillage();
      break;
    case ID_UNIT_ORDER_HOMECITY:
      key_unit_homecity();
      break;
    case ID_UNIT_ORDER_UNLOAD_TRANSPORTER:
      key_unit_unload_all();
      break;
    case ID_UNIT_ORDER_LOAD:
      unit_list_iterate(get_units_in_focus(), punit) {
        request_unit_load(punit, NULL);
      } unit_list_iterate_end;
      break;
    case ID_UNIT_ORDER_UNLOAD:
      unit_list_iterate(get_units_in_focus(), punit) {
        request_unit_unload(punit);
      } unit_list_iterate_end;
      break;
    case ID_UNIT_ORDER_WAKEUP_OTHERS:
      key_unit_wakeup_others();
      break;
    case ID_UNIT_ORDER_AUTO_SETTLER:
      unit_list_iterate(get_units_in_focus(), punit) {
        request_unit_autosettlers(punit);
      } unit_list_iterate_end;
コード例 #3
0
static PyObject* python_key_unit_trade_route(PyObject* self, PyObject* args) {
	if(PyArg_ParseTuple(args, "") == 0) return NULL;
	key_unit_trade_route();
	return Py_BuildValue("i", 0);
}