1#![feature(nonpoison_mutex, sync_nonpoison)]
5#![expect(clippy::missing_safety_doc)]
6
7mod client;
8mod json;
9mod macros;
10mod queue;
11mod request;
12mod response;
13mod runtime;
14mod server;
15mod status;
16
17use crate::runtime::RUNTIME;
18use crate::server::SERVER;
19use client::CLIENT;
20use futures::future::BoxFuture;
21use json::serialize;
22use nil_core::event::Event;
23use std::ffi::{CString, c_char};
24use std::ptr;
25use tap::TryConv;
26
27pub use request::RequestId;
28pub use response::{Response, Result};
29pub use status::Status;
30
31#[unsafe(no_mangle)]
36pub unsafe extern "C" fn nil_ffi_free_str(ptr: *mut c_char) {
37 if !ptr.is_null() {
38 drop(unsafe { CString::from_raw(ptr) });
39 }
40}
41
42#[unsafe(no_mangle)]
43pub unsafe extern "C" fn nil_ffi_poll(json_out: *mut *mut c_char) -> Status {
44 if json_out.is_null() {
45 return Status::ERR_NULL_POINTER;
46 }
47
48 unsafe { *json_out = ptr::null_mut() };
49
50 match queue::poll() {
51 Some(entry) => {
52 match serialize(&entry) {
53 Ok(json) => {
54 let json = CString::new(json).unwrap();
55 unsafe { *json_out = json.into_raw() };
56 Status::OK
57 }
58 Err(_) => Status::ERR_SERIALIZATION,
59 }
60 }
61 None => Status::ERR_NOTHING_TO_POLL,
62 }
63}
64
65#[unsafe(no_mangle)]
66pub unsafe extern "C" fn nil_ffi_shutdown() {
67 queue::clear();
68}
69
70#[unsafe(no_mangle)]
71pub unsafe extern "C" fn nil_ffi_version(request_id: RequestId) {
72 push_ok!(request_id, env!("CARGO_PKG_VERSION"))
73}
74
75#[unsafe(no_mangle)]
80pub unsafe extern "C" fn nil_is_host(request_id: RequestId) {
81 async_push_ok!(request_id, SERVER.read().await.is_some())
82}
83
84#[unsafe(no_mangle)]
85pub unsafe extern "C" fn nil_start_server(request_id: RequestId, json_options: *const c_char) {
86 let f = |options| {
87 RUNTIME.spawn(async move {
88 let result = server::start_with_options(options).await;
89 queue::push_result(request_id, Result::from(result));
90 });
91 };
92
93 unsafe { json::with_ptr(request_id, json_options, f) };
94}
95
96#[unsafe(no_mangle)]
97pub unsafe extern "C" fn nil_start_server_with_savedata(
98 request_id: RequestId,
99 json_path: *const c_char,
100) {
101 let f = |path| {
102 RUNTIME.spawn(async move {
103 let result = server::start_with_savedata(path).await;
104 queue::push_result(request_id, Result::from(result));
105 });
106 };
107
108 unsafe { json::with_ptr(request_id, json_path, f) };
109}
110
111#[unsafe(no_mangle)]
112pub unsafe extern "C" fn nil_stop_server(request_id: RequestId) {
113 RUNTIME.spawn(async move {
114 server::stop().await;
115 queue::push_ok(request_id, ());
116 });
117}
118
119#[unsafe(no_mangle)]
124pub unsafe extern "C" fn nil_client_version(request_id: RequestId) {
125 push_ok!(request_id, nil_client::VERSION)
126}
127
128#[unsafe(no_mangle)]
129pub unsafe extern "C" fn nil_is_local(request_id: RequestId) {
130 async_push_ok!(request_id, CLIENT.read().await.is_local())
131}
132
133#[unsafe(no_mangle)]
134pub unsafe extern "C" fn nil_is_ready(request_id: RequestId) {
135 async_push_ok!(request_id, CLIENT.read().await.is_ready().await)
136}
137
138#[unsafe(no_mangle)]
139pub unsafe extern "C" fn nil_is_remote(request_id: RequestId) {
140 async_push_ok!(request_id, CLIENT.read().await.is_remote())
141}
142
143#[unsafe(no_mangle)]
144pub unsafe extern "C" fn nil_server_addr(request_id: RequestId) {
145 async_push_ok!(request_id, CLIENT.read().await.server_addr())
146}
147
148#[unsafe(no_mangle)]
149pub unsafe extern "C" fn nil_set_user_agent(request_id: RequestId, json_user_agent: *const c_char) {
150 let f = |user_agent: String| {
151 RUNTIME.spawn(async move {
152 CLIENT
153 .write()
154 .await
155 .set_user_agent(&user_agent);
156
157 queue::push_ok(request_id, ());
158 });
159 };
160
161 unsafe { json::with_ptr(request_id, json_user_agent, f) };
162}
163
164#[unsafe(no_mangle)]
165pub unsafe extern "C" fn nil_stop_client(request_id: RequestId) {
166 RUNTIME.spawn(async move {
167 CLIENT.write().await.stop().await;
168 queue::push_ok(request_id, ());
169 });
170}
171
172#[unsafe(no_mangle)]
173pub unsafe extern "C" fn nil_update_client(request_id: RequestId, json_options: *const c_char) {
174 let f = |options| {
175 type OnEvent = fn(Event) -> BoxFuture<'static, ()>;
176 RUNTIME.spawn(async move {
177 let result = CLIENT
178 .write()
179 .await
180 .update(options, None::<OnEvent>)
181 .await;
182
183 queue::push_result(request_id, Result::from(result));
184 });
185 };
186
187 unsafe { json::with_ptr(request_id, json_options, f) };
188}
189
190#[unsafe(no_mangle)]
191pub unsafe extern "C" fn nil_user_agent(request_id: RequestId) {
192 async_push_ok!(request_id, CLIENT.read().await.user_agent().to_owned())
193}
194
195#[unsafe(no_mangle)]
196pub unsafe extern "C" fn nil_world(request_id: RequestId) {
197 RUNTIME.spawn(async move {
198 match CLIENT.read().await.world() {
199 Some(world) => queue::push_ok(request_id, world),
200 None => queue::push_ok(request_id, None::<&str>),
201 }
202 });
203}
204
205#[unsafe(no_mangle)]
210pub unsafe extern "C" fn nil_runtime_num_alive_tasks(request_id: RequestId) {
211 push_result!(
212 request_id,
213 RUNTIME
214 .metrics()
215 .num_alive_tasks()
216 .try_conv::<u32>()
217 );
218}
219
220#[unsafe(no_mangle)]
221pub unsafe extern "C" fn nil_runtime_num_workers(request_id: RequestId) {
222 push_result!(
223 request_id,
224 RUNTIME
225 .metrics()
226 .num_workers()
227 .try_conv::<u32>()
228 );
229}
230
231#[unsafe(no_mangle)]
236pub unsafe extern "C" fn nil_add_academy_recruit_order(
237 request_id: RequestId,
238 json_req: *const c_char,
239) {
240 send!(request_id, add_academy_recruit_order, json_req)
241}
242
243#[unsafe(no_mangle)]
244pub unsafe extern "C" fn nil_add_prefecture_build_order(
245 request_id: RequestId,
246 json_req: *const c_char,
247) {
248 send!(request_id, add_prefecture_build_order, json_req)
249}
250
251#[unsafe(no_mangle)]
252pub unsafe extern "C" fn nil_add_stable_recruit_order(
253 request_id: RequestId,
254 json_req: *const c_char,
255) {
256 send!(request_id, add_stable_recruit_order, json_req)
257}
258
259#[unsafe(no_mangle)]
260pub unsafe extern "C" fn nil_add_workshop_recruit_order(
261 request_id: RequestId,
262 json_req: *const c_char,
263) {
264 send!(request_id, add_workshop_recruit_order, json_req)
265}
266
267#[unsafe(no_mangle)]
268pub unsafe extern "C" fn nil_authorize(request_id: RequestId, json_req: *const c_char) {
269 send!(request_id, authorize, json_req)
270}
271
272#[unsafe(no_mangle)]
273pub unsafe extern "C" fn nil_cancel_academy_recruit_order(
274 request_id: RequestId,
275 json_req: *const c_char,
276) {
277 send!(request_id, cancel_academy_recruit_order, json_req)
278}
279
280#[unsafe(no_mangle)]
281pub unsafe extern "C" fn nil_cancel_maneuver(request_id: RequestId, json_req: *const c_char) {
282 send!(request_id, cancel_maneuver, json_req)
283}
284
285#[unsafe(no_mangle)]
286pub unsafe extern "C" fn nil_cancel_prefecture_build_order(
287 request_id: RequestId,
288 json_req: *const c_char,
289) {
290 send!(request_id, cancel_prefecture_build_order, json_req)
291}
292
293#[unsafe(no_mangle)]
294pub unsafe extern "C" fn nil_cancel_stable_recruit_order(
295 request_id: RequestId,
296 json_req: *const c_char,
297) {
298 send!(request_id, cancel_stable_recruit_order, json_req)
299}
300
301#[unsafe(no_mangle)]
302pub unsafe extern "C" fn nil_cancel_workshop_recruit_order(
303 request_id: RequestId,
304 json_req: *const c_char,
305) {
306 send!(request_id, cancel_workshop_recruit_order, json_req)
307}
308
309#[unsafe(no_mangle)]
310pub unsafe extern "C" fn nil_cheat_fill_world(request_id: RequestId, json_req: *const c_char) {
311 send!(request_id, cheat_fill_world, json_req)
312}
313
314#[unsafe(no_mangle)]
315pub unsafe extern "C" fn nil_cheat_get_academy_recruit_queue(
316 request_id: RequestId,
317 json_req: *const c_char,
318) {
319 send!(request_id, cheat_get_academy_recruit_queue, json_req)
320}
321
322#[unsafe(no_mangle)]
323pub unsafe extern "C" fn nil_cheat_get_academy_recruit_queues(
324 request_id: RequestId,
325 json_req: *const c_char,
326) {
327 send!(request_id, cheat_get_academy_recruit_queues, json_req)
328}
329
330#[unsafe(no_mangle)]
331pub unsafe extern "C" fn nil_cheat_get_all_academy_recruit_queues(
332 request_id: RequestId,
333 json_req: *const c_char,
334) {
335 send!(request_id, cheat_get_all_academy_recruit_queues, json_req)
336}
337
338#[unsafe(no_mangle)]
339pub unsafe extern "C" fn nil_cheat_get_all_prefecture_build_queues(
340 request_id: RequestId,
341 json_req: *const c_char,
342) {
343 send!(request_id, cheat_get_all_prefecture_build_queues, json_req)
344}
345
346#[unsafe(no_mangle)]
347pub unsafe extern "C" fn nil_cheat_get_all_stable_recruit_queues(
348 request_id: RequestId,
349 json_req: *const c_char,
350) {
351 send!(request_id, cheat_get_all_stable_recruit_queues, json_req)
352}
353
354#[unsafe(no_mangle)]
355pub unsafe extern "C" fn nil_cheat_get_build_steps(request_id: RequestId, json_req: *const c_char) {
356 send!(request_id, cheat_get_build_steps, json_req)
357}
358
359#[unsafe(no_mangle)]
360pub unsafe extern "C" fn nil_cheat_get_cities(request_id: RequestId, json_req: *const c_char) {
361 send!(request_id, cheat_get_cities, json_req)
362}
363
364#[unsafe(no_mangle)]
365pub unsafe extern "C" fn nil_cheat_get_city(request_id: RequestId, json_req: *const c_char) {
366 send!(request_id, cheat_get_city, json_req)
367}
368
369#[unsafe(no_mangle)]
370pub unsafe extern "C" fn nil_cheat_get_ethics(request_id: RequestId, json_req: *const c_char) {
371 send!(request_id, cheat_get_ethics, json_req)
372}
373
374#[unsafe(no_mangle)]
375pub unsafe extern "C" fn nil_cheat_get_idle_armies_at(
376 request_id: RequestId,
377 json_req: *const c_char,
378) {
379 send!(request_id, cheat_get_idle_armies_at, json_req)
380}
381
382#[unsafe(no_mangle)]
383pub unsafe extern "C" fn nil_cheat_get_idle_personnel_at(
384 request_id: RequestId,
385 json_req: *const c_char,
386) {
387 send!(request_id, cheat_get_idle_personnel_at, json_req)
388}
389
390#[unsafe(no_mangle)]
391pub unsafe extern "C" fn nil_cheat_get_infrastructure(
392 request_id: RequestId,
393 json_req: *const c_char,
394) {
395 send!(request_id, cheat_get_infrastructure, json_req)
396}
397
398#[unsafe(no_mangle)]
399pub unsafe extern "C" fn nil_cheat_get_maneuvers(request_id: RequestId, json_req: *const c_char) {
400 send!(request_id, cheat_get_maneuvers, json_req)
401}
402
403#[unsafe(no_mangle)]
404pub unsafe extern "C" fn nil_cheat_get_maneuvers_of(
405 request_id: RequestId,
406 json_req: *const c_char,
407) {
408 send!(request_id, cheat_get_maneuvers_of, json_req)
409}
410
411#[unsafe(no_mangle)]
412pub unsafe extern "C" fn nil_cheat_get_player(request_id: RequestId, json_req: *const c_char) {
413 send!(request_id, cheat_get_player, json_req)
414}
415
416#[unsafe(no_mangle)]
417pub unsafe extern "C" fn nil_cheat_get_players(request_id: RequestId, json_req: *const c_char) {
418 send!(request_id, cheat_get_players, json_req)
419}
420
421#[unsafe(no_mangle)]
422pub unsafe extern "C" fn nil_cheat_get_prefecture_build_queue(
423 request_id: RequestId,
424 json_req: *const c_char,
425) {
426 send!(request_id, cheat_get_prefecture_build_queue, json_req)
427}
428
429#[unsafe(no_mangle)]
430pub unsafe extern "C" fn nil_cheat_get_prefecture_build_queues(
431 request_id: RequestId,
432 json_req: *const c_char,
433) {
434 send!(request_id, cheat_get_prefecture_build_queues, json_req)
435}
436
437#[unsafe(no_mangle)]
438pub unsafe extern "C" fn nil_cheat_get_resources(request_id: RequestId, json_req: *const c_char) {
439 send!(request_id, cheat_get_resources, json_req)
440}
441
442#[unsafe(no_mangle)]
443pub unsafe extern "C" fn nil_cheat_get_stable_recruit_queue(
444 request_id: RequestId,
445 json_req: *const c_char,
446) {
447 send!(request_id, cheat_get_stable_recruit_queue, json_req)
448}
449
450#[unsafe(no_mangle)]
451pub unsafe extern "C" fn nil_cheat_get_stable_recruit_queues(
452 request_id: RequestId,
453 json_req: *const c_char,
454) {
455 send!(request_id, cheat_get_stable_recruit_queues, json_req)
456}
457
458#[unsafe(no_mangle)]
459pub unsafe extern "C" fn nil_cheat_get_storage_capacity(
460 request_id: RequestId,
461 json_req: *const c_char,
462) {
463 send!(request_id, cheat_get_storage_capacity, json_req)
464}
465
466#[unsafe(no_mangle)]
467pub unsafe extern "C" fn nil_cheat_set_bot_ethics(request_id: RequestId, json_req: *const c_char) {
468 send!(request_id, cheat_set_bot_ethics, json_req)
469}
470
471#[unsafe(no_mangle)]
472pub unsafe extern "C" fn nil_cheat_set_building_level(
473 request_id: RequestId,
474 json_req: *const c_char,
475) {
476 send!(request_id, cheat_set_building_level, json_req)
477}
478
479#[unsafe(no_mangle)]
480pub unsafe extern "C" fn nil_cheat_set_food(request_id: RequestId, json_req: *const c_char) {
481 send!(request_id, cheat_set_food, json_req)
482}
483
484#[unsafe(no_mangle)]
485pub unsafe extern "C" fn nil_cheat_set_iron(request_id: RequestId, json_req: *const c_char) {
486 send!(request_id, cheat_set_iron, json_req)
487}
488
489#[unsafe(no_mangle)]
490pub unsafe extern "C" fn nil_cheat_set_max_food(request_id: RequestId, json_req: *const c_char) {
491 send!(request_id, cheat_set_max_food, json_req)
492}
493
494#[unsafe(no_mangle)]
495pub unsafe extern "C" fn nil_cheat_set_max_infrastructure(
496 request_id: RequestId,
497 json_req: *const c_char,
498) {
499 send!(request_id, cheat_set_max_infrastructure, json_req)
500}
501
502#[unsafe(no_mangle)]
503pub unsafe extern "C" fn nil_cheat_set_max_iron(request_id: RequestId, json_req: *const c_char) {
504 send!(request_id, cheat_set_max_iron, json_req)
505}
506
507#[unsafe(no_mangle)]
508pub unsafe extern "C" fn nil_cheat_set_max_resources(
509 request_id: RequestId,
510 json_req: *const c_char,
511) {
512 send!(request_id, cheat_set_max_resources, json_req)
513}
514
515#[unsafe(no_mangle)]
516pub unsafe extern "C" fn nil_cheat_set_max_silo_resources(
517 request_id: RequestId,
518 json_req: *const c_char,
519) {
520 send!(request_id, cheat_set_max_silo_resources, json_req)
521}
522
523#[unsafe(no_mangle)]
524pub unsafe extern "C" fn nil_cheat_set_max_stone(request_id: RequestId, json_req: *const c_char) {
525 send!(request_id, cheat_set_max_stone, json_req)
526}
527
528#[unsafe(no_mangle)]
529pub unsafe extern "C" fn nil_cheat_set_max_warehouse_resources(
530 request_id: RequestId,
531 json_req: *const c_char,
532) {
533 send!(request_id, cheat_set_max_warehouse_resources, json_req)
534}
535
536#[unsafe(no_mangle)]
537pub unsafe extern "C" fn nil_cheat_set_max_wood(request_id: RequestId, json_req: *const c_char) {
538 send!(request_id, cheat_set_max_wood, json_req)
539}
540
541#[unsafe(no_mangle)]
542pub unsafe extern "C" fn nil_cheat_set_resources(request_id: RequestId, json_req: *const c_char) {
543 send!(request_id, cheat_set_resources, json_req)
544}
545
546#[unsafe(no_mangle)]
547pub unsafe extern "C" fn nil_cheat_set_stability(request_id: RequestId, json_req: *const c_char) {
548 send!(request_id, cheat_set_stability, json_req)
549}
550
551#[unsafe(no_mangle)]
552pub unsafe extern "C" fn nil_cheat_set_stone(request_id: RequestId, json_req: *const c_char) {
553 send!(request_id, cheat_set_stone, json_req)
554}
555
556#[unsafe(no_mangle)]
557pub unsafe extern "C" fn nil_cheat_set_wood(request_id: RequestId, json_req: *const c_char) {
558 send!(request_id, cheat_set_wood, json_req)
559}
560
561#[unsafe(no_mangle)]
562pub unsafe extern "C" fn nil_cheat_skip_round(request_id: RequestId, json_req: *const c_char) {
563 send!(request_id, cheat_skip_round, json_req)
564}
565
566#[unsafe(no_mangle)]
567pub unsafe extern "C" fn nil_cheat_spawn_bot(request_id: RequestId, json_req: *const c_char) {
568 send!(request_id, cheat_spawn_bot, json_req)
569}
570
571#[unsafe(no_mangle)]
572pub unsafe extern "C" fn nil_cheat_spawn_city(request_id: RequestId, json_req: *const c_char) {
573 send!(request_id, cheat_spawn_city, json_req)
574}
575
576#[unsafe(no_mangle)]
577pub unsafe extern "C" fn nil_cheat_spawn_personnel(request_id: RequestId, json_req: *const c_char) {
578 send!(request_id, cheat_spawn_personnel, json_req)
579}
580
581#[unsafe(no_mangle)]
582pub unsafe extern "C" fn nil_create_remote_world(request_id: RequestId, json_req: *const c_char) {
583 send!(request_id, create_remote_world, json_req)
584}
585
586#[unsafe(no_mangle)]
587pub unsafe extern "C" fn nil_create_user(request_id: RequestId, json_req: *const c_char) {
588 send!(request_id, create_user, json_req)
589}
590
591#[unsafe(no_mangle)]
592pub unsafe extern "C" fn nil_delete_remote_world(request_id: RequestId, json_req: *const c_char) {
593 send!(request_id, delete_remote_world, json_req)
594}
595
596#[unsafe(no_mangle)]
597pub unsafe extern "C" fn nil_forward_report(request_id: RequestId, json_req: *const c_char) {
598 send!(request_id, forward_report, json_req)
599}
600
601#[unsafe(no_mangle)]
602pub unsafe extern "C" fn nil_get_academy_recruit_catalog(
603 request_id: RequestId,
604 json_req: *const c_char,
605) {
606 send!(request_id, get_academy_recruit_catalog, json_req)
607}
608
609#[unsafe(no_mangle)]
610pub unsafe extern "C" fn nil_get_armies(request_id: RequestId, json_req: *const c_char) {
611 send!(request_id, get_armies, json_req)
612}
613
614#[unsafe(no_mangle)]
615pub unsafe extern "C" fn nil_get_army(request_id: RequestId, json_req: *const c_char) {
616 send!(request_id, get_army, json_req)
617}
618
619#[unsafe(no_mangle)]
620pub unsafe extern "C" fn nil_get_army_owner(request_id: RequestId, json_req: *const c_char) {
621 send!(request_id, get_army_owner, json_req)
622}
623
624#[unsafe(no_mangle)]
625pub unsafe extern "C" fn nil_get_bot_coords(request_id: RequestId, json_req: *const c_char) {
626 send!(request_id, get_bot_coords, json_req)
627}
628
629#[unsafe(no_mangle)]
630pub unsafe extern "C" fn nil_get_chat_history(request_id: RequestId, json_req: *const c_char) {
631 send!(request_id, get_chat_history, json_req)
632}
633
634#[unsafe(no_mangle)]
635pub unsafe extern "C" fn nil_get_cities(request_id: RequestId, json_req: *const c_char) {
636 send!(request_id, get_cities, json_req)
637}
638
639#[unsafe(no_mangle)]
640pub unsafe extern "C" fn nil_get_city(request_id: RequestId, json_req: *const c_char) {
641 send!(request_id, get_city, json_req)
642}
643
644#[unsafe(no_mangle)]
645pub unsafe extern "C" fn nil_get_city_score(request_id: RequestId, json_req: *const c_char) {
646 send!(request_id, get_city_score, json_req)
647}
648
649#[unsafe(no_mangle)]
650pub unsafe extern "C" fn nil_get_continent_size(request_id: RequestId, json_req: *const c_char) {
651 send!(request_id, get_continent_size, json_req)
652}
653
654#[unsafe(no_mangle)]
655pub unsafe extern "C" fn nil_get_idle_armies_at(request_id: RequestId, json_req: *const c_char) {
656 send!(request_id, get_idle_armies_at, json_req)
657}
658
659#[unsafe(no_mangle)]
660pub unsafe extern "C" fn nil_get_idle_armies_coords(
661 request_id: RequestId,
662 json_req: *const c_char,
663) {
664 send!(request_id, get_idle_armies_coords, json_req)
665}
666
667#[unsafe(no_mangle)]
668pub unsafe extern "C" fn nil_get_maneuver(request_id: RequestId, json_req: *const c_char) {
669 send!(request_id, get_maneuver, json_req)
670}
671
672#[unsafe(no_mangle)]
673pub unsafe extern "C" fn nil_get_player(request_id: RequestId, json_req: *const c_char) {
674 send!(request_id, get_player, json_req)
675}
676
677#[unsafe(no_mangle)]
678pub unsafe extern "C" fn nil_get_player_coords(request_id: RequestId, json_req: *const c_char) {
679 send!(request_id, get_player_coords, json_req)
680}
681
682#[unsafe(no_mangle)]
683pub unsafe extern "C" fn nil_get_player_ids(request_id: RequestId, json_req: *const c_char) {
684 send!(request_id, get_player_ids, json_req)
685}
686
687#[unsafe(no_mangle)]
688pub unsafe extern "C" fn nil_get_player_maintenance(
689 request_id: RequestId,
690 json_req: *const c_char,
691) {
692 send!(request_id, get_player_maintenance, json_req)
693}
694
695#[unsafe(no_mangle)]
696pub unsafe extern "C" fn nil_get_player_military(request_id: RequestId, json_req: *const c_char) {
697 send!(request_id, get_player_military, json_req)
698}
699
700#[unsafe(no_mangle)]
701pub unsafe extern "C" fn nil_get_player_status(request_id: RequestId, json_req: *const c_char) {
702 send!(request_id, get_player_status, json_req)
703}
704
705#[unsafe(no_mangle)]
706pub unsafe extern "C" fn nil_get_player_storage_capacity(
707 request_id: RequestId,
708 json_req: *const c_char,
709) {
710 send!(request_id, get_player_storage_capacity, json_req)
711}
712
713#[unsafe(no_mangle)]
714pub unsafe extern "C" fn nil_get_player_worlds(request_id: RequestId, json_req: *const c_char) {
715 send!(request_id, get_player_worlds, json_req)
716}
717
718#[unsafe(no_mangle)]
719pub unsafe extern "C" fn nil_get_precursor_coords(request_id: RequestId, json_req: *const c_char) {
720 send!(request_id, get_precursor_coords, json_req)
721}
722
723#[unsafe(no_mangle)]
724pub unsafe extern "C" fn nil_get_prefecture_build_catalog(
725 request_id: RequestId,
726 json_req: *const c_char,
727) {
728 send!(request_id, get_prefecture_build_catalog, json_req)
729}
730
731#[unsafe(no_mangle)]
732pub unsafe extern "C" fn nil_get_public_bot(request_id: RequestId, json_req: *const c_char) {
733 send!(request_id, get_public_bot, json_req)
734}
735
736#[unsafe(no_mangle)]
737pub unsafe extern "C" fn nil_get_public_bots(request_id: RequestId, json_req: *const c_char) {
738 send!(request_id, get_public_bots, json_req)
739}
740
741#[unsafe(no_mangle)]
742pub unsafe extern "C" fn nil_get_public_cities(request_id: RequestId, json_req: *const c_char) {
743 send!(request_id, get_public_cities, json_req)
744}
745
746#[unsafe(no_mangle)]
747pub unsafe extern "C" fn nil_get_public_city(request_id: RequestId, json_req: *const c_char) {
748 send!(request_id, get_public_city, json_req)
749}
750
751#[unsafe(no_mangle)]
752pub unsafe extern "C" fn nil_get_public_field(request_id: RequestId, json_req: *const c_char) {
753 send!(request_id, get_public_field, json_req)
754}
755
756#[unsafe(no_mangle)]
757pub unsafe extern "C" fn nil_get_public_fields(request_id: RequestId, json_req: *const c_char) {
758 send!(request_id, get_public_fields, json_req)
759}
760
761#[unsafe(no_mangle)]
762pub unsafe extern "C" fn nil_get_public_player(request_id: RequestId, json_req: *const c_char) {
763 send!(request_id, get_public_player, json_req)
764}
765
766#[unsafe(no_mangle)]
767pub unsafe extern "C" fn nil_get_public_players(request_id: RequestId, json_req: *const c_char) {
768 send!(request_id, get_public_players, json_req)
769}
770
771#[unsafe(no_mangle)]
772pub unsafe extern "C" fn nil_get_public_precursor(request_id: RequestId, json_req: *const c_char) {
773 send!(request_id, get_public_precursor, json_req)
774}
775
776#[unsafe(no_mangle)]
777pub unsafe extern "C" fn nil_get_public_precursors(request_id: RequestId, json_req: *const c_char) {
778 send!(request_id, get_public_precursors, json_req)
779}
780
781#[unsafe(no_mangle)]
782pub unsafe extern "C" fn nil_get_rank(request_id: RequestId, json_req: *const c_char) {
783 send!(request_id, get_rank, json_req)
784}
785
786#[unsafe(no_mangle)]
787pub unsafe extern "C" fn nil_get_ranking(request_id: RequestId, json_req: *const c_char) {
788 send!(request_id, get_ranking, json_req)
789}
790
791#[unsafe(no_mangle)]
792pub unsafe extern "C" fn nil_get_remote_world(request_id: RequestId, json_req: *const c_char) {
793 send!(request_id, get_remote_world, json_req)
794}
795
796#[unsafe(no_mangle)]
797pub unsafe extern "C" fn nil_get_remote_world_limit(request_id: RequestId) {
798 send!(request_id, get_remote_world_limit)
799}
800
801#[unsafe(no_mangle)]
802pub unsafe extern "C" fn nil_get_remote_world_limit_per_user(request_id: RequestId) {
803 send!(request_id, get_remote_world_limit_per_user)
804}
805
806#[unsafe(no_mangle)]
807pub unsafe extern "C" fn nil_get_remote_worlds(request_id: RequestId) {
808 send!(request_id, get_remote_worlds)
809}
810
811#[unsafe(no_mangle)]
812pub unsafe extern "C" fn nil_get_round(request_id: RequestId, json_req: *const c_char) {
813 send!(request_id, get_round, json_req)
814}
815
816#[unsafe(no_mangle)]
817pub unsafe extern "C" fn nil_get_server_kind(request_id: RequestId) {
818 send!(request_id, get_server_kind)
819}
820
821#[unsafe(no_mangle)]
822pub unsafe extern "C" fn nil_get_stable_recruit_catalog(
823 request_id: RequestId,
824 json_req: *const c_char,
825) {
826 send!(request_id, get_stable_recruit_catalog, json_req)
827}
828
829#[unsafe(no_mangle)]
830pub unsafe extern "C" fn nil_get_workshop_recruit_catalog(
831 request_id: RequestId,
832 json_req: *const c_char,
833) {
834 send!(request_id, get_workshop_recruit_catalog, json_req)
835}
836
837#[unsafe(no_mangle)]
838pub unsafe extern "C" fn nil_get_world_bots(request_id: RequestId, json_req: *const c_char) {
839 send!(request_id, get_world_bots, json_req)
840}
841
842#[unsafe(no_mangle)]
843pub unsafe extern "C" fn nil_get_world_config(request_id: RequestId, json_req: *const c_char) {
844 send!(request_id, get_world_config, json_req)
845}
846
847#[unsafe(no_mangle)]
848pub unsafe extern "C" fn nil_get_world_personnel(request_id: RequestId, json_req: *const c_char) {
849 send!(request_id, get_world_personnel, json_req)
850}
851
852#[unsafe(no_mangle)]
853pub unsafe extern "C" fn nil_get_world_players(request_id: RequestId, json_req: *const c_char) {
854 send!(request_id, get_world_players, json_req)
855}
856
857#[unsafe(no_mangle)]
858pub unsafe extern "C" fn nil_get_world_precursors(request_id: RequestId, json_req: *const c_char) {
859 send!(request_id, get_world_precursors, json_req)
860}
861
862#[unsafe(no_mangle)]
863pub unsafe extern "C" fn nil_get_world_stats(request_id: RequestId, json_req: *const c_char) {
864 send!(request_id, get_world_stats, json_req)
865}
866
867#[unsafe(no_mangle)]
868pub unsafe extern "C" fn nil_player_exists(request_id: RequestId, json_req: *const c_char) {
869 send!(request_id, player_exists, json_req)
870}
871
872#[unsafe(no_mangle)]
873pub unsafe extern "C" fn nil_push_chat_message(request_id: RequestId, json_req: *const c_char) {
874 send!(request_id, push_chat_message, json_req)
875}
876
877#[unsafe(no_mangle)]
878pub unsafe extern "C" fn nil_rename_city(request_id: RequestId, json_req: *const c_char) {
879 send!(request_id, rename_city, json_req)
880}
881
882#[unsafe(no_mangle)]
883pub unsafe extern "C" fn nil_request_maneuver(request_id: RequestId, json_req: *const c_char) {
884 send!(request_id, request_maneuver, json_req)
885}
886
887#[unsafe(no_mangle)]
888pub unsafe extern "C" fn nil_save_local_world(request_id: RequestId, json_req: *const c_char) {
889 send!(request_id, save_local_world, json_req)
890}
891
892#[unsafe(no_mangle)]
893pub unsafe extern "C" fn nil_search_city(request_id: RequestId, json_req: *const c_char) {
894 send!(request_id, search_city, json_req)
895}
896
897#[unsafe(no_mangle)]
898pub unsafe extern "C" fn nil_search_public_city(request_id: RequestId, json_req: *const c_char) {
899 send!(request_id, search_public_city, json_req)
900}
901
902#[unsafe(no_mangle)]
903pub unsafe extern "C" fn nil_server_version(request_id: RequestId) {
904 send!(request_id, version)
905}
906
907#[unsafe(no_mangle)]
908pub unsafe extern "C" fn nil_set_player_ready(request_id: RequestId, json_req: *const c_char) {
909 send!(request_id, set_player_ready, json_req)
910}
911
912#[unsafe(no_mangle)]
913pub unsafe extern "C" fn nil_set_player_status(request_id: RequestId, json_req: *const c_char) {
914 send!(request_id, set_player_status, json_req)
915}
916
917#[unsafe(no_mangle)]
918pub unsafe extern "C" fn nil_simulate_battle(request_id: RequestId, json_req: *const c_char) {
919 send!(request_id, simulate_battle, json_req)
920}
921
922#[unsafe(no_mangle)]
923pub unsafe extern "C" fn nil_spawn_player(request_id: RequestId, json_req: *const c_char) {
924 send!(request_id, spawn_player, json_req)
925}
926
927#[unsafe(no_mangle)]
928pub unsafe extern "C" fn nil_start_round(request_id: RequestId, json_req: *const c_char) {
929 send!(request_id, start_round, json_req)
930}
931
932#[unsafe(no_mangle)]
933pub unsafe extern "C" fn nil_toggle_building(request_id: RequestId, json_req: *const c_char) {
934 send!(request_id, toggle_building, json_req)
935}
936
937#[unsafe(no_mangle)]
938pub unsafe extern "C" fn nil_user_exists(request_id: RequestId, json_req: *const c_char) {
939 send!(request_id, user_exists, json_req)
940}
941
942#[unsafe(no_mangle)]
943pub unsafe extern "C" fn nil_validate_token(request_id: RequestId, json_req: *const c_char) {
944 send!(request_id, validate_token, json_req)
945}