Server coding question. Please help!

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
Post Reply
Lexxie
Veteran
Posts: 127
Joined: Fri Jun 23, 2017 4:18 pm

Server coding question. Please help!

Post by Lexxie »

For freeciv server I am trying to construct a line of code to check an if(condition), but cannot figure out how.

Here is the pseudo-code for what I'm trying:

if ( (tile_get_known(ptile, pplayer) == TILE_KNOWN_UNSEEN)
&& (player_thinks_there_is_a_nonallied_city_on_the_fogged_tile(pplayer,ptile) ) {
/* stuff goes here */
}

How would I do the "player_believes_there_is_a_nonallied_city_on_the_fogged_tile(pplayer,ptile)" ?

In other words, how do I check if a player sees a non-allied city on a fogged tile. This can be a different truth value from whether there actually is a non-allied city there, because on a fog-of-war tile, maybe the city was destroyed, disbanded, or conquered by an ally who doesn't share vision.

Thank you in advance if you know the answer. I think it has something to do with map_get_player_city() but can't figure it out.

Cheers
cazfi
Elite
Posts: 3105
Joined: Tue Jan 29, 2013 6:54 pm

Re: Server coding question. Please help!

Post by cazfi »

Lexxie wrote: Sun Oct 30, 2022 10:04 amI think it has something to do with map_get_player_city() but can't figure it out.
Should be as easy as checking if the returned vision_site is a city (I guess you have to check "identity > 0", as there's no API for that), and owned ( vision_site_owner() ) by someone non-allied.
Lexxie
Veteran
Posts: 127
Joined: Fri Jun 23, 2017 4:18 pm

Re: Server coding question. Please help!

Post by Lexxie »

Thank you for quick response!! :)
User avatar
TharmonArace
Posts: 3
Joined: Thu Mar 09, 2023 8:35 pm

Re: Server coding question. Please help!

Post by TharmonArace »

First off, I have to say that niche online marketplaces are like the secret sauce for us fans of specific genres or hobbies. There's something special about a tight-knit community coming together to share the love for their favorite games or interests.

As for the original question about how niche online marketplaces compare to broader platforms, I think it's a bit like comparing apples to oranges. On one hand, you have the big players that offer everything under the sun, but on the other, these niche markets feel like hidden gems where you can find exactly what you're looking for without sifting through a mountain of unrelated stuff. It's refreshing!
Post Reply