main_gui.c
changeset 410 8de2aaf20800
parent 395 4c990f33dab7
child 424 4c7808af7526
equal deleted inserted replaced
409:98c586218b01 410:8de2aaf20800
   102 
   102 
   103 
   103 
   104 typedef void MenuClickedProc(int index);
   104 typedef void MenuClickedProc(int index);
   105 
   105 
   106 
   106 
   107 void MenuClickSettings(int index)
   107 static void MenuClickSettings(int index)
   108 {
   108 {
   109 	switch(index) {
   109 	switch(index) {
   110 	case 0: ShowGameOptions(); return;
   110 	case 0: ShowGameOptions(); return;
   111 	case 1: ShowGameDifficulty(); return;
   111 	case 1: ShowGameDifficulty(); return;
   112 	case 2: ShowPatchesSelection(); return;
   112 	case 2: ShowPatchesSelection(); return;
   118 	case 9: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return;
   118 	case 9: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return;
   119 	case 10: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return;
   119 	case 10: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return;
   120 	}
   120 	}
   121 }
   121 }
   122 
   122 
   123 void MenuClickSaveLoad(int index)
   123 static void MenuClickSaveLoad(int index)
   124 {
   124 {
   125 	if (_game_mode == GM_EDITOR) {
   125 	if (_game_mode == GM_EDITOR) {
   126 		switch(index) {
   126 		switch(index) {
   127 		case 0:
   127 		case 0:
   128 			ShowSaveLoadDialog(SLD_SAVE_SCENARIO);
   128 			ShowSaveLoadDialog(SLD_SAVE_SCENARIO);
   153 			break;
   153 			break;
   154 		}
   154 		}
   155 	}
   155 	}
   156 }
   156 }
   157 
   157 
   158 void MenuClickMap(int index)
   158 static void MenuClickMap(int index)
   159 {
   159 {
   160 	switch(index) {
   160 	switch(index) {
   161 	case 0: ShowSmallMap(); break;
   161 	case 0: ShowSmallMap(); break;
   162 	case 1: ShowExtraViewPortWindow(); break;
   162 	case 1: ShowExtraViewPortWindow(); break;
   163 	}
   163 	}
   164 }
   164 }
   165 
   165 
   166 void MenuClickTown(int index)
   166 static void MenuClickTown(int index)
   167 {
   167 {
   168 	ShowTownDirectory();
   168 	ShowTownDirectory();
   169 }
   169 }
   170 
   170 
   171 void MenuClickScenMap(int index)
   171 static void MenuClickScenMap(int index)
   172 {
   172 {
   173 	switch(index) {
   173 	switch(index) {
   174 	case 0: ShowSmallMap(); break;
   174 	case 0: ShowSmallMap(); break;
   175 	case 1: ShowExtraViewPortWindow(); break;
   175 	case 1: ShowExtraViewPortWindow(); break;
   176 	case 2: ShowTownDirectory(); break;
   176 	case 2: ShowTownDirectory(); break;
   177 	}
   177 	}
   178 }
   178 }
   179 
   179 
   180 void MenuClickSubsidies(int index)
   180 static void MenuClickSubsidies(int index)
   181 {
   181 {
   182 	ShowSubsidiesList();
   182 	ShowSubsidiesList();
   183 }
   183 }
   184 
   184 
   185 void MenuClickStations(int index)
   185 static void MenuClickStations(int index)
   186 {
   186 {
   187 	ShowPlayerStations(index);
   187 	ShowPlayerStations(index);
   188 }
   188 }
   189 
   189 
   190 void MenuClickFinances(int index)
   190 static void MenuClickFinances(int index)
   191 {
   191 {
   192 	ShowPlayerFinances(index);
   192 	ShowPlayerFinances(index);
   193 }
   193 }
   194 
   194 
   195 void MenuClickCompany(int index)
   195 static void MenuClickCompany(int index)
   196 {
   196 {
   197 	ShowPlayerCompany(index);
   197 	ShowPlayerCompany(index);
   198 }
   198 }
   199 
   199 
   200 
   200 
   201 void MenuClickGraphs(int index)
   201 static void MenuClickGraphs(int index)
   202 {
   202 {
   203 	switch(index) {
   203 	switch(index) {
   204 	case 0: ShowOperatingProfitGraph(); return;
   204 	case 0: ShowOperatingProfitGraph(); return;
   205 	case 1: ShowIncomeGraph(); return;
   205 	case 1: ShowIncomeGraph(); return;
   206 	case 2: ShowDeliveredCargoGraph(); return;
   206 	case 2: ShowDeliveredCargoGraph(); return;
   208 	case 4: ShowCompanyValueGraph(); return;
   208 	case 4: ShowCompanyValueGraph(); return;
   209 	case 5: ShowCargoPaymentRates(); return;
   209 	case 5: ShowCargoPaymentRates(); return;
   210 	}
   210 	}
   211 }
   211 }
   212 
   212 
   213 void MenuClickLeague(int index)
   213 static void MenuClickLeague(int index)
   214 {
   214 {
   215 	switch(index) {
   215 	switch(index) {
   216 	case 0: ShowCompanyLeagueTable(); return;
   216 	case 0: ShowCompanyLeagueTable(); return;
   217 	case 1: ShowPerformanceRatingDetail(); return;
   217 	case 1: ShowPerformanceRatingDetail(); return;
   218 	}
   218 	}
   219 }
   219 }
   220 
   220 
   221 void MenuClickIndustry(int index)
   221 static void MenuClickIndustry(int index)
   222 {
   222 {
   223 	switch(index) {
   223 	switch(index) {
   224 	case 0: ShowIndustryDirectory(); break;
   224 	case 0: ShowIndustryDirectory(); break;
   225 	case 1: ShowBuildIndustryWindow(); break;
   225 	case 1: ShowBuildIndustryWindow(); break;
   226 	}
   226 	}
   227 }
   227 }
   228 
   228 
   229 void MenuClickShowTrains(int index)
   229 static void MenuClickShowTrains(int index)
   230 {
   230 {
   231 	ShowPlayerTrains(index);
   231 	ShowPlayerTrains(index);
   232 }
   232 }
   233 
   233 
   234 void MenuClickShowRoad(int index)
   234 static void MenuClickShowRoad(int index)
   235 {
   235 {
   236 	ShowPlayerRoadVehicles(index);
   236 	ShowPlayerRoadVehicles(index);
   237 }
   237 }
   238 
   238 
   239 void MenuClickShowShips(int index)
   239 static void MenuClickShowShips(int index)
   240 {
   240 {
   241 	ShowPlayerShips(index);
   241 	ShowPlayerShips(index);
   242 }
   242 }
   243 
   243 
   244 void MenuClickShowAir(int index)
   244 static void MenuClickShowAir(int index)
   245 {
   245 {
   246 	ShowPlayerAircraft(index);
   246 	ShowPlayerAircraft(index);
   247 }
   247 }
   248 
   248 
   249 void MenuClickBuildRail(int index)
   249 static void MenuClickBuildRail(int index)
   250 {
   250 {
   251 	Player *p = DEREF_PLAYER(_local_player);
   251 	Player *p = DEREF_PLAYER(_local_player);
   252 	_last_built_railtype = min(index, p->max_railtype-1);
   252 	_last_built_railtype = min(index, p->max_railtype-1);
   253 	ShowBuildRailToolbar(_last_built_railtype, -1);
   253 	ShowBuildRailToolbar(_last_built_railtype, -1);
   254 }
   254 }
   255 
   255 
   256 void MenuClickBuildRoad(int index)
   256 static void MenuClickBuildRoad(int index)
   257 {
   257 {
   258 	ShowBuildRoadToolbar();
   258 	ShowBuildRoadToolbar();
   259 }
   259 }
   260 
   260 
   261 void MenuClickBuildWater(int index)
   261 static void MenuClickBuildWater(int index)
   262 {
   262 {
   263 	ShowBuildDocksToolbar();
   263 	ShowBuildDocksToolbar();
   264 }
   264 }
   265 
   265 
   266 void MenuClickBuildAir(int index)
   266 static void MenuClickBuildAir(int index)
   267 {
   267 {
   268 	ShowBuildAirToolbar();
   268 	ShowBuildAirToolbar();
   269 }
   269 }
   270 
   270 
   271 void ShowRenameSignWindow(SignStruct *ss)
   271 void ShowRenameSignWindow(SignStruct *ss)
   305 		SetObjectToPlace(0x2D2, 1, 1, 0);
   305 		SetObjectToPlace(0x2D2, 1, 1, 0);
   306 		_place_proc = PlaceProc_Sign;
   306 		_place_proc = PlaceProc_Sign;
   307 	}
   307 	}
   308 }
   308 }
   309 
   309 
   310 void MenuClickForest(int index)
   310 static void MenuClickForest(int index)
   311 {
   311 {
   312 	switch(index) {
   312 	switch(index) {
   313 	case 0: ShowTerraformToolbar(); break;
   313 	case 0: ShowTerraformToolbar(); break;
   314 	case 1: ShowBuildTreesToolbar(); break;
   314 	case 1: ShowBuildTreesToolbar(); break;
   315 	case 2: SelectSignTool(); break;
   315 	case 2: SelectSignTool(); break;
   316 	}
   316 	}
   317 }
   317 }
   318 
   318 
   319 void MenuClickMusicWindow(int index)
   319 static void MenuClickMusicWindow(int index)
   320 {
   320 {
   321 	ShowMusicWindow();
   321 	ShowMusicWindow();
   322 }
   322 }
   323 
   323 
   324 void MenuClickNewspaper(int index)
   324 static void MenuClickNewspaper(int index)
   325 {
   325 {
   326 	switch(index) {
   326 	switch(index) {
   327 	case 0: ShowLastNewsMessage(); break;
   327 	case 0: ShowLastNewsMessage(); break;
   328 	case 1: ShowMessageOptions(); break;
   328 	case 1: ShowMessageOptions(); break;
   329 	case 2: ShowMessageHistory(); break;
   329 	case 2: ShowMessageHistory(); break;
   330 	case 3: ; /* XXX: chat not done */
   330 	case 3: ; /* XXX: chat not done */
   331 	}
   331 	}
   332 }
   332 }
   333 
   333 
   334 void MenuClickHelp(int index)
   334 static void MenuClickHelp(int index)
   335 {
   335 {
   336 	switch(index) {
   336 	switch(index) {
   337 	case 0: PlaceLandBlockInfo(); break;
   337 	case 0: PlaceLandBlockInfo(); break;
   338 	case 2: _make_screenshot = 1; break;
   338 	case 2: _make_screenshot = 1; break;
   339 	case 3: _make_screenshot = 2; break;
   339 	case 3: _make_screenshot = 2; break;
   924 			DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w);
   924 			DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w);
   925 		}
   925 		}
   926 	}
   926 	}
   927 }
   927 }
   928 
   928 
   929 void ResetLandscape()
   929 static void ResetLandscape()
   930 {
   930 {
   931 	_random_seeds[0][0] = InteractiveRandom();
   931 	_random_seeds[0][0] = InteractiveRandom();
   932 	_random_seeds[0][1] = InteractiveRandom();
   932 	_random_seeds[0][1] = InteractiveRandom();
   933 
   933 
   934 	GenerateWorld(1);
   934 	GenerateWorld(1);
  1035 	}
  1035 	}
  1036 
  1036 
  1037 	_generating_world = false;
  1037 	_generating_world = false;
  1038 }
  1038 }
  1039 
  1039 
  1040 void PlaceProc_RaiseBigLand(uint tile)
  1040 static void PlaceProc_RaiseBigLand(uint tile)
  1041 {
  1041 {
  1042 	CommonRaiseLowerBigLand(tile, 1);
  1042 	CommonRaiseLowerBigLand(tile, 1);
  1043 }
  1043 }
  1044 
  1044 
  1045 void PlaceProc_LowerBigLand(uint tile)
  1045 static void PlaceProc_LowerBigLand(uint tile)
  1046 {
  1046 {
  1047 	CommonRaiseLowerBigLand(tile, 0);
  1047 	CommonRaiseLowerBigLand(tile, 0);
  1048 }
  1048 }
  1049 
  1049 
  1050 //static void CcDemolish(bool success, uint tile, uint32 p1, uint32 p2)
  1050 //static void CcDemolish(bool success, uint tile, uint32 p1, uint32 p2)
  1059 //{
  1059 //{
  1060 //	DoCommandP(tile, 0, 0, CcDemolish, CMD_LANDSCAPE_CLEAR | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
  1060 //	DoCommandP(tile, 0, 0, CcDemolish, CMD_LANDSCAPE_CLEAR | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
  1061 //}
  1061 //}
  1062 
  1062 
  1063 
  1063 
  1064 void PlaceProc_RockyArea(uint tile)
  1064 static void PlaceProc_RockyArea(uint tile)
  1065 {
  1065 {
  1066 	if (!IS_TILETYPE(tile, MP_CLEAR))
  1066 	if (!IS_TILETYPE(tile, MP_CLEAR))
  1067 		return;
  1067 		return;
  1068 
  1068 
  1069 	_map5[tile] = (_map5[tile] & ~0x1C) | 8;
  1069 	_map5[tile] = (_map5[tile] & ~0x1C) | 8;
  1070 	MarkTileDirtyByTile(tile);
  1070 	MarkTileDirtyByTile(tile);
  1071 	SndPlayTileFx(0x1D, tile);
  1071 	SndPlayTileFx(0x1D, tile);
  1072 }
  1072 }
  1073 
  1073 
  1074 void PlaceProc_LightHouse(uint tile)
  1074 static void PlaceProc_LightHouse(uint tile)
  1075 {
  1075 {
  1076 	TileInfo ti;
  1076 	TileInfo ti;
  1077 
  1077 
  1078 	FindLandscapeHeightByTile(&ti, tile);
  1078 	FindLandscapeHeightByTile(&ti, tile);
  1079 	if (ti.type != MP_CLEAR || (ti.tileh & 0x10))
  1079 	if (ti.type != MP_CLEAR || (ti.tileh & 0x10))
  1081 
  1081 
  1082 	ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 1);
  1082 	ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 1);
  1083 	SndPlayTileFx(0x1D, tile);
  1083 	SndPlayTileFx(0x1D, tile);
  1084 }
  1084 }
  1085 
  1085 
  1086 void PlaceProc_Transmitter(uint tile)
  1086 static void PlaceProc_Transmitter(uint tile)
  1087 {
  1087 {
  1088 	TileInfo ti;
  1088 	TileInfo ti;
  1089 
  1089 
  1090 	FindLandscapeHeightByTile(&ti, tile);
  1090 	FindLandscapeHeightByTile(&ti, tile);
  1091 	if (ti.type != MP_CLEAR || (ti.tileh & 0x10))
  1091 	if (ti.type != MP_CLEAR || (ti.tileh & 0x10))
  1093 
  1093 
  1094 	ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 0);
  1094 	ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 0);
  1095 	SndPlayTileFx(0x1D, tile);
  1095 	SndPlayTileFx(0x1D, tile);
  1096 }
  1096 }
  1097 
  1097 
  1098 void PlaceProc_Desert(uint tile)
  1098 static void PlaceProc_Desert(uint tile)
  1099 {
  1099 {
  1100 	SetMapExtraBits(tile, GetMapExtraBits(tile) == 1 ? 0 : 1);
  1100 	SetMapExtraBits(tile, GetMapExtraBits(tile) == 1 ? 0 : 1);
  1101 }
  1101 }
  1102 
  1102 
  1103 static const Widget _scen_edit_land_gen_widgets[] = {
  1103 static const Widget _scen_edit_land_gen_widgets[] = {
  1261 		SndPlayTileFx(0x1D, tile);
  1261 		SndPlayTileFx(0x1D, tile);
  1262 		ResetObjectToPlace();
  1262 		ResetObjectToPlace();
  1263 	}
  1263 	}
  1264 }
  1264 }
  1265 
  1265 
  1266 void PlaceProc_Town(uint tile)
  1266 static void PlaceProc_Town(uint tile)
  1267 {
  1267 {
  1268 	DoCommandP(tile, 0, 0, CcBuildTown, CMD_BUILD_TOWN | CMD_MSG(STR_0236_CAN_T_BUILD_TOWN_HERE));
  1268 	DoCommandP(tile, 0, 0, CcBuildTown, CMD_BUILD_TOWN | CMD_MSG(STR_0236_CAN_T_BUILD_TOWN_HERE));
  1269 }
  1269 }
  1270 
  1270 
  1271 
  1271 
  1997 	_cur_dpi = old_dpi;
  1997 	_cur_dpi = old_dpi;
  1998 
  1998 
  1999 	return x > 0;
  1999 	return x > 0;
  2000 }
  2000 }
  2001 
  2001 
  2002 void StatusBarWndProc(Window *w, WindowEvent *e)
  2002 static void StatusBarWndProc(Window *w, WindowEvent *e)
  2003 {
  2003 {
  2004 	Player *p;
  2004 	Player *p;
  2005 
  2005 
  2006 	switch(e->event) {
  2006 	switch(e->event) {
  2007 	case WE_PAINT:
  2007 	case WE_PAINT: