Skip to content

Commit

Permalink
Show units homecity.
Browse files Browse the repository at this point in the history
  • Loading branch information
freecivnet committed Jun 18, 2011
1 parent 7a1b125 commit 80b9ab1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion freeciv-web/src/main/webapp/javascript/mapview.js
Expand Up @@ -335,7 +335,11 @@ function update_unit_info_label(punits)
");background-position:-" + sprite['tileset-x'] + "px -" + sprite['tileset-y']
+ "px; width: " + sprite['width'] + "px;height: " + sprite['height'] + "px;'"
+ "'></div>";
unit_info_html += "<div style='float:left;'><b>" + ptype['name'] + "</b><br>"
unit_info_html += "<div id='unit_text_details'><b>" + ptype['name'] + "</b><br>"
if (get_unit_homecity_name(punit) != null) {
unit_info_html += "<b>" + get_unit_homecity_name(punit) + "</b>";
unit_info_html += "<br>";
}
unit_info_html += get_unit_moves_left(punit) ;
unit_info_html += "<br>";
unit_info_html += "<div style='font-size: 80%;'><span title='Attack strength'>A:" + ptype['attack_strength']
Expand Down
13 changes: 13 additions & 0 deletions freeciv-web/src/main/webapp/javascript/unit.js
Expand Up @@ -266,3 +266,16 @@ function reset_unit_anim_list()
punit['anim_list'] = [];
}
}

/**************************************************************************
Returns the name of the unit's homecity.
**************************************************************************/
function get_unit_homecity_name(punit)
{
if (punit['homecity'] != 0 && cities[punit['homecity']] != null) {
return unescape(cities[punit['homecity']]['name']);
} else {
return null;
}

}
5 changes: 5 additions & 0 deletions freeciv-web/src/main/webapp/stylesheets/civclient.css
Expand Up @@ -93,6 +93,11 @@ button {
margin-top: -15px;
}

#unit_text_details {
float:left;
width: 120px;

}

#end_game_turn_panel {
float: right;
Expand Down

0 comments on commit 80b9ab1

Please sign in to comment.