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_influence(request_id: RequestId, json_req: *const c_char) {
444 send!(request_id, cheat_get_influence, json_req);
445}
446
447#[unsafe(no_mangle)]
449pub unsafe extern "C" fn nil_cheat_get_infrastructure(
450 request_id: RequestId,
451 json_req: *const c_char,
452) {
453 send!(request_id, cheat_get_infrastructure, json_req);
454}
455
456#[unsafe(no_mangle)]
458pub unsafe extern "C" fn nil_cheat_get_maneuvers(request_id: RequestId, json_req: *const c_char) {
459 send!(request_id, cheat_get_maneuvers, json_req);
460}
461
462#[unsafe(no_mangle)]
464pub unsafe extern "C" fn nil_cheat_get_maneuvers_of(
465 request_id: RequestId,
466 json_req: *const c_char,
467) {
468 send!(request_id, cheat_get_maneuvers_of, json_req);
469}
470
471#[unsafe(no_mangle)]
473pub unsafe extern "C" fn nil_cheat_get_player(request_id: RequestId, json_req: *const c_char) {
474 send!(request_id, cheat_get_player, json_req);
475}
476
477#[unsafe(no_mangle)]
479pub unsafe extern "C" fn nil_cheat_get_players(request_id: RequestId, json_req: *const c_char) {
480 send!(request_id, cheat_get_players, json_req);
481}
482
483#[unsafe(no_mangle)]
485pub unsafe extern "C" fn nil_cheat_get_prefecture_build_queue(
486 request_id: RequestId,
487 json_req: *const c_char,
488) {
489 send!(request_id, cheat_get_prefecture_build_queue, json_req);
490}
491
492#[unsafe(no_mangle)]
494pub unsafe extern "C" fn nil_cheat_get_prefecture_build_queues(
495 request_id: RequestId,
496 json_req: *const c_char,
497) {
498 send!(request_id, cheat_get_prefecture_build_queues, json_req);
499}
500
501#[unsafe(no_mangle)]
503pub unsafe extern "C" fn nil_cheat_get_resources(request_id: RequestId, json_req: *const c_char) {
504 send!(request_id, cheat_get_resources, json_req);
505}
506
507#[unsafe(no_mangle)]
509pub unsafe extern "C" fn nil_cheat_get_stable_recruit_queue(
510 request_id: RequestId,
511 json_req: *const c_char,
512) {
513 send!(request_id, cheat_get_stable_recruit_queue, json_req);
514}
515
516#[unsafe(no_mangle)]
518pub unsafe extern "C" fn nil_cheat_get_stable_recruit_queues(
519 request_id: RequestId,
520 json_req: *const c_char,
521) {
522 send!(request_id, cheat_get_stable_recruit_queues, json_req);
523}
524
525#[unsafe(no_mangle)]
527pub unsafe extern "C" fn nil_cheat_get_storage_capacity(
528 request_id: RequestId,
529 json_req: *const c_char,
530) {
531 send!(request_id, cheat_get_storage_capacity, json_req);
532}
533
534#[unsafe(no_mangle)]
536pub unsafe extern "C" fn nil_cheat_set_bot_ethics(request_id: RequestId, json_req: *const c_char) {
537 send!(request_id, cheat_set_bot_ethics, json_req);
538}
539
540#[unsafe(no_mangle)]
542pub unsafe extern "C" fn nil_cheat_set_building_level(
543 request_id: RequestId,
544 json_req: *const c_char,
545) {
546 send!(request_id, cheat_set_building_level, json_req);
547}
548
549#[unsafe(no_mangle)]
551pub unsafe extern "C" fn nil_cheat_set_food(request_id: RequestId, json_req: *const c_char) {
552 send!(request_id, cheat_set_food, json_req);
553}
554
555#[unsafe(no_mangle)]
557pub unsafe extern "C" fn nil_cheat_set_influence(request_id: RequestId, json_req: *const c_char) {
558 send!(request_id, cheat_set_influence, json_req);
559}
560
561#[unsafe(no_mangle)]
563pub unsafe extern "C" fn nil_cheat_set_iron(request_id: RequestId, json_req: *const c_char) {
564 send!(request_id, cheat_set_iron, json_req);
565}
566
567#[unsafe(no_mangle)]
569pub unsafe extern "C" fn nil_cheat_set_market_fee(request_id: RequestId, json_req: *const c_char) {
570 send!(request_id, cheat_set_market_fee, json_req);
571}
572
573#[unsafe(no_mangle)]
575pub unsafe extern "C" fn nil_cheat_set_market_vault_resources(
576 request_id: RequestId,
577 json_req: *const c_char,
578) {
579 send!(request_id, cheat_set_market_vault_resources, json_req);
580}
581
582#[unsafe(no_mangle)]
584pub unsafe extern "C" fn nil_cheat_set_max_food(request_id: RequestId, json_req: *const c_char) {
585 send!(request_id, cheat_set_max_food, json_req);
586}
587
588#[unsafe(no_mangle)]
590pub unsafe extern "C" fn nil_cheat_set_max_infrastructure(
591 request_id: RequestId,
592 json_req: *const c_char,
593) {
594 send!(request_id, cheat_set_max_infrastructure, json_req);
595}
596
597#[unsafe(no_mangle)]
599pub unsafe extern "C" fn nil_cheat_set_max_iron(request_id: RequestId, json_req: *const c_char) {
600 send!(request_id, cheat_set_max_iron, json_req);
601}
602
603#[unsafe(no_mangle)]
605pub unsafe extern "C" fn nil_cheat_set_max_resources(
606 request_id: RequestId,
607 json_req: *const c_char,
608) {
609 send!(request_id, cheat_set_max_resources, json_req);
610}
611
612#[unsafe(no_mangle)]
614pub unsafe extern "C" fn nil_cheat_set_max_silo_resources(
615 request_id: RequestId,
616 json_req: *const c_char,
617) {
618 send!(request_id, cheat_set_max_silo_resources, json_req);
619}
620
621#[unsafe(no_mangle)]
623pub unsafe extern "C" fn nil_cheat_set_max_stone(request_id: RequestId, json_req: *const c_char) {
624 send!(request_id, cheat_set_max_stone, json_req);
625}
626
627#[unsafe(no_mangle)]
629pub unsafe extern "C" fn nil_cheat_set_max_warehouse_resources(
630 request_id: RequestId,
631 json_req: *const c_char,
632) {
633 send!(request_id, cheat_set_max_warehouse_resources, json_req);
634}
635
636#[unsafe(no_mangle)]
638pub unsafe extern "C" fn nil_cheat_set_max_wood(request_id: RequestId, json_req: *const c_char) {
639 send!(request_id, cheat_set_max_wood, json_req);
640}
641
642#[unsafe(no_mangle)]
644pub unsafe extern "C" fn nil_cheat_set_resources(request_id: RequestId, json_req: *const c_char) {
645 send!(request_id, cheat_set_resources, json_req);
646}
647
648#[unsafe(no_mangle)]
650pub unsafe extern "C" fn nil_cheat_set_stability(request_id: RequestId, json_req: *const c_char) {
651 send!(request_id, cheat_set_stability, json_req);
652}
653
654#[unsafe(no_mangle)]
656pub unsafe extern "C" fn nil_cheat_set_stone(request_id: RequestId, json_req: *const c_char) {
657 send!(request_id, cheat_set_stone, json_req);
658}
659
660#[unsafe(no_mangle)]
662pub unsafe extern "C" fn nil_cheat_set_wood(request_id: RequestId, json_req: *const c_char) {
663 send!(request_id, cheat_set_wood, json_req);
664}
665
666#[unsafe(no_mangle)]
668pub unsafe extern "C" fn nil_cheat_skip_round(request_id: RequestId, json_req: *const c_char) {
669 send!(request_id, cheat_skip_round, json_req);
670}
671
672#[unsafe(no_mangle)]
674pub unsafe extern "C" fn nil_cheat_spawn_bot(request_id: RequestId, json_req: *const c_char) {
675 send!(request_id, cheat_spawn_bot, json_req);
676}
677
678#[unsafe(no_mangle)]
680pub unsafe extern "C" fn nil_cheat_spawn_city(request_id: RequestId, json_req: *const c_char) {
681 send!(request_id, cheat_spawn_city, json_req);
682}
683
684#[unsafe(no_mangle)]
686pub unsafe extern "C" fn nil_cheat_spawn_personnel(request_id: RequestId, json_req: *const c_char) {
687 send!(request_id, cheat_spawn_personnel, json_req);
688}
689
690#[unsafe(no_mangle)]
692pub unsafe extern "C" fn nil_create_remote_world(request_id: RequestId, json_req: *const c_char) {
693 send!(request_id, create_remote_world, json_req);
694}
695
696#[unsafe(no_mangle)]
698pub unsafe extern "C" fn nil_create_user(request_id: RequestId, json_req: *const c_char) {
699 send!(request_id, create_user, json_req);
700}
701
702#[unsafe(no_mangle)]
704pub unsafe extern "C" fn nil_delete_remote_world(request_id: RequestId, json_req: *const c_char) {
705 send!(request_id, delete_remote_world, json_req);
706}
707
708#[unsafe(no_mangle)]
710pub unsafe extern "C" fn nil_forward_report(request_id: RequestId, json_req: *const c_char) {
711 send!(request_id, forward_report, json_req);
712}
713
714#[unsafe(no_mangle)]
716pub unsafe extern "C" fn nil_get_academy_recruit_catalog(
717 request_id: RequestId,
718 json_req: *const c_char,
719) {
720 send!(request_id, get_academy_recruit_catalog, json_req);
721}
722
723#[unsafe(no_mangle)]
725pub unsafe extern "C" fn nil_get_armies(request_id: RequestId, json_req: *const c_char) {
726 send!(request_id, get_armies, json_req);
727}
728
729#[unsafe(no_mangle)]
731pub unsafe extern "C" fn nil_get_army(request_id: RequestId, json_req: *const c_char) {
732 send!(request_id, get_army, json_req);
733}
734
735#[unsafe(no_mangle)]
737pub unsafe extern "C" fn nil_get_army_owner(request_id: RequestId, json_req: *const c_char) {
738 send!(request_id, get_army_owner, json_req);
739}
740
741#[unsafe(no_mangle)]
743pub unsafe extern "C" fn nil_get_bot_coords(request_id: RequestId, json_req: *const c_char) {
744 send!(request_id, get_bot_coords, json_req);
745}
746
747#[unsafe(no_mangle)]
749pub unsafe extern "C" fn nil_get_chat_history(request_id: RequestId, json_req: *const c_char) {
750 send!(request_id, get_chat_history, json_req);
751}
752
753#[unsafe(no_mangle)]
755pub unsafe extern "C" fn nil_get_cities(request_id: RequestId, json_req: *const c_char) {
756 send!(request_id, get_cities, json_req);
757}
758
759#[unsafe(no_mangle)]
761pub unsafe extern "C" fn nil_get_city(request_id: RequestId, json_req: *const c_char) {
762 send!(request_id, get_city, json_req);
763}
764
765#[unsafe(no_mangle)]
767pub unsafe extern "C" fn nil_get_city_limit(request_id: RequestId, json_req: *const c_char) {
768 send!(request_id, get_city_limit, json_req);
769}
770
771#[unsafe(no_mangle)]
773pub unsafe extern "C" fn nil_get_city_score(request_id: RequestId, json_req: *const c_char) {
774 send!(request_id, get_city_score, json_req);
775}
776
777#[unsafe(no_mangle)]
779pub unsafe extern "C" fn nil_get_continent_size(request_id: RequestId, json_req: *const c_char) {
780 send!(request_id, get_continent_size, json_req);
781}
782
783#[unsafe(no_mangle)]
785pub unsafe extern "C" fn nil_get_idle_armies_at(request_id: RequestId, json_req: *const c_char) {
786 send!(request_id, get_idle_armies_at, json_req);
787}
788
789#[unsafe(no_mangle)]
791pub unsafe extern "C" fn nil_get_idle_armies_coords(
792 request_id: RequestId,
793 json_req: *const c_char,
794) {
795 send!(request_id, get_idle_armies_coords, json_req);
796}
797
798#[unsafe(no_mangle)]
800pub unsafe extern "C" fn nil_get_maneuver(request_id: RequestId, json_req: *const c_char) {
801 send!(request_id, get_maneuver, json_req);
802}
803
804#[unsafe(no_mangle)]
806pub unsafe extern "C" fn nil_get_market(request_id: RequestId, json_req: *const c_char) {
807 send!(request_id, get_market, json_req);
808}
809
810#[unsafe(no_mangle)]
812pub unsafe extern "C" fn nil_get_market_fee(request_id: RequestId, json_req: *const c_char) {
813 send!(request_id, get_market_fee, json_req);
814}
815
816#[unsafe(no_mangle)]
818pub unsafe extern "C" fn nil_get_player(request_id: RequestId, json_req: *const c_char) {
819 send!(request_id, get_player, json_req);
820}
821
822#[unsafe(no_mangle)]
824pub unsafe extern "C" fn nil_get_player_coords(request_id: RequestId, json_req: *const c_char) {
825 send!(request_id, get_player_coords, json_req);
826}
827
828#[unsafe(no_mangle)]
830pub unsafe extern "C" fn nil_get_player_ids(request_id: RequestId, json_req: *const c_char) {
831 send!(request_id, get_player_ids, json_req);
832}
833
834#[unsafe(no_mangle)]
836pub unsafe extern "C" fn nil_get_player_maintenance(
837 request_id: RequestId,
838 json_req: *const c_char,
839) {
840 send!(request_id, get_player_maintenance, json_req);
841}
842
843#[unsafe(no_mangle)]
845pub unsafe extern "C" fn nil_get_player_military(request_id: RequestId, json_req: *const c_char) {
846 send!(request_id, get_player_military, json_req);
847}
848
849#[unsafe(no_mangle)]
851pub unsafe extern "C" fn nil_get_player_status(request_id: RequestId, json_req: *const c_char) {
852 send!(request_id, get_player_status, json_req);
853}
854
855#[unsafe(no_mangle)]
857pub unsafe extern "C" fn nil_get_player_storage_capacity(
858 request_id: RequestId,
859 json_req: *const c_char,
860) {
861 send!(request_id, get_player_storage_capacity, json_req);
862}
863
864#[unsafe(no_mangle)]
866pub unsafe extern "C" fn nil_get_player_worlds(request_id: RequestId, json_req: *const c_char) {
867 send!(request_id, get_player_worlds, json_req);
868}
869
870#[unsafe(no_mangle)]
872pub unsafe extern "C" fn nil_get_precursor_coords(request_id: RequestId, json_req: *const c_char) {
873 send!(request_id, get_precursor_coords, json_req);
874}
875
876#[unsafe(no_mangle)]
878pub unsafe extern "C" fn nil_get_prefecture_build_catalog(
879 request_id: RequestId,
880 json_req: *const c_char,
881) {
882 send!(request_id, get_prefecture_build_catalog, json_req);
883}
884
885#[unsafe(no_mangle)]
887pub unsafe extern "C" fn nil_get_public_bot(request_id: RequestId, json_req: *const c_char) {
888 send!(request_id, get_public_bot, json_req);
889}
890
891#[unsafe(no_mangle)]
893pub unsafe extern "C" fn nil_get_public_bots(request_id: RequestId, json_req: *const c_char) {
894 send!(request_id, get_public_bots, json_req);
895}
896
897#[unsafe(no_mangle)]
899pub unsafe extern "C" fn nil_get_public_cities(request_id: RequestId, json_req: *const c_char) {
900 send!(request_id, get_public_cities, json_req);
901}
902
903#[unsafe(no_mangle)]
905pub unsafe extern "C" fn nil_get_public_city(request_id: RequestId, json_req: *const c_char) {
906 send!(request_id, get_public_city, json_req);
907}
908
909#[unsafe(no_mangle)]
911pub unsafe extern "C" fn nil_get_public_field(request_id: RequestId, json_req: *const c_char) {
912 send!(request_id, get_public_field, json_req);
913}
914
915#[unsafe(no_mangle)]
917pub unsafe extern "C" fn nil_get_public_fields(request_id: RequestId, json_req: *const c_char) {
918 send!(request_id, get_public_fields, json_req);
919}
920
921#[unsafe(no_mangle)]
923pub unsafe extern "C" fn nil_get_public_player(request_id: RequestId, json_req: *const c_char) {
924 send!(request_id, get_public_player, json_req);
925}
926
927#[unsafe(no_mangle)]
929pub unsafe extern "C" fn nil_get_public_players(request_id: RequestId, json_req: *const c_char) {
930 send!(request_id, get_public_players, json_req);
931}
932
933#[unsafe(no_mangle)]
935pub unsafe extern "C" fn nil_get_public_precursor(request_id: RequestId, json_req: *const c_char) {
936 send!(request_id, get_public_precursor, json_req);
937}
938
939#[unsafe(no_mangle)]
941pub unsafe extern "C" fn nil_get_public_precursors(request_id: RequestId, json_req: *const c_char) {
942 send!(request_id, get_public_precursors, json_req);
943}
944
945#[unsafe(no_mangle)]
947pub unsafe extern "C" fn nil_get_rank(request_id: RequestId, json_req: *const c_char) {
948 send!(request_id, get_rank, json_req);
949}
950
951#[unsafe(no_mangle)]
953pub unsafe extern "C" fn nil_get_ranking(request_id: RequestId, json_req: *const c_char) {
954 send!(request_id, get_ranking, json_req);
955}
956
957#[unsafe(no_mangle)]
959pub unsafe extern "C" fn nil_get_remote_world(request_id: RequestId, json_req: *const c_char) {
960 send!(request_id, get_remote_world, json_req);
961}
962
963#[unsafe(no_mangle)]
965pub unsafe extern "C" fn nil_get_remote_world_limit(request_id: RequestId) {
966 send!(request_id, get_remote_world_limit);
967}
968
969#[unsafe(no_mangle)]
971pub unsafe extern "C" fn nil_get_remote_world_limit_per_user(request_id: RequestId) {
972 send!(request_id, get_remote_world_limit_per_user);
973}
974
975#[unsafe(no_mangle)]
977pub unsafe extern "C" fn nil_get_remote_worlds(request_id: RequestId) {
978 send!(request_id, get_remote_worlds);
979}
980
981#[unsafe(no_mangle)]
983pub unsafe extern "C" fn nil_get_round(request_id: RequestId, json_req: *const c_char) {
984 send!(request_id, get_round, json_req);
985}
986
987#[unsafe(no_mangle)]
989pub unsafe extern "C" fn nil_get_server_kind(request_id: RequestId) {
990 send!(request_id, get_server_kind);
991}
992
993#[unsafe(no_mangle)]
995pub unsafe extern "C" fn nil_get_stable_recruit_catalog(
996 request_id: RequestId,
997 json_req: *const c_char,
998) {
999 send!(request_id, get_stable_recruit_catalog, json_req);
1000}
1001
1002#[unsafe(no_mangle)]
1004pub unsafe extern "C" fn nil_get_workshop_recruit_catalog(
1005 request_id: RequestId,
1006 json_req: *const c_char,
1007) {
1008 send!(request_id, get_workshop_recruit_catalog, json_req);
1009}
1010
1011#[unsafe(no_mangle)]
1013pub unsafe extern "C" fn nil_get_world_bots(request_id: RequestId, json_req: *const c_char) {
1014 send!(request_id, get_world_bots, json_req);
1015}
1016
1017#[unsafe(no_mangle)]
1019pub unsafe extern "C" fn nil_get_world_config(request_id: RequestId, json_req: *const c_char) {
1020 send!(request_id, get_world_config, json_req);
1021}
1022
1023#[unsafe(no_mangle)]
1025pub unsafe extern "C" fn nil_get_world_personnel(request_id: RequestId, json_req: *const c_char) {
1026 send!(request_id, get_world_personnel, json_req);
1027}
1028
1029#[unsafe(no_mangle)]
1031pub unsafe extern "C" fn nil_get_world_players(request_id: RequestId, json_req: *const c_char) {
1032 send!(request_id, get_world_players, json_req);
1033}
1034
1035#[unsafe(no_mangle)]
1037pub unsafe extern "C" fn nil_get_world_precursors(request_id: RequestId, json_req: *const c_char) {
1038 send!(request_id, get_world_precursors, json_req);
1039}
1040
1041#[unsafe(no_mangle)]
1043pub unsafe extern "C" fn nil_get_world_rulers(request_id: RequestId, json_req: *const c_char) {
1044 send!(request_id, get_world_rulers, json_req);
1045}
1046
1047#[unsafe(no_mangle)]
1049pub unsafe extern "C" fn nil_get_world_stats(request_id: RequestId, json_req: *const c_char) {
1050 send!(request_id, get_world_stats, json_req);
1051}
1052
1053#[unsafe(no_mangle)]
1055pub unsafe extern "C" fn nil_player_exists(request_id: RequestId, json_req: *const c_char) {
1056 send!(request_id, player_exists, json_req);
1057}
1058
1059#[unsafe(no_mangle)]
1061pub unsafe extern "C" fn nil_push_chat_message(request_id: RequestId, json_req: *const c_char) {
1062 send!(request_id, push_chat_message, json_req);
1063}
1064
1065#[unsafe(no_mangle)]
1067pub unsafe extern "C" fn nil_rename_city(request_id: RequestId, json_req: *const c_char) {
1068 send!(request_id, rename_city, json_req);
1069}
1070
1071#[unsafe(no_mangle)]
1073pub unsafe extern "C" fn nil_request_maneuver(request_id: RequestId, json_req: *const c_char) {
1074 send!(request_id, request_maneuver, json_req);
1075}
1076
1077#[unsafe(no_mangle)]
1079pub unsafe extern "C" fn nil_save_local_world(request_id: RequestId, json_req: *const c_char) {
1080 send!(request_id, save_local_world, json_req);
1081}
1082
1083#[unsafe(no_mangle)]
1085pub unsafe extern "C" fn nil_search_city(request_id: RequestId, json_req: *const c_char) {
1086 send!(request_id, search_city, json_req);
1087}
1088
1089#[unsafe(no_mangle)]
1091pub unsafe extern "C" fn nil_search_public_city(request_id: RequestId, json_req: *const c_char) {
1092 send!(request_id, search_public_city, json_req);
1093}
1094
1095#[unsafe(no_mangle)]
1097pub unsafe extern "C" fn nil_sell_resources(request_id: RequestId, json_req: *const c_char) {
1098 send!(request_id, sell_resources, json_req);
1099}
1100
1101#[unsafe(no_mangle)]
1103pub unsafe extern "C" fn nil_send_resources(request_id: RequestId, json_req: *const c_char) {
1104 send!(request_id, send_resources, json_req);
1105}
1106
1107#[unsafe(no_mangle)]
1109pub unsafe extern "C" fn nil_server_version(request_id: RequestId) {
1110 send!(request_id, version);
1111}
1112
1113#[unsafe(no_mangle)]
1115pub unsafe extern "C" fn nil_set_player_ready(request_id: RequestId, json_req: *const c_char) {
1116 send!(request_id, set_player_ready, json_req);
1117}
1118
1119#[unsafe(no_mangle)]
1121pub unsafe extern "C" fn nil_set_player_status(request_id: RequestId, json_req: *const c_char) {
1122 send!(request_id, set_player_status, json_req);
1123}
1124
1125#[unsafe(no_mangle)]
1127pub unsafe extern "C" fn nil_simulate_battle(request_id: RequestId, json_req: *const c_char) {
1128 send!(request_id, simulate_battle, json_req);
1129}
1130
1131#[unsafe(no_mangle)]
1133pub unsafe extern "C" fn nil_spawn_player(request_id: RequestId, json_req: *const c_char) {
1134 send!(request_id, spawn_player, json_req);
1135}
1136
1137#[unsafe(no_mangle)]
1139pub unsafe extern "C" fn nil_start_round(request_id: RequestId, json_req: *const c_char) {
1140 send!(request_id, start_round, json_req);
1141}
1142
1143#[unsafe(no_mangle)]
1145pub unsafe extern "C" fn nil_toggle_building(request_id: RequestId, json_req: *const c_char) {
1146 send!(request_id, toggle_building, json_req);
1147}
1148
1149#[unsafe(no_mangle)]
1151pub unsafe extern "C" fn nil_user_exists(request_id: RequestId, json_req: *const c_char) {
1152 send!(request_id, user_exists, json_req);
1153}
1154
1155#[unsafe(no_mangle)]
1157pub unsafe extern "C" fn nil_validate_token(request_id: RequestId, json_req: *const c_char) {
1158 send!(request_id, validate_token, json_req);
1159}