ちゃんとした値が帰って来ない
Posted: 2015年6月03日(水) 07:17
すみません 以下のようなソースがあるのですが関数RE_yで値を返してもらいたいのですが使用しようとすると0が入ってるようでうまく行きません。
どうしたらちゃんとした値が帰ってってきますでしょうか?
どうしたらちゃんとした値が帰ってってきますでしょうか?
――――skill_f_read の関数――――
static struct{
char *exp; //説明
}skill[5]={
{ "知恵をめぐらせて良い考えが浮かぶまで待とう。" }
}
void skill_f_read( int mode , int num , int num2 , int num3 , void *pp ){
switch( mode ){
case 0: *(char **)pp = skill[ num ].exp; break;
}
}
――――本文――――
int skill_num2;
char *ds2;
skill_f_read( 0 , 0 , 0 , 0 , &ds2 );
DrawFormatStringToHandle( 100 , 100 , m_col , MG_12_0 , "説 明 : " );
mozi_show( 200 , 100 , 50 , 13 , m_col , MG_12_0 , ds2 );
skill_num2 = RE_y() + 1 ; //RE_y()の値が0になる 他の箇所では正常に動いていたのに
――――RE_y と mozi_show の関数――――
#include "DxLib.h"
#include <stdarg.h>
#include <assert.h>
static int Re_y;
int RE_y( void ){
return Re_y;
}
void kai( int *x , int *y ){ //改行
*x = 0;
*y += 1;
}
int JC( unsigned char code ){ //1文字か2文字の識別
if( ( code >= 0x81 && code <= 0x9F ) ||
( code >= 0xE0 && code <= 0xFC ) ) {
return 1;
}
return 0;
}
void mozi_show( int x , int y , int xm , int yb , int color , int font , const char *s , ... ){
int xs = 0 , ys = 0;
int m_color = color;
int char_set = font;
char One[ 2 ];
char Two[ 3 ];
char Three[ 4 ];
const char *p;
va_list args;
va_start( args , s );
p = s;
while( *p != '\0' ){
switch( *p ){
default:
if( JC( *p ) ){
Two[ 0 ] = *p;
Two[ 1 ] = *( p + 1 );
Two[ 2 ] = '\0';
DrawStringToHandle( x + xs , y + ys * yb , Two , m_color , char_set );
xs += GetDrawStringWidthToHandle( Two , 2 , char_set );
p += 2;
}
else{
One[ 0 ] = *p;
One[ 1 ] = '\0';
DrawStringToHandle( x + xs , y + ys * yb , One , m_color , char_set );
xs += GetDrawStringWidthToHandle( One , 1 , char_set );
p++;
}
break;
}
if( xs > xm ){
kai( &xs , &ys );
}
}
va_end( args );
Re_y = ys;
}