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, on_event};
20use json::serialize;
21use std::ffi::{CString, c_char};
22use std::ptr;
23use tap::TryConv;
24
25pub use request::RequestId;
26pub use response::{Response, Result};
27pub use status::Status;
28
29#[unsafe(no_mangle)]
34pub unsafe extern "C" fn nil_ffi_free_str(ptr: *mut c_char) {
35 if !ptr.is_null() {
36 drop(unsafe { CString::from_raw(ptr) });
37 }
38}
39
40#[unsafe(no_mangle)]
41pub unsafe extern "C" fn nil_ffi_poll(json_out: *mut *mut c_char) -> Status {
42 if json_out.is_null() {
43 return Status::ERR_NULL_POINTER;
44 }
45
46 unsafe { *json_out = ptr::null_mut() };
47
48 match queue::poll() {
49 Some(entry) => {
50 match serialize(&entry) {
51 Ok(json) => {
52 let json = CString::new(json).unwrap();
53 unsafe { *json_out = json.into_raw() };
54 Status::OK
55 }
56 Err(_) => Status::ERR_SERIALIZATION,
57 }
58 }
59 None => Status::ERR_NOTHING_TO_POLL,
60 }
61}
62
63#[unsafe(no_mangle)]
64pub unsafe extern "C" fn nil_ffi_shutdown() {
65 queue::clear();
66}
67
68#[unsafe(no_mangle)]
69pub unsafe extern "C" fn nil_ffi_version(request_id: RequestId) {
70 push_ok!(request_id, env!("CARGO_PKG_VERSION"));
71}
72
73#[unsafe(no_mangle)]
78pub unsafe extern "C" fn nil_is_host(request_id: RequestId) {
79 async_push_ok!(request_id, SERVER.read().await.is_some());
80}
81
82#[unsafe(no_mangle)]
84pub unsafe extern "C" fn nil_start_server(request_id: RequestId, json_options: *const c_char) {
85 let f = |options| {
86 RUNTIME.spawn(async move {
87 let result = server::start_with_options(options).await;
88 queue::push_result(request_id, Result::from(result));
89 });
90 };
91
92 unsafe { json::with_ptr(request_id, json_options, f) };
93}
94
95#[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)]
113pub unsafe extern "C" fn nil_stop_server(request_id: RequestId) {
114 RUNTIME.spawn(async move {
115 server::stop().await;
116 queue::push_ok(request_id, ());
117 });
118}
119
120#[unsafe(no_mangle)]
125pub unsafe extern "C" fn nil_client_version(request_id: RequestId) {
126 push_ok!(request_id, nil_client::VERSION);
127}
128
129#[unsafe(no_mangle)]
131pub unsafe extern "C" fn nil_is_local(request_id: RequestId) {
132 async_push_ok!(request_id, CLIENT.read().await.is_local());
133}
134
135#[unsafe(no_mangle)]
137pub unsafe extern "C" fn nil_is_ready(request_id: RequestId) {
138 async_push_ok!(request_id, CLIENT.read().await.is_ready().await);
139}
140
141#[unsafe(no_mangle)]
143pub unsafe extern "C" fn nil_is_remote(request_id: RequestId) {
144 async_push_ok!(request_id, CLIENT.read().await.is_remote());
145}
146
147#[unsafe(no_mangle)]
149pub unsafe extern "C" fn nil_server_addr(request_id: RequestId) {
150 async_push_ok!(request_id, CLIENT.read().await.server_addr());
151}
152
153#[unsafe(no_mangle)]
155pub unsafe extern "C" fn nil_set_user_agent(request_id: RequestId, json_user_agent: *const c_char) {
156 let f = |user_agent: String| {
157 RUNTIME.spawn(async move {
158 CLIENT
159 .write()
160 .await
161 .set_user_agent(&user_agent);
162
163 queue::push_ok(request_id, ());
164 });
165 };
166
167 unsafe { json::with_ptr(request_id, json_user_agent, f) };
168}
169
170#[unsafe(no_mangle)]
172pub unsafe extern "C" fn nil_stop_client(request_id: RequestId) {
173 RUNTIME.spawn(async move {
174 CLIENT.write().await.stop().await;
175 queue::push_ok(request_id, ());
176 });
177}
178
179#[unsafe(no_mangle)]
181pub unsafe extern "C" fn nil_update_client(request_id: RequestId, json_options: *const c_char) {
182 let f = |options| {
183 RUNTIME.spawn(async move {
184 let result = CLIENT
185 .write()
186 .await
187 .update(options, Some(on_event()))
188 .await;
189
190 queue::push_result(request_id, Result::from(result));
191 });
192 };
193
194 unsafe { json::with_ptr(request_id, json_options, f) };
195}
196
197#[unsafe(no_mangle)]
199pub unsafe extern "C" fn nil_user_agent(request_id: RequestId) {
200 async_push_ok!(request_id, CLIENT.read().await.user_agent().to_owned());
201}
202
203#[unsafe(no_mangle)]
205pub unsafe extern "C" fn nil_world(request_id: RequestId) {
206 RUNTIME.spawn(async move {
207 match CLIENT.read().await.world() {
208 Some(world) => queue::push_ok(request_id, world),
209 None => queue::push_ok(request_id, None::<&str>),
210 }
211 });
212}
213
214#[unsafe(no_mangle)]
220pub unsafe extern "C" fn nil_runtime_global_queue_depth(request_id: RequestId) {
221 push_result!(
222 request_id,
223 RUNTIME
224 .metrics()
225 .global_queue_depth()
226 .try_conv::<u32>()
227 );
228}
229
230#[unsafe(no_mangle)]
232pub unsafe extern "C" fn nil_runtime_num_alive_tasks(request_id: RequestId) {
233 push_result!(
234 request_id,
235 RUNTIME
236 .metrics()
237 .num_alive_tasks()
238 .try_conv::<u32>()
239 );
240}
241
242#[unsafe(no_mangle)]
244pub unsafe extern "C" fn nil_runtime_num_workers(request_id: RequestId) {
245 push_result!(
246 request_id,
247 RUNTIME
248 .metrics()
249 .num_workers()
250 .try_conv::<u32>()
251 );
252}
253
254#[unsafe(no_mangle)]
260pub unsafe extern "C" fn nil_add_academy_recruit_order(
261 request_id: RequestId,
262 json_req: *const c_char,
263) {
264 send!(request_id, add_academy_recruit_order, json_req);
265}
266
267#[unsafe(no_mangle)]
269pub unsafe extern "C" fn nil_add_prefecture_build_order(
270 request_id: RequestId,
271 json_req: *const c_char,
272) {
273 send!(request_id, add_prefecture_build_order, json_req);
274}
275
276#[unsafe(no_mangle)]
278pub unsafe extern "C" fn nil_add_stable_recruit_order(
279 request_id: RequestId,
280 json_req: *const c_char,
281) {
282 send!(request_id, add_stable_recruit_order, json_req);
283}
284
285#[unsafe(no_mangle)]
287pub unsafe extern "C" fn nil_add_workshop_recruit_order(
288 request_id: RequestId,
289 json_req: *const c_char,
290) {
291 send!(request_id, add_workshop_recruit_order, json_req);
292}
293
294#[unsafe(no_mangle)]
296pub unsafe extern "C" fn nil_authorize(request_id: RequestId, json_req: *const c_char) {
297 send!(request_id, authorize, json_req);
298}
299
300#[unsafe(no_mangle)]
302pub unsafe extern "C" fn nil_buy_resources(request_id: RequestId, json_req: *const c_char) {
303 send!(request_id, buy_resources, json_req);
304}
305
306#[unsafe(no_mangle)]
308pub unsafe extern "C" fn nil_cancel_academy_recruit_order(
309 request_id: RequestId,
310 json_req: *const c_char,
311) {
312 send!(request_id, cancel_academy_recruit_order, json_req);
313}
314
315#[unsafe(no_mangle)]
317pub unsafe extern "C" fn nil_cancel_maneuver(request_id: RequestId, json_req: *const c_char) {
318 send!(request_id, cancel_maneuver, json_req);
319}
320
321#[unsafe(no_mangle)]
323pub unsafe extern "C" fn nil_cancel_prefecture_build_order(
324 request_id: RequestId,
325 json_req: *const c_char,
326) {
327 send!(request_id, cancel_prefecture_build_order, json_req);
328}
329
330#[unsafe(no_mangle)]
332pub unsafe extern "C" fn nil_cancel_stable_recruit_order(
333 request_id: RequestId,
334 json_req: *const c_char,
335) {
336 send!(request_id, cancel_stable_recruit_order, json_req);
337}
338
339#[unsafe(no_mangle)]
341pub unsafe extern "C" fn nil_cancel_workshop_recruit_order(
342 request_id: RequestId,
343 json_req: *const c_char,
344) {
345 send!(request_id, cancel_workshop_recruit_order, json_req);
346}
347
348#[unsafe(no_mangle)]
350pub unsafe extern "C" fn nil_cheat_fill_world(request_id: RequestId, json_req: *const c_char) {
351 send!(request_id, cheat_fill_world, json_req);
352}
353
354#[unsafe(no_mangle)]
356pub unsafe extern "C" fn nil_cheat_get_academy_recruit_queue(
357 request_id: RequestId,
358 json_req: *const c_char,
359) {
360 send!(request_id, cheat_get_academy_recruit_queue, json_req);
361}
362
363#[unsafe(no_mangle)]
365pub unsafe extern "C" fn nil_cheat_get_academy_recruit_queues(
366 request_id: RequestId,
367 json_req: *const c_char,
368) {
369 send!(request_id, cheat_get_academy_recruit_queues, json_req);
370}
371
372#[unsafe(no_mangle)]
374pub unsafe extern "C" fn nil_cheat_get_all_academy_recruit_queues(
375 request_id: RequestId,
376 json_req: *const c_char,
377) {
378 send!(request_id, cheat_get_all_academy_recruit_queues, json_req);
379}
380
381#[unsafe(no_mangle)]
383pub unsafe extern "C" fn nil_cheat_get_all_prefecture_build_queues(
384 request_id: RequestId,
385 json_req: *const c_char,
386) {
387 send!(request_id, cheat_get_all_prefecture_build_queues, json_req);
388}
389
390#[unsafe(no_mangle)]
392pub unsafe extern "C" fn nil_cheat_get_all_stable_recruit_queues(
393 request_id: RequestId,
394 json_req: *const c_char,
395) {
396 send!(request_id, cheat_get_all_stable_recruit_queues, json_req);
397}
398
399#[unsafe(no_mangle)]
401pub unsafe extern "C" fn nil_cheat_get_build_steps(request_id: RequestId, json_req: *const c_char) {
402 send!(request_id, cheat_get_build_steps, json_req);
403}
404
405#[unsafe(no_mangle)]
407pub unsafe extern "C" fn nil_cheat_get_cities(request_id: RequestId, json_req: *const c_char) {
408 send!(request_id, cheat_get_cities, json_req);
409}
410
411#[unsafe(no_mangle)]
413pub unsafe extern "C" fn nil_cheat_get_city(request_id: RequestId, json_req: *const c_char) {
414 send!(request_id, cheat_get_city, json_req);
415}
416
417#[unsafe(no_mangle)]
419pub unsafe extern "C" fn nil_cheat_get_ethics(request_id: RequestId, json_req: *const c_char) {
420 send!(request_id, cheat_get_ethics, json_req);
421}
422
423#[unsafe(no_mangle)]
425pub unsafe extern "C" fn nil_cheat_get_idle_armies_at(
426 request_id: RequestId,
427 json_req: *const c_char,
428) {
429 send!(request_id, cheat_get_idle_armies_at, json_req);
430}
431
432#[unsafe(no_mangle)]
434pub unsafe extern "C" fn nil_cheat_get_idle_personnel_at(
435 request_id: RequestId,
436 json_req: *const c_char,
437) {
438 send!(request_id, cheat_get_idle_personnel_at, json_req);
439}
440
441#[unsafe(no_mangle)]
443pub unsafe extern "C" fn nil_cheat_get_infrastructure(
444 request_id: RequestId,
445 json_req: *const c_char,
446) {
447 send!(request_id, cheat_get_infrastructure, json_req);
448}
449
450#[unsafe(no_mangle)]
452pub unsafe extern "C" fn nil_cheat_get_maneuvers(request_id: RequestId, json_req: *const c_char) {
453 send!(request_id, cheat_get_maneuvers, json_req);
454}
455
456#[unsafe(no_mangle)]
458pub unsafe extern "C" fn nil_cheat_get_maneuvers_of(
459 request_id: RequestId,
460 json_req: *const c_char,
461) {
462 send!(request_id, cheat_get_maneuvers_of, json_req);
463}
464
465#[unsafe(no_mangle)]
467pub unsafe extern "C" fn nil_cheat_get_player(request_id: RequestId, json_req: *const c_char) {
468 send!(request_id, cheat_get_player, json_req);
469}
470
471#[unsafe(no_mangle)]
473pub unsafe extern "C" fn nil_cheat_get_players(request_id: RequestId, json_req: *const c_char) {
474 send!(request_id, cheat_get_players, json_req);
475}
476
477#[unsafe(no_mangle)]
479pub unsafe extern "C" fn nil_cheat_get_prefecture_build_queue(
480 request_id: RequestId,
481 json_req: *const c_char,
482) {
483 send!(request_id, cheat_get_prefecture_build_queue, json_req);
484}
485
486#[unsafe(no_mangle)]
488pub unsafe extern "C" fn nil_cheat_get_prefecture_build_queues(
489 request_id: RequestId,
490 json_req: *const c_char,
491) {
492 send!(request_id, cheat_get_prefecture_build_queues, json_req);
493}
494
495#[unsafe(no_mangle)]
497pub unsafe extern "C" fn nil_cheat_get_resources(request_id: RequestId, json_req: *const c_char) {
498 send!(request_id, cheat_get_resources, json_req);
499}
500
501#[unsafe(no_mangle)]
503pub unsafe extern "C" fn nil_cheat_get_stable_recruit_queue(
504 request_id: RequestId,
505 json_req: *const c_char,
506) {
507 send!(request_id, cheat_get_stable_recruit_queue, json_req);
508}
509
510#[unsafe(no_mangle)]
512pub unsafe extern "C" fn nil_cheat_get_stable_recruit_queues(
513 request_id: RequestId,
514 json_req: *const c_char,
515) {
516 send!(request_id, cheat_get_stable_recruit_queues, json_req);
517}
518
519#[unsafe(no_mangle)]
521pub unsafe extern "C" fn nil_cheat_get_storage_capacity(
522 request_id: RequestId,
523 json_req: *const c_char,
524) {
525 send!(request_id, cheat_get_storage_capacity, json_req);
526}
527
528#[unsafe(no_mangle)]
530pub unsafe extern "C" fn nil_cheat_set_bot_ethics(request_id: RequestId, json_req: *const c_char) {
531 send!(request_id, cheat_set_bot_ethics, json_req);
532}
533
534#[unsafe(no_mangle)]
536pub unsafe extern "C" fn nil_cheat_set_building_level(
537 request_id: RequestId,
538 json_req: *const c_char,
539) {
540 send!(request_id, cheat_set_building_level, json_req);
541}
542
543#[unsafe(no_mangle)]
545pub unsafe extern "C" fn nil_cheat_set_food(request_id: RequestId, json_req: *const c_char) {
546 send!(request_id, cheat_set_food, json_req);
547}
548
549#[unsafe(no_mangle)]
551pub unsafe extern "C" fn nil_cheat_set_iron(request_id: RequestId, json_req: *const c_char) {
552 send!(request_id, cheat_set_iron, json_req);
553}
554
555#[unsafe(no_mangle)]
557pub unsafe extern "C" fn nil_cheat_set_market_fee(request_id: RequestId, json_req: *const c_char) {
558 send!(request_id, cheat_set_market_fee, json_req);
559}
560
561#[unsafe(no_mangle)]
563pub unsafe extern "C" fn nil_cheat_set_market_vault_resources(
564 request_id: RequestId,
565 json_req: *const c_char,
566) {
567 send!(request_id, cheat_set_market_vault_resources, json_req);
568}
569
570#[unsafe(no_mangle)]
572pub unsafe extern "C" fn nil_cheat_set_max_food(request_id: RequestId, json_req: *const c_char) {
573 send!(request_id, cheat_set_max_food, json_req);
574}
575
576#[unsafe(no_mangle)]
578pub unsafe extern "C" fn nil_cheat_set_max_infrastructure(
579 request_id: RequestId,
580 json_req: *const c_char,
581) {
582 send!(request_id, cheat_set_max_infrastructure, json_req);
583}
584
585#[unsafe(no_mangle)]
587pub unsafe extern "C" fn nil_cheat_set_max_iron(request_id: RequestId, json_req: *const c_char) {
588 send!(request_id, cheat_set_max_iron, json_req);
589}
590
591#[unsafe(no_mangle)]
593pub unsafe extern "C" fn nil_cheat_set_max_resources(
594 request_id: RequestId,
595 json_req: *const c_char,
596) {
597 send!(request_id, cheat_set_max_resources, json_req);
598}
599
600#[unsafe(no_mangle)]
602pub unsafe extern "C" fn nil_cheat_set_max_silo_resources(
603 request_id: RequestId,
604 json_req: *const c_char,
605) {
606 send!(request_id, cheat_set_max_silo_resources, json_req);
607}
608
609#[unsafe(no_mangle)]
611pub unsafe extern "C" fn nil_cheat_set_max_stone(request_id: RequestId, json_req: *const c_char) {
612 send!(request_id, cheat_set_max_stone, json_req);
613}
614
615#[unsafe(no_mangle)]
617pub unsafe extern "C" fn nil_cheat_set_max_warehouse_resources(
618 request_id: RequestId,
619 json_req: *const c_char,
620) {
621 send!(request_id, cheat_set_max_warehouse_resources, json_req);
622}
623
624#[unsafe(no_mangle)]
626pub unsafe extern "C" fn nil_cheat_set_max_wood(request_id: RequestId, json_req: *const c_char) {
627 send!(request_id, cheat_set_max_wood, json_req);
628}
629
630#[unsafe(no_mangle)]
632pub unsafe extern "C" fn nil_cheat_set_resources(request_id: RequestId, json_req: *const c_char) {
633 send!(request_id, cheat_set_resources, json_req);
634}
635
636#[unsafe(no_mangle)]
638pub unsafe extern "C" fn nil_cheat_set_stability(request_id: RequestId, json_req: *const c_char) {
639 send!(request_id, cheat_set_stability, json_req);
640}
641
642#[unsafe(no_mangle)]
644pub unsafe extern "C" fn nil_cheat_set_stone(request_id: RequestId, json_req: *const c_char) {
645 send!(request_id, cheat_set_stone, json_req);
646}
647
648#[unsafe(no_mangle)]
650pub unsafe extern "C" fn nil_cheat_set_wood(request_id: RequestId, json_req: *const c_char) {
651 send!(request_id, cheat_set_wood, json_req);
652}
653
654#[unsafe(no_mangle)]
656pub unsafe extern "C" fn nil_cheat_skip_round(request_id: RequestId, json_req: *const c_char) {
657 send!(request_id, cheat_skip_round, json_req);
658}
659
660#[unsafe(no_mangle)]
662pub unsafe extern "C" fn nil_cheat_spawn_bot(request_id: RequestId, json_req: *const c_char) {
663 send!(request_id, cheat_spawn_bot, json_req);
664}
665
666#[unsafe(no_mangle)]
668pub unsafe extern "C" fn nil_cheat_spawn_city(request_id: RequestId, json_req: *const c_char) {
669 send!(request_id, cheat_spawn_city, json_req);
670}
671
672#[unsafe(no_mangle)]
674pub unsafe extern "C" fn nil_cheat_spawn_personnel(request_id: RequestId, json_req: *const c_char) {
675 send!(request_id, cheat_spawn_personnel, json_req);
676}
677
678#[unsafe(no_mangle)]
680pub unsafe extern "C" fn nil_create_remote_world(request_id: RequestId, json_req: *const c_char) {
681 send!(request_id, create_remote_world, json_req);
682}
683
684#[unsafe(no_mangle)]
686pub unsafe extern "C" fn nil_create_user(request_id: RequestId, json_req: *const c_char) {
687 send!(request_id, create_user, json_req);
688}
689
690#[unsafe(no_mangle)]
692pub unsafe extern "C" fn nil_delete_remote_world(request_id: RequestId, json_req: *const c_char) {
693 send!(request_id, delete_remote_world, json_req);
694}
695
696#[unsafe(no_mangle)]
698pub unsafe extern "C" fn nil_forward_report(request_id: RequestId, json_req: *const c_char) {
699 send!(request_id, forward_report, json_req);
700}
701
702#[unsafe(no_mangle)]
704pub unsafe extern "C" fn nil_get_academy_recruit_catalog(
705 request_id: RequestId,
706 json_req: *const c_char,
707) {
708 send!(request_id, get_academy_recruit_catalog, json_req);
709}
710
711#[unsafe(no_mangle)]
713pub unsafe extern "C" fn nil_get_armies(request_id: RequestId, json_req: *const c_char) {
714 send!(request_id, get_armies, json_req);
715}
716
717#[unsafe(no_mangle)]
719pub unsafe extern "C" fn nil_get_army(request_id: RequestId, json_req: *const c_char) {
720 send!(request_id, get_army, json_req);
721}
722
723#[unsafe(no_mangle)]
725pub unsafe extern "C" fn nil_get_army_owner(request_id: RequestId, json_req: *const c_char) {
726 send!(request_id, get_army_owner, json_req);
727}
728
729#[unsafe(no_mangle)]
731pub unsafe extern "C" fn nil_get_bot_coords(request_id: RequestId, json_req: *const c_char) {
732 send!(request_id, get_bot_coords, json_req);
733}
734
735#[unsafe(no_mangle)]
737pub unsafe extern "C" fn nil_get_chat_history(request_id: RequestId, json_req: *const c_char) {
738 send!(request_id, get_chat_history, json_req);
739}
740
741#[unsafe(no_mangle)]
743pub unsafe extern "C" fn nil_get_cities(request_id: RequestId, json_req: *const c_char) {
744 send!(request_id, get_cities, json_req);
745}
746
747#[unsafe(no_mangle)]
749pub unsafe extern "C" fn nil_get_city(request_id: RequestId, json_req: *const c_char) {
750 send!(request_id, get_city, json_req);
751}
752
753#[unsafe(no_mangle)]
755pub unsafe extern "C" fn nil_get_city_score(request_id: RequestId, json_req: *const c_char) {
756 send!(request_id, get_city_score, json_req);
757}
758
759#[unsafe(no_mangle)]
761pub unsafe extern "C" fn nil_get_continent_size(request_id: RequestId, json_req: *const c_char) {
762 send!(request_id, get_continent_size, json_req);
763}
764
765#[unsafe(no_mangle)]
767pub unsafe extern "C" fn nil_get_idle_armies_at(request_id: RequestId, json_req: *const c_char) {
768 send!(request_id, get_idle_armies_at, json_req);
769}
770
771#[unsafe(no_mangle)]
773pub unsafe extern "C" fn nil_get_idle_armies_coords(
774 request_id: RequestId,
775 json_req: *const c_char,
776) {
777 send!(request_id, get_idle_armies_coords, json_req);
778}
779
780#[unsafe(no_mangle)]
782pub unsafe extern "C" fn nil_get_maneuver(request_id: RequestId, json_req: *const c_char) {
783 send!(request_id, get_maneuver, json_req);
784}
785
786#[unsafe(no_mangle)]
788pub unsafe extern "C" fn nil_get_market(request_id: RequestId, json_req: *const c_char) {
789 send!(request_id, get_market, json_req);
790}
791
792#[unsafe(no_mangle)]
794pub unsafe extern "C" fn nil_get_market_fee(request_id: RequestId, json_req: *const c_char) {
795 send!(request_id, get_market_fee, json_req);
796}
797
798#[unsafe(no_mangle)]
800pub unsafe extern "C" fn nil_get_player(request_id: RequestId, json_req: *const c_char) {
801 send!(request_id, get_player, json_req);
802}
803
804#[unsafe(no_mangle)]
806pub unsafe extern "C" fn nil_get_player_coords(request_id: RequestId, json_req: *const c_char) {
807 send!(request_id, get_player_coords, json_req);
808}
809
810#[unsafe(no_mangle)]
812pub unsafe extern "C" fn nil_get_player_ids(request_id: RequestId, json_req: *const c_char) {
813 send!(request_id, get_player_ids, json_req);
814}
815
816#[unsafe(no_mangle)]
818pub unsafe extern "C" fn nil_get_player_maintenance(
819 request_id: RequestId,
820 json_req: *const c_char,
821) {
822 send!(request_id, get_player_maintenance, json_req);
823}
824
825#[unsafe(no_mangle)]
827pub unsafe extern "C" fn nil_get_player_military(request_id: RequestId, json_req: *const c_char) {
828 send!(request_id, get_player_military, json_req);
829}
830
831#[unsafe(no_mangle)]
833pub unsafe extern "C" fn nil_get_player_status(request_id: RequestId, json_req: *const c_char) {
834 send!(request_id, get_player_status, json_req);
835}
836
837#[unsafe(no_mangle)]
839pub unsafe extern "C" fn nil_get_player_storage_capacity(
840 request_id: RequestId,
841 json_req: *const c_char,
842) {
843 send!(request_id, get_player_storage_capacity, json_req);
844}
845
846#[unsafe(no_mangle)]
848pub unsafe extern "C" fn nil_get_player_worlds(request_id: RequestId, json_req: *const c_char) {
849 send!(request_id, get_player_worlds, json_req);
850}
851
852#[unsafe(no_mangle)]
854pub unsafe extern "C" fn nil_get_precursor_coords(request_id: RequestId, json_req: *const c_char) {
855 send!(request_id, get_precursor_coords, json_req);
856}
857
858#[unsafe(no_mangle)]
860pub unsafe extern "C" fn nil_get_prefecture_build_catalog(
861 request_id: RequestId,
862 json_req: *const c_char,
863) {
864 send!(request_id, get_prefecture_build_catalog, json_req);
865}
866
867#[unsafe(no_mangle)]
869pub unsafe extern "C" fn nil_get_public_bot(request_id: RequestId, json_req: *const c_char) {
870 send!(request_id, get_public_bot, json_req);
871}
872
873#[unsafe(no_mangle)]
875pub unsafe extern "C" fn nil_get_public_bots(request_id: RequestId, json_req: *const c_char) {
876 send!(request_id, get_public_bots, json_req);
877}
878
879#[unsafe(no_mangle)]
881pub unsafe extern "C" fn nil_get_public_cities(request_id: RequestId, json_req: *const c_char) {
882 send!(request_id, get_public_cities, json_req);
883}
884
885#[unsafe(no_mangle)]
887pub unsafe extern "C" fn nil_get_public_city(request_id: RequestId, json_req: *const c_char) {
888 send!(request_id, get_public_city, json_req);
889}
890
891#[unsafe(no_mangle)]
893pub unsafe extern "C" fn nil_get_public_field(request_id: RequestId, json_req: *const c_char) {
894 send!(request_id, get_public_field, json_req);
895}
896
897#[unsafe(no_mangle)]
899pub unsafe extern "C" fn nil_get_public_fields(request_id: RequestId, json_req: *const c_char) {
900 send!(request_id, get_public_fields, json_req);
901}
902
903#[unsafe(no_mangle)]
905pub unsafe extern "C" fn nil_get_public_player(request_id: RequestId, json_req: *const c_char) {
906 send!(request_id, get_public_player, json_req);
907}
908
909#[unsafe(no_mangle)]
911pub unsafe extern "C" fn nil_get_public_players(request_id: RequestId, json_req: *const c_char) {
912 send!(request_id, get_public_players, json_req);
913}
914
915#[unsafe(no_mangle)]
917pub unsafe extern "C" fn nil_get_public_precursor(request_id: RequestId, json_req: *const c_char) {
918 send!(request_id, get_public_precursor, json_req);
919}
920
921#[unsafe(no_mangle)]
923pub unsafe extern "C" fn nil_get_public_precursors(request_id: RequestId, json_req: *const c_char) {
924 send!(request_id, get_public_precursors, json_req);
925}
926
927#[unsafe(no_mangle)]
929pub unsafe extern "C" fn nil_get_rank(request_id: RequestId, json_req: *const c_char) {
930 send!(request_id, get_rank, json_req);
931}
932
933#[unsafe(no_mangle)]
935pub unsafe extern "C" fn nil_get_ranking(request_id: RequestId, json_req: *const c_char) {
936 send!(request_id, get_ranking, json_req);
937}
938
939#[unsafe(no_mangle)]
941pub unsafe extern "C" fn nil_get_remote_world(request_id: RequestId, json_req: *const c_char) {
942 send!(request_id, get_remote_world, json_req);
943}
944
945#[unsafe(no_mangle)]
947pub unsafe extern "C" fn nil_get_remote_world_limit(request_id: RequestId) {
948 send!(request_id, get_remote_world_limit);
949}
950
951#[unsafe(no_mangle)]
953pub unsafe extern "C" fn nil_get_remote_world_limit_per_user(request_id: RequestId) {
954 send!(request_id, get_remote_world_limit_per_user);
955}
956
957#[unsafe(no_mangle)]
959pub unsafe extern "C" fn nil_get_remote_worlds(request_id: RequestId) {
960 send!(request_id, get_remote_worlds);
961}
962
963#[unsafe(no_mangle)]
965pub unsafe extern "C" fn nil_get_round(request_id: RequestId, json_req: *const c_char) {
966 send!(request_id, get_round, json_req);
967}
968
969#[unsafe(no_mangle)]
971pub unsafe extern "C" fn nil_get_server_kind(request_id: RequestId) {
972 send!(request_id, get_server_kind);
973}
974
975#[unsafe(no_mangle)]
977pub unsafe extern "C" fn nil_get_stable_recruit_catalog(
978 request_id: RequestId,
979 json_req: *const c_char,
980) {
981 send!(request_id, get_stable_recruit_catalog, json_req);
982}
983
984#[unsafe(no_mangle)]
986pub unsafe extern "C" fn nil_get_workshop_recruit_catalog(
987 request_id: RequestId,
988 json_req: *const c_char,
989) {
990 send!(request_id, get_workshop_recruit_catalog, json_req);
991}
992
993#[unsafe(no_mangle)]
995pub unsafe extern "C" fn nil_get_world_bots(request_id: RequestId, json_req: *const c_char) {
996 send!(request_id, get_world_bots, json_req);
997}
998
999#[unsafe(no_mangle)]
1001pub unsafe extern "C" fn nil_get_world_config(request_id: RequestId, json_req: *const c_char) {
1002 send!(request_id, get_world_config, json_req);
1003}
1004
1005#[unsafe(no_mangle)]
1007pub unsafe extern "C" fn nil_get_world_personnel(request_id: RequestId, json_req: *const c_char) {
1008 send!(request_id, get_world_personnel, json_req);
1009}
1010
1011#[unsafe(no_mangle)]
1013pub unsafe extern "C" fn nil_get_world_players(request_id: RequestId, json_req: *const c_char) {
1014 send!(request_id, get_world_players, json_req);
1015}
1016
1017#[unsafe(no_mangle)]
1019pub unsafe extern "C" fn nil_get_world_precursors(request_id: RequestId, json_req: *const c_char) {
1020 send!(request_id, get_world_precursors, json_req);
1021}
1022
1023#[unsafe(no_mangle)]
1025pub unsafe extern "C" fn nil_get_world_rulers(request_id: RequestId, json_req: *const c_char) {
1026 send!(request_id, get_world_rulers, json_req);
1027}
1028
1029#[unsafe(no_mangle)]
1031pub unsafe extern "C" fn nil_get_world_stats(request_id: RequestId, json_req: *const c_char) {
1032 send!(request_id, get_world_stats, json_req);
1033}
1034
1035#[unsafe(no_mangle)]
1037pub unsafe extern "C" fn nil_player_exists(request_id: RequestId, json_req: *const c_char) {
1038 send!(request_id, player_exists, json_req);
1039}
1040
1041#[unsafe(no_mangle)]
1043pub unsafe extern "C" fn nil_push_chat_message(request_id: RequestId, json_req: *const c_char) {
1044 send!(request_id, push_chat_message, json_req);
1045}
1046
1047#[unsafe(no_mangle)]
1049pub unsafe extern "C" fn nil_rename_city(request_id: RequestId, json_req: *const c_char) {
1050 send!(request_id, rename_city, json_req);
1051}
1052
1053#[unsafe(no_mangle)]
1055pub unsafe extern "C" fn nil_request_maneuver(request_id: RequestId, json_req: *const c_char) {
1056 send!(request_id, request_maneuver, json_req);
1057}
1058
1059#[unsafe(no_mangle)]
1061pub unsafe extern "C" fn nil_save_local_world(request_id: RequestId, json_req: *const c_char) {
1062 send!(request_id, save_local_world, json_req);
1063}
1064
1065#[unsafe(no_mangle)]
1067pub unsafe extern "C" fn nil_search_city(request_id: RequestId, json_req: *const c_char) {
1068 send!(request_id, search_city, json_req);
1069}
1070
1071#[unsafe(no_mangle)]
1073pub unsafe extern "C" fn nil_search_public_city(request_id: RequestId, json_req: *const c_char) {
1074 send!(request_id, search_public_city, json_req);
1075}
1076
1077#[unsafe(no_mangle)]
1079pub unsafe extern "C" fn nil_sell_resources(request_id: RequestId, json_req: *const c_char) {
1080 send!(request_id, sell_resources, json_req);
1081}
1082
1083#[unsafe(no_mangle)]
1085pub unsafe extern "C" fn nil_send_resources(request_id: RequestId, json_req: *const c_char) {
1086 send!(request_id, send_resources, json_req);
1087}
1088
1089#[unsafe(no_mangle)]
1091pub unsafe extern "C" fn nil_server_version(request_id: RequestId) {
1092 send!(request_id, version);
1093}
1094
1095#[unsafe(no_mangle)]
1097pub unsafe extern "C" fn nil_set_player_ready(request_id: RequestId, json_req: *const c_char) {
1098 send!(request_id, set_player_ready, json_req);
1099}
1100
1101#[unsafe(no_mangle)]
1103pub unsafe extern "C" fn nil_set_player_status(request_id: RequestId, json_req: *const c_char) {
1104 send!(request_id, set_player_status, json_req);
1105}
1106
1107#[unsafe(no_mangle)]
1109pub unsafe extern "C" fn nil_simulate_battle(request_id: RequestId, json_req: *const c_char) {
1110 send!(request_id, simulate_battle, json_req);
1111}
1112
1113#[unsafe(no_mangle)]
1115pub unsafe extern "C" fn nil_spawn_player(request_id: RequestId, json_req: *const c_char) {
1116 send!(request_id, spawn_player, json_req);
1117}
1118
1119#[unsafe(no_mangle)]
1121pub unsafe extern "C" fn nil_start_round(request_id: RequestId, json_req: *const c_char) {
1122 send!(request_id, start_round, json_req);
1123}
1124
1125#[unsafe(no_mangle)]
1127pub unsafe extern "C" fn nil_toggle_building(request_id: RequestId, json_req: *const c_char) {
1128 send!(request_id, toggle_building, json_req);
1129}
1130
1131#[unsafe(no_mangle)]
1133pub unsafe extern "C" fn nil_user_exists(request_id: RequestId, json_req: *const c_char) {
1134 send!(request_id, user_exists, json_req);
1135}
1136
1137#[unsafe(no_mangle)]
1139pub unsafe extern "C" fn nil_validate_token(request_id: RequestId, json_req: *const c_char) {
1140 send!(request_id, validate_token, json_req);
1141}