Server coding question. Please help!
Posted: Sun Oct 30, 2022 10:04 am
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
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