@@ -28,13 +28,13 @@ static message_handler mhandler = default_message_handler;
2828static byte buffer[0x100000 ];
2929static std::set<duel*> duel_set;
3030
31- OCGAPI void set_script_reader (script_reader f) {
31+ OCGCORE_API void set_script_reader (script_reader f) {
3232 sreader = f;
3333}
34- OCGAPI void set_card_reader (card_reader f) {
34+ OCGCORE_API void set_card_reader (card_reader f) {
3535 creader = f;
3636}
37- OCGAPI void set_message_handler (message_handler f) {
37+ OCGCORE_API void set_message_handler (message_handler f) {
3838 mhandler = f;
3939}
4040byte* read_script (const char * script_name, int * len) {
@@ -50,7 +50,7 @@ uint32_t read_card(uint32_t code, card_data* data) {
5050uint32_t handle_message (void * pduel, uint32_t message_type) {
5151 return mhandler ((intptr_t )pduel, message_type);
5252}
53- OCGAPI byte* default_script_reader (const char * script_name, int * slen) {
53+ OCGCORE_API byte* default_script_reader (const char * script_name, int * slen) {
5454 FILE *fp;
5555 fp = std::fopen (script_name, " rb" );
5656 if (!fp)
@@ -62,13 +62,13 @@ OCGAPI byte* default_script_reader(const char* script_name, int* slen) {
6262 *slen = (int )len;
6363 return buffer;
6464}
65- OCGAPI intptr_t create_duel (uint_fast32_t seed) {
65+ OCGCORE_API intptr_t create_duel (uint_fast32_t seed) {
6666 duel* pduel = new duel ();
6767 duel_set.insert (pduel);
6868 pduel->random .reset (seed);
6969 return (intptr_t )pduel;
7070}
71- OCGAPI void start_duel (intptr_t pduel, uint32_t options) {
71+ OCGCORE_API void start_duel (intptr_t pduel, uint32_t options) {
7272 duel* pd = (duel*)pduel;
7373 uint16_t duel_rule = options >> 16 ;
7474 uint16_t duel_options = options & 0xffff ;
@@ -113,14 +113,14 @@ OCGAPI void start_duel(intptr_t pduel, uint32_t options) {
113113 }
114114 pd->game_field ->add_process (PROCESSOR_TURN , 0 , 0 , 0 , 0 , 0 );
115115}
116- OCGAPI void end_duel (intptr_t pduel) {
116+ OCGCORE_API void end_duel (intptr_t pduel) {
117117 duel* pd = (duel*)pduel;
118118 if (duel_set.count (pd)) {
119119 duel_set.erase (pd);
120120 delete pd;
121121 }
122122}
123- OCGAPI void set_player_info (intptr_t pduel, int32_t playerid, int32_t lp, int32_t startcount, int32_t drawcount) {
123+ OCGCORE_API void set_player_info (intptr_t pduel, int32_t playerid, int32_t lp, int32_t startcount, int32_t drawcount) {
124124 if (!check_playerid (playerid))
125125 return ;
126126 duel* pd = (duel*)pduel;
@@ -131,25 +131,25 @@ OCGAPI void set_player_info(intptr_t pduel, int32_t playerid, int32_t lp, int32_
131131 if (drawcount >= 0 )
132132 pd->game_field ->player [playerid].draw_count = drawcount;
133133}
134- OCGAPI void get_log_message (intptr_t pduel, char * buf) {
134+ OCGCORE_API void get_log_message (intptr_t pduel, char * buf) {
135135 duel* pd = (duel*)pduel;
136136 buf[0 ] = ' \0 ' ;
137137 std::strncat (buf, pd->strbuffer , sizeof pd->strbuffer - 1 );
138138}
139- OCGAPI int32_t get_message (intptr_t pduel, byte* buf) {
139+ OCGCORE_API int32_t get_message (intptr_t pduel, byte* buf) {
140140 int32_t len = ((duel*)pduel)->read_buffer (buf);
141141 ((duel*)pduel)->clear_buffer ();
142142 return len;
143143}
144- OCGAPI uint32_t process (intptr_t pduel) {
144+ OCGCORE_API uint32_t process (intptr_t pduel) {
145145 duel* pd = (duel*)pduel;
146146 uint32_t result = 0 ;
147147 do {
148148 result = pd->game_field ->process ();
149149 } while ((result & PROCESSOR_BUFFER_LEN ) == 0 && (result & PROCESSOR_FLAG ) == 0 );
150150 return result;
151151}
152- OCGAPI void new_card (intptr_t pduel, uint32_t code, uint8_t owner, uint8_t playerid, uint8_t location, uint8_t sequence, uint8_t position) {
152+ OCGCORE_API void new_card (intptr_t pduel, uint32_t code, uint8_t owner, uint8_t playerid, uint8_t location, uint8_t sequence, uint8_t position) {
153153 if (!check_playerid (owner) || !check_playerid (playerid))
154154 return ;
155155 duel* ptduel = (duel*)pduel;
@@ -167,7 +167,7 @@ OCGAPI void new_card(intptr_t pduel, uint32_t code, uint8_t owner, uint8_t playe
167167 }
168168 }
169169}
170- OCGAPI void new_tag_card (intptr_t pduel, uint32_t code, uint8_t owner, uint8_t location) {
170+ OCGCORE_API void new_tag_card (intptr_t pduel, uint32_t code, uint8_t owner, uint8_t location) {
171171 duel* ptduel = (duel*)pduel;
172172 if (owner > 1 || !(location & (LOCATION_DECK | LOCATION_EXTRA )))
173173 return ;
@@ -196,7 +196,7 @@ OCGAPI void new_tag_card(intptr_t pduel, uint32_t code, uint8_t owner, uint8_t l
196196* @param buf int32_t array
197197* @return buffer length in bytes
198198*/
199- OCGAPI int32_t query_card (intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, int32_t query_flag, byte* buf, int32_t use_cache) {
199+ OCGCORE_API int32_t query_card (intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, int32_t query_flag, byte* buf, int32_t use_cache) {
200200 if (!check_playerid (playerid))
201201 return LEN_FAIL ;
202202 duel* ptduel = (duel*)pduel;
@@ -230,7 +230,7 @@ OCGAPI int32_t query_card(intptr_t pduel, uint8_t playerid, uint8_t location, ui
230230 return LEN_EMPTY ;
231231 }
232232}
233- OCGAPI int32_t query_field_count (intptr_t pduel, uint8_t playerid, uint8_t location) {
233+ OCGCORE_API int32_t query_field_count (intptr_t pduel, uint8_t playerid, uint8_t location) {
234234 duel* ptduel = (duel*)pduel;
235235 if (!check_playerid (playerid))
236236 return 0 ;
@@ -261,7 +261,7 @@ OCGAPI int32_t query_field_count(intptr_t pduel, uint8_t playerid, uint8_t locat
261261 }
262262 return 0 ;
263263}
264- OCGAPI int32_t query_field_card (intptr_t pduel, uint8_t playerid, uint8_t location, uint32_t query_flag, byte* buf, int32_t use_cache) {
264+ OCGCORE_API int32_t query_field_card (intptr_t pduel, uint8_t playerid, uint8_t location, uint32_t query_flag, byte* buf, int32_t use_cache) {
265265 if (!check_playerid (playerid))
266266 return LEN_FAIL ;
267267 duel* ptduel = (duel*)pduel;
@@ -308,7 +308,7 @@ OCGAPI int32_t query_field_card(intptr_t pduel, uint8_t playerid, uint8_t locati
308308 }
309309 return (int32_t )(p - buf);
310310}
311- OCGAPI int32_t query_field_info (intptr_t pduel, byte* buf) {
311+ OCGCORE_API int32_t query_field_info (intptr_t pduel, byte* buf) {
312312 duel* ptduel = (duel*)pduel;
313313 byte* p = buf;
314314 *p++ = MSG_RELOAD_FIELD ;
@@ -352,12 +352,12 @@ OCGAPI int32_t query_field_info(intptr_t pduel, byte* buf) {
352352 }
353353 return (int32_t )(p - buf);
354354}
355- OCGAPI void set_responsei (intptr_t pduel, int32_t value) {
355+ OCGCORE_API void set_responsei (intptr_t pduel, int32_t value) {
356356 ((duel*)pduel)->set_responsei (value);
357357}
358- OCGAPI void set_responseb (intptr_t pduel, byte* buf) {
358+ OCGCORE_API void set_responseb (intptr_t pduel, byte* buf) {
359359 ((duel*)pduel)->set_responseb (buf);
360360}
361- OCGAPI int32_t preload_script (intptr_t pduel, const char * script_name) {
361+ OCGCORE_API int32_t preload_script (intptr_t pduel, const char * script_name) {
362362 return ((duel*)pduel)->lua ->load_script (script_name);
363363}
0 commit comments