Exemplo n.º 1
0
int loadgame_simple ()
{
	char home[MAX_PATH], path[MAX_PATH];
	int rc = 0;

	if (get_app_dir (home, MAX_PATH) < 0) {
		message_box ("Error loading game.");
		return err_BadFileOpen;
	}

	sprintf(path, "%s/" DATA_DIR "/%05X.%s/%08d.sav",
		home, game.crc, game.id, 0);

	erase_both();
	stop_sound();
	close_window();

	if ((rc = load_game (path)) == err_OK) {
		message_box ("Game restored.");
		game.exit_all_logics = 1;
		menu_enable_all();
	} else {
		message_box ("Error restoring game.");
	}

	return rc;
}
Exemplo n.º 2
0
int tir_humain(var_game_t * var)
{
   int z;
   int valide = 0;
   SDL_Event event;
   
   message_box(var,"A vous de tirer");
   
   while(valide == 0)
   {
      SDL_WaitEvent(&event);
      
      if(event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT)
      {
         z = transpix_1D(event.button.x,event.button.y);
	 if(z!=-1 && var->mer_cible_hum[z] == -1)
	    valide = 1;
      }
      else
      {
         if(event.type == SDL_QUIT)
	    fin(var,1);
      }
   }
   message_box(var,"Projectile tire");
   FSOUND_PlaySound(FSOUND_FREE,var->tir_sound);
   SDL_Delay(2000);
   return z;
}
Exemplo n.º 3
0
// called when "ok" clicked on the GtkFileChooser
static SIGNAL_CALLBACK void ok_clicked()
{
    GSList *files = gtk_file_chooser_get_filenames(
        GTK_FILE_CHOOSER(browse_widget));
    int n_ok = 0;
    int n_not_ok = 0;

    gtk_widget_hide(browse_widget);
    if (files)
    {
        GSList *iter = files;
        gchar *s=NULL;

        do {
          s = (gchar *) iter->data;
          int ok = add_to_files_list(s);
          if (!ok)
            ++n_not_ok;
          else
            ++n_ok;
          iter =  iter->next;
        }
        while(iter);

        if (n_not_ok > 0) {
          if (s && n_not_ok == 1 && n_ok == 0) {
            // most common case -- adding a single file, and it did not work
            char *msg = MALLOC(sizeof(char)*(strlen(s)+128));
            sprintf(msg,"Unrecognized file:\n  %s\n\n"
                        "The file may be of a type not supported "
                        "by MapReady.\n", s);
            message_box(msg);
            free(msg);
          }
          else if (n_ok == 0) {
            // no files successfully added
            message_box("Couldn't add all of the selected files.\n"
                        "The files may be of a type not supported "
                        "by MapReady.\n");
          }
          else {
            // some were added, some failed
            message_box("Some of the files could not be added.\n"
                        "They may be of a type not supported "
                        "by MapReady.\n");
          }
        }

        // now free up everything
        iter = files;
        do {
          g_free((gchar *) iter->data);
          iter =  iter->next;
        }
        while(iter);
        g_slist_free(files);
    }
}
Exemplo n.º 4
0
SIGNAL_CALLBACK void
on_input_file_selection_ok_button_clicked(GtkWidget *widget)
{
    GtkWidget *file_selection_dialog;
    gchar **selections;
    gchar **current;
    int i, n;

    file_selection_dialog =
        get_widget_checked("input_file_selection");

    selections = gtk_file_selection_get_selections(
        GTK_FILE_SELECTION(file_selection_dialog));

    current = selections;
    i = n = 0;

    while (*current)
    {
      printf("in while loop\n");
        /* second clause here allows silent fail for .L files, PR 92 */
        if ((add_to_files_list(*current) || is_meta_file(*current)) &&
             !is_asf_complex_data((const char *)(*current)))
        {
	  printf("passed conditions - counting up\n");
            ++i;
        }

        ++current;
        ++n;
    }

    if (i != n)
    {
        if (n == 1 || i == 0)
        {
            message_box(
              "Error: Unrecognized file type, file extension, or unsupported "
              "product level.  MapReady\ndoes not currently support Level 0, "
              "complex-valued, or ALOS PRISM or AVNIR2 Level 1A\nand 1B1 "
              "files.\n\n"
              "Please select the leader (.L, LED-, etc) file for product "
              "types higher than Level 0 to\nadd files to the input file "
              "list.\n\n"
              "See 'asf_import' or the ASF SAR Training Processor ('stp') "
              "for more information\non Level 0 processing.\n");
        }
        else
        {
            message_box("Some of the files were not added -- "
                        "unknown types or extensions.");
        }
    }

    g_strfreev(selections);
    gtk_widget_hide(file_selection_dialog);
}
Exemplo n.º 5
0
SIGNAL_CALLBACK void on_add_overlay_button_clicked(GtkWidget *w)
{
    if (!meta_supports_meta_get_latLon(curr->meta)) {
      message_box("Cannot add overlays to an image without "
                  "geolocation information.");
      return;
    }

#ifdef win32
    OPENFILENAME of;
    int retval;
    char fname[1024];

    fname[0] = '\0';

    memset(&of, 0, sizeof(of));

#ifdef OPENFILENAME_SIZE_VERSION_400
    of.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else
    of.lStructSize = sizeof(of);
#endif

    of.hwndOwner = NULL;
    of.lpstrFilter =
        "Shape Files (*.shp)\0*.shp\0"
        "Generic CSV Files (*.csv)\0*.csv\0"
        "All Files\0*\0";
    of.lpstrCustomFilter = NULL;
    of.nFilterIndex = 1;
    of.lpstrFile = fname;
    of.nMaxFile = sizeof(fname);
    of.lpstrFileTitle = NULL;
    of.lpstrInitialDir = ".";
    of.lpstrTitle = "Select File";
    of.lpstrDefExt = NULL;
    of.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;

    retval = GetOpenFileName(&of);

    if (!retval) {
        if (CommDlgExtendedError())
            message_box("File dialog box error");
        return;
    }

    add_overlay_file(fname);

#else // #ifdef win32

    if (!add_overlay_widget)
        create_file_chooser_dialog();

    gtk_widget_show(add_overlay_widget);
#endif // #ifdef win32
}
Exemplo n.º 6
0
NOEXPORT int service_user(DWORD sig) {
    SC_HANDLE scm, service;
    SERVICE_STATUS serviceStatus;

    scm=OpenSCManager(0, 0, SC_MANAGER_CONNECT);
    if(!scm) {
        error_box(TEXT("OpenSCManager"));
        return 1;
    }
    service=OpenService(scm, SERVICE_NAME,
        SERVICE_QUERY_STATUS|SERVICE_USER_DEFINED_CONTROL);
    if(!service) {
        error_box(TEXT("OpenService"));
        CloseServiceHandle(scm);
        return 1;
    }
    if(!QueryServiceStatus(service, &serviceStatus)) {
        error_box(TEXT("QueryServiceStatus"));
        CloseServiceHandle(service);
        CloseServiceHandle(scm);
        return 1;
    }
    if(serviceStatus.dwCurrentState==SERVICE_STOPPED) {
        message_box(TEXT("The service is stopped"), MB_ICONERROR);
        CloseServiceHandle(service);
        CloseServiceHandle(scm);
        return 1;
    }
    if(!ControlService(service, SERVICE_CONTROL_USER+sig, &serviceStatus)) {
        error_box(TEXT("ControlService"));
        CloseServiceHandle(service);
        CloseServiceHandle(scm);
        return 1;
    }
    switch(sig) {
        case SIGNAL_RELOAD_CONFIG:
            message_box(TEXT("Service configuration reloaded"),
                MB_ICONINFORMATION);
            break;
        case SIGNAL_REOPEN_LOG:
            message_box(TEXT("Service log file reopened"),
                MB_ICONINFORMATION);
            break;
        default:
            message_box(TEXT("Undefined operation requested"),
                MB_ICONINFORMATION);
    }
    CloseServiceHandle(service);
    CloseServiceHandle(scm);
    return 0;
}
Exemplo n.º 7
0
int save_settings()
{
    Settings *s = settings_new_from_gui();
    if (!is_dir(s->csv_dir)) {
        message_box("CSV Directory doesn't exist.");
        return FALSE;
    }
    if (!is_dir(s->output_dir)) {
        message_box("Output Directory doesn't exist.");
        return FALSE;
    }
    settings_save(s);
    settings_free(s);
    return TRUE;
}
Exemplo n.º 8
0
/* str.c functions are not safe to use here */
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
#endif /* __GNUC__ */
void fatal_debug(char *txt, const char *file, int line) {
    char msg[80];
#ifdef USE_WIN32
    DWORD num;
#ifdef UNICODE
    TCHAR tmsg[80];
#endif
#endif /* USE_WIN32 */

    snprintf(msg, sizeof msg, /* with newline */
        "INTERNAL ERROR: %s at %s, line %d\n", txt, file, line);

    if(outfile) {
#ifdef USE_WIN32
        WriteFile(outfile->fh, msg, (DWORD)strlen(msg), &num, NULL);
#else /* USE_WIN32 */
        /* no file -> write to stderr */
        /* no meaningful way here to handle the result */
        write(outfile ? outfile->fd : 2, msg, strlen(msg));
#endif /* USE_WIN32 */
    }

#ifndef USE_WIN32
    if(log_mode!=LOG_MODE_CONFIGURED || global_options.option.log_stderr) {
        fputs(msg, stderr);
        fflush(stderr);
    }
#endif /* !USE_WIN32 */

    snprintf(msg, sizeof msg, /* without newline */
        "INTERNAL ERROR: %s at %s, line %d", txt, file, line);

#if !defined(USE_WIN32) && !defined(__vms)
    if(global_options.option.log_syslog)
        syslog(LOG_CRIT, "%s", msg);
#endif /* USE_WIN32, __vms */

#ifdef USE_WIN32
#ifdef UNICODE
    if(MultiByteToWideChar(CP_UTF8, 0, msg, -1, tmsg, 80))
        message_box(tmsg, MB_ICONERROR);
#else
    message_box(msg, MB_ICONERROR);
#endif
#endif /* USE_WIN32 */

    abort();
}
Exemplo n.º 9
0
NOEXPORT int service_install(LPSTR command_line) {
    SC_HANDLE scm, service;
    char stunnel_exe_path[MAX_PATH], *service_path;

    scm=OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
    if(!scm) {
        error_box("OpenSCManager");
        return 1;
    }
    GetModuleFileName(0, stunnel_exe_path, MAX_PATH);
    service_path=str_printf("\"%s\" -service %s", stunnel_exe_path, command_line);
    service=CreateService(scm, SERVICE_NAME, SERVICE_NAME, SERVICE_ALL_ACCESS,
        SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS,
        SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, service_path,
        NULL, NULL, NULL, NULL, NULL);
    str_free(service_path);
    if(!service) {
        error_box("CreateService");
        CloseServiceHandle(scm);
        return 1;
    }
    message_box("Service installed", MB_ICONINFORMATION);
    CloseServiceHandle(service);
    CloseServiceHandle(scm);
    return 0;
}
Exemplo n.º 10
0
void dessin_bateau_precedent(var_game_t * var, int bateau)
{
   int j,k;
   SDL_Rect position;
   /*on redessine le fond avec les bateaux deja pose*/
   SDL_BlitSurface(var->background,NULL,var->ecran,&(var->position_back));
   message_box(var,"placement des bateaux");
   /*redessinage des bateaux precedemment poses*/
   for(j=0;j<bateau;j++)
   {
      if(var->flotte_hum[j].sens == 0)
      {
         position.y = 350 + 30*var->flotte_hum[j].y;
         for(k=0;k<var->flotte_hum[j].taille;k++)
         {
            position.x = 400 + 30*var->flotte_hum[j].x + 30*k ;
            SDL_BlitSurface(var->frag_bat,NULL,var->ecran,&position);
         }
      }
      else
      {
         position.x = 400 + 30*var->flotte_hum[j].x;
         for(k=0;k<var->flotte_hum[j].taille;k++)
         {
            position.y = 350 + 30*var->flotte_hum[j].y + 30*k ;
            SDL_BlitSurface(var->frag_bat,NULL,var->ecran,&position);
         }
      }
   }
}
Exemplo n.º 11
0
// bottom right of screen
void notice(const char *fmt, ...)
{
	char txt[100]; va_list ap;
	va_start(ap,fmt); vsnprintf(txt, 100, fmt, ap); va_end(ap);
	workarea mon; monitor_active(&mon);
	message_box(SAYMS, mon.x+mon.w-1, mon.y+mon.h-1, config_title_fg, config_title_bg, config_title_bc, txt);
}
Exemplo n.º 12
0
gboolean is_python_and_goagent_path(char *python_path,char *goagent_path)
{
	if(python_path==NULL)
	{
		message_box(NULL,_("You Should Set Python Path!"));
		return FALSE;
	}

	if(goagent_path==NULL)
	{
		message_box(NULL,_("You Should Set GoAgent Path!"));
		return FALSE;
	}

	return TRUE;
}
Exemplo n.º 13
0
void save_config_clicked(GtkWidget *w, gpointer data)
{
	if (current->name == "Default")
	{
		message_box("You cannot overwrite the default colour scheme.", GTK_MESSAGE_INFO);
		return;
	}

	col_config_t ccfg;
	ccfg.name = current->name;

	ccfg.add("background", col_background);
	ccfg.add("hilight", col_hilight);
	ccfg.add("selection", col_selection);
	ccfg.add("moving", col_moving);
	ccfg.add("tagged", col_tagged);
	ccfg.add("vertex", col_vertex);
	ccfg.add("line_solid", col_line_solid);
	ccfg.add("line_2s", col_line_2s);
	ccfg.add("line_monster", col_line_monster);
	ccfg.add("line_special", col_line_special);
	ccfg.add("linedraw", col_linedraw);
	ccfg.add("selbox", col_selbox);
	ccfg.add("selbox_line", col_selbox_line);
	ccfg.add("grid", col_grid);
	ccfg.add("64grid", col_64grid);
	ccfg.add("3d_crosshair", col_3d_crosshair);
	ccfg.add("3d_hilight", col_3d_hilight);
	ccfg.add("3d_hilight_line", col_3d_hilight_line);

	ccfg.path = parse_string("config/colours/%s.cfg", ccfg.name.c_str());
	ccfg.save();
	//current->save();
}
Exemplo n.º 14
0
/* Drive related UI.  */
int ui_extend_image_dialog(void)
{
    if (message_box("VICE QUESTION", "Do you want to extend the disk image?", MESSAGE_YESNO) == 0) {
        return 1;
    }
    return 0;
}
Exemplo n.º 15
0
dialog_box_id message_box(
	const basic_lpstr<const Char> &Text,
	const basic_lpstr<const Char> &Caption,
	const message_box_style &Type)
{
	return message_box(hwnd(), Text, Caption, Type);
}
Exemplo n.º 16
0
void check_map_stats()
{
	string msg = parse_string("Vertices: %d\nLines: %d\nSides: %d\nSectors: %d\nThings: %d",
								map.n_verts, map.n_lines, map.n_sides, map.n_sectors, map.n_things);

	message_box(msg, GTK_MESSAGE_INFO);
}
Exemplo n.º 17
0
void upload_goagent(GtkWidget *widget,UP_DATA *data)
{
	if(data->off)
	{
		message_box(widget,_("Upload Now!"));
		return;
	}

	if(!is_python_and_goagent_path(data->python_path,data->goagent_path))
		return;

	//chdir(data->goagent_path);

	if((data->pid=forkpty(&data->pty,NULL,NULL,NULL))==0)
	{
		if(execl(data->python_path,"python_upload",
			get_uploader_path(data->goagent_path),NULL)==-1)
		{
			write(STDERR_FILENO,_("Error Python Path!"),
					strlen(_("Error Python Path!")));
			_exit(-1);
		}
	}

	g_idle_add((GSourceFunc)_upload_goagent,data);
	data->off=1;
}
Exemplo n.º 18
0
// bottom left of screen
void notification(int delay, const char *fmt, ...)
{
	char txt[100]; va_list ap;
	va_start(ap,fmt); vsnprintf(txt, 100, fmt, ap); va_end(ap);
	workarea mon; monitor_active(&mon);
	message_box(delay, mon.x, mon.y+mon.h-1, config_title_fg, config_title_bg, config_title_bc, txt);
}
Exemplo n.º 19
0
int loadgame_dialog ()
{
	char home[MAX_PATH], path[MAX_PATH];
	int rc, slot = 0;
	int hm, vm, hp, vp;			/* box margins */
	int w;

	hm = 2; vm = 3;
	hp = hm * CHAR_COLS; vp = vm * CHAR_LINES;
	w = (40 - 2 * hm) - 1;

	if (get_app_dir (home, MAX_PATH) < 0) {
		message_box ("Error loading game.");
		return err_BadFileOpen;
	}

	sprintf (path, "%s/" DATA_DIR "/%05X.%s/", home, game.crc, game.id);

	erase_both();
	stop_sound();

	draw_window (hp, vp, GFX_WIDTH - hp, GFX_HEIGHT - vp);
	print_text ("Select a game which you wish to\nrestore:",
		0, hm + 1, vm + 1, w, MSG_BOX_TEXT, MSG_BOX_COLOUR);
	print_text ("Press ENTER to select, ESC cancels",
		0, hm + 1, vm + 17, w, MSG_BOX_TEXT, MSG_BOX_COLOUR);

	slot = select_slot (path);

	if (slot < 0) {
		message_box ("Game NOT restored.");
		return err_OK;
	}

	sprintf(path, "%s/" DATA_DIR "/%05X.%s/%08d.sav",
		home, game.crc, game.id, slot);

	if ((rc = load_game (path)) == err_OK) {
		message_box ("Game restored.");
		game.exit_all_logics = 1;
		menu_enable_all();
	} else {
		message_box ("Error restoring game.");
	}

	return rc;
}
Exemplo n.º 20
0
NOEXPORT int service_stop(void) {
    SC_HANDLE scm, service;
    SERVICE_STATUS serviceStatus;

    scm=OpenSCManager(0, 0, SC_MANAGER_CONNECT);
    if(!scm) {
        error_box(TEXT("OpenSCManager"));
        return 1;
    }
    service=OpenService(scm, SERVICE_NAME, SERVICE_QUERY_STATUS|SERVICE_STOP);
    if(!service) {
        error_box(TEXT("OpenService"));
        CloseServiceHandle(scm);
        return 1;
    }
    if(!QueryServiceStatus(service, &serviceStatus)) {
        error_box(TEXT("QueryServiceStatus"));
        CloseServiceHandle(service);
        CloseServiceHandle(scm);
        return 1;
    }
    if(serviceStatus.dwCurrentState==SERVICE_STOPPED) {
        message_box(TEXT("The service is already stopped"), MB_ICONERROR);
        CloseServiceHandle(service);
        CloseServiceHandle(scm);
        return 1;
    }
    if(!ControlService(service, SERVICE_CONTROL_STOP, &serviceStatus)) {
        error_box(TEXT("ControlService"));
        CloseServiceHandle(service);
        CloseServiceHandle(scm);
        return 1;
    }
    do {
        Sleep(1000);
        if(!QueryServiceStatus(service, &serviceStatus)) {
            error_box(TEXT("QueryServiceStatus"));
            CloseServiceHandle(service);
            CloseServiceHandle(scm);
            return 1;
        }
    } while(serviceStatus.dwCurrentState!=SERVICE_STOPPED);
    message_box(TEXT("Service stopped"), MB_ICONINFORMATION);
    CloseServiceHandle(service);
    CloseServiceHandle(scm);
    return 0;
}
Exemplo n.º 21
0
int lua_panic_function(lua_State *state){
	std::stringstream stream;
	stream << "Lua threw an error: " << lua_tostring(state, -1);
	auto interpreter = get_interpreter(state);
	interpreter->message_box(nullptr, stream.str().c_str(), true);
	throw LuaStackUnwind();
	return 0;
}
Exemplo n.º 22
0
bool yes_no_message(QWidget* parent, const QString& title, const QString& message)
{
	Message_box message_box(
		QMessageBox::Question, title, message,
		QMessageBox::Yes | QMessageBox::No, parent
	);
	message_box.setDefaultButton(QMessageBox::No);
	return message_box.exec() == QMessageBox::Yes;
}
Exemplo n.º 23
0
void GeneralPane::GenerateNewIdentity()
{
  DolphinAnalytics::Instance()->GenerateNewIdentity();
  QMessageBox message_box(this);
  message_box.setIcon(QMessageBox::Information);
  message_box.setWindowTitle(tr("Identity Generation"));
  message_box.setText(tr("New identity generated."));
  message_box.exec();
}
Exemplo n.º 24
0
void new_file(void)
{
#ifdef win32
    OPENFILENAME of;
    int retval;
    char fname[1024];

    fname[0] = '\0';

    memset(&of, 0, sizeof(of));

#ifdef OPENFILENAME_SIZE_VERSION_400
    of.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else
    of.lStructSize = sizeof(of);
#endif

    of.hwndOwner = NULL;
    of.lpstrFilter = "CEOS Level 1 Data Files (*.D)\0*.D\0"
        "ALOS Image (IMG-*)\0IMG-*\0"
        "ASF Internal (*.img)\0*.img\0"
        "AirSAR (*.vvi2,*.demi2,*.corgr)\0*.vvi2;*.demi2;*.corgr\0"
        "GeoTIFF Image (*.tif)\0*.tif\0"
        "JPG (*.jpg)\0*.jpg\0"
        "PNG (*.png)\0*.png\0"
        "PGM (*.pgm)\0*.pgm\0"
        "ENVI (*.hdr)\0*.hdr\0"
        "ROI_PAC (*.rsc)\0*.rsc\0"
        "All Files\0*\0";
    of.lpstrCustomFilter = NULL;
    of.nFilterIndex = 1;
    of.lpstrFile = fname;
    of.nMaxFile = sizeof(fname);
    of.lpstrFileTitle = NULL;
    of.lpstrInitialDir = ".";
    of.lpstrTitle = "Select File";
    of.lpstrDefExt = NULL;
    of.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;

    retval = GetOpenFileName(&of);

    if (!retval) {
        if (CommDlgExtendedError())
            message_box("File dialog box error");
        return;
    }

    load_file(fname);

#else // #ifdef win32

    if (!browse_widget)
        create_file_chooser_dialog();

    gtk_widget_show(browse_widget);
#endif // #ifdef win32
}
Exemplo n.º 25
0
void save_config(FILE **fp,CONFDATA *data)
{
	if(data->save)
	{
		message_box(NULL,_("Saved"));
		return;
	}

	//remove(get_conf_file_path());
	fclose(*fp);

	/*关闭并重启打开这个文件
	 * 以写的方式将所有的配置重新写回到配置文件
	 */
	if((*fp=fopen(get_conf_file_path(),"w"))==NULL)
		message_box(NULL,strerror(errno));

	fputs("#Python Path\n\npython_path ",*fp);
	fputs(data->python_path,*fp);
	fputs("\n\n#GoAgent Path\n\ngoagent_path ",*fp);
	fputs(data->goagent_path,*fp);
	fputs("\n\n#Language\n\nlanguage_env ",*fp);
	fputs(data->language_env,*fp);
	fputs("\n\n#Gtk GoAgent Path\n\ngtk_goagent_path ",*fp);
	fputs(data->gtk_goagent_path,*fp);
	fputs("\n\n#Font\n\nfont ",*fp);
	GtkWidget *entry;
	fputs(data->font,*fp);
	fputs("\n\n#GoAgent Auto Upgrade\n\ngoagent_auto_upgrade ",*fp);
	fputs(data->goagent_auto_upgrade,*fp);
	/*fputs("\n\n#Gtk GoAgent Auto Upgrade\n\ngtk_goagent_auto_upgrade ",
			*fp);
	fputs(data->gtk_goagent_auto_upgrade,*fp);*/
	fputs("\n\n#End Of Gtk GoAgent Config File\n",*fp);

	fclose(*fp);

	/*再重启以只读方式打开
	 * 做到保存不影响其它配置操作
	 */
	*fp=fopen(get_conf_file_path(),"r");

	data->save=TRUE;
}
Exemplo n.º 26
0
void * recept_rep(var_game_t * var )
{
   long rep_tir;
   int x,y;
   SDL_Rect position;
   
   /*mise en attente de la reception de la reponse*/
   if(recv(var->sock_client, &rep_tir, sizeof(long),0) == -1)
   {
      fprintf(var->log_erreur,"Erreur reception reponse\n");
      fclose(var->log_erreur);
      exit(EXIT_FAILURE);
   }
   else
   {
      rep_tir = ntohl(rep_tir);
      trans1D_2D(var->z,&x,&y);
      position.x = 400 + 30*x;
      position.y = 25 + 30*y;
      
      /*MAJ de la matrice cible du joueur*/
      var->mer_cible_hum[var->z] = (int)rep_tir;
      switch(rep_tir)
      {
         case 0: message_box(var,"Votre tir a rate");
	         SDL_BlitSurface(var->rate,NULL,var->ecran,&position);
		 FSOUND_PlaySound(FSOUND_FREE,var->rate_sound);
                 break;
         case 1: message_box(var,"Votre tir a touche");
	         SDL_BlitSurface(var->touche,NULL,var->ecran,&position);
		 FSOUND_PlaySound(FSOUND_FREE,var->touche_sound);
                 break;
         case 2: var->remain_bat_cpu--;
	         affich_score(var,1);
	         message_box(var,"Votre tir a coule un bateau");
	         SDL_BlitSurface(var->touche,NULL,var->ecran,&position);
		 FSOUND_PlaySound(FSOUND_FREE,var->coule_sound);
                 break;
      }

   }
   SDL_Flip(var->ecran);
   pthread_exit(NULL);
}
Exemplo n.º 27
0
Arquivo: gvcbeta.c Projeto: 131/gsview
int beta_warn(void)
{
  TCHAR buf[256];
  TCHAR mess[MAXSTR];
  load_string(IDS_BETAWARN, mess, sizeof(mess)/sizeof(TCHAR)-1);
  wsprintf(buf, mess, BETA_YEAR, BETA_MONTH, BETA_DAY);
  if (message_box(buf, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK)
      return 1;
  return beta();
}
Exemplo n.º 28
0
Arquivo: gvcbeta.c Projeto: 131/gsview
int beta(void)
{
  if (beta_expired()) {
    TCHAR buf[MAXSTR];
    load_string(IDS_BETAEXPIRED, buf, sizeof(buf)/sizeof(TCHAR)-1);
    message_box(buf, MB_OK | MB_ICONHAND);
    return 1;
  }
  return 0;
}
Exemplo n.º 29
0
int loadgame_simple ()
{
	char home[MAX_PATH], path[MAX_PATH];
	int rc = 0;
        printf("here?\n");

#ifdef DREAMCAST
	uint8 addr, port, unit;

	addr = maple_first_vmu();
	if (addr) {
		maple_create_port (addr, &port, &unit);
		sprintf (g_vmu_port, "%c%d", port + 'a', unit);
	} else {
		message_box("No VMU found.");
		return err_OK;
	}

	sprintf(path, VMU_PATH, g_vmu_port, game.id, slot);
#else	
	if (get_app_dir (home, MAX_PATH) < 0) {
		message_box ("Error loading game.");
		return err_BadFileOpen;
	}

	sprintf(path, "%s/" DATA_DIR "/%05X.%s/%08d.sav",
		home, game.crc, game.id, 0);
#endif

	erase_both();
	stop_sound();
	close_window();

	if ((rc = load_game (path)) == err_OK) {
		message_box ("Game restored.");
		game.exit_all_logics = 1;
		menu_enable_all();
	} else {
		message_box ("Error restoring game.");
	}

	return rc;
}
Exemplo n.º 30
0
// Tokenizer::check_token: Checks the current token
// --------------------------------------------- >>
bool Tokenizer::check_token(string check)
{
	if (get_token() == check)
		return true;
	else
	{
		message_box("Error: \"" + check + "\" expected!", GTK_MESSAGE_ERROR);
		return false;
	}
}