From 804d114fad06ec258c2f738e50b8591c5d141898 Mon Sep 17 00:00:00 2001 From: Dave White Date: Thu, 15 Apr 2004 14:58:57 +0000 Subject: [PATCH] made new time of day image masks ... ...which get laid over hexes when it's that time of day --- data/schedules.cfg | 6 +++ images/terrain/dawn.png | Bin 0 -> 778 bytes images/terrain/dusk.png | Bin 0 -> 578 bytes images/terrain/night.png | Bin 0 -> 836 bytes src/display.cpp | 94 ++++++++++++++++++++++++-------------- src/display.hpp | 4 ++ src/gamestatus.cpp | 14 +++++- src/gamestatus.hpp | 3 ++ src/multiplayer_lobby.cpp | 15 ++++++ src/network.cpp | 4 +- src/reports.cpp | 6 ++- 11 files changed, 108 insertions(+), 38 deletions(-) create mode 100644 images/terrain/dawn.png create mode 100644 images/terrain/dusk.png create mode 100644 images/terrain/night.png diff --git a/data/schedules.cfg b/data/schedules.cfg index 7115217c8b7..0e1776a15bc 100644 --- a/data/schedules.cfg +++ b/data/schedules.cfg @@ -3,6 +3,7 @@ id=dawn name=Dawn image=Dawn.png +mask=terrain/dawn.png [/time] [illuminated_time] id=morning @@ -47,6 +48,7 @@ lawful_bonus=25 id=dusk name=Dusk image=Dusk.png +mask=terrain/dusk.png [/time] [illuminated_time] id=afternoon @@ -62,11 +64,13 @@ id=first_watch name=First Watch image=FirstWatch.png lawful_bonus=-25 +mask=terrain/night.png [/time] [illuminated_time] id=dusk name=Dusk image=Dusk.png +mask=terrain/dusk.png [/illuminated_time] #enddef @@ -76,11 +80,13 @@ id=second_watch name=Second Watch image=SecondWatch.png lawful_bonus=-25 +mask=terrain/night.png [/time] [illuminated_time] id=dusk name=Dusk image=Dusk.png +mask=terrain/dusk.png [/illuminated_time] #enddef diff --git a/images/terrain/dawn.png b/images/terrain/dawn.png new file mode 100644 index 0000000000000000000000000000000000000000..24746df6b666e1b3f89f84253bd0a2e1df4f9a9d GIT binary patch literal 778 zcmV+l1NHogP)HzKEDj@1AF0+&fd zK~#90?VMY3gdh+_AvODO1?IJ)S(+=FpR8b3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|xZ}VmX zg)f05yQ(+#O|P=w=V9o(;mO+KliZVU`*ohry?f=m;?JkC_Z>ysBTv}>`vi<`22WQ% Jmvv4FO#oJ0@-zSd literal 0 HcmV?d00001 diff --git a/images/terrain/night.png b/images/terrain/night.png new file mode 100644 index 0000000000000000000000000000000000000000..589ed0242111509d263241b7091938735d00af81 GIT binary patch literal 836 zcmV-K1H1f*P)Uy%R+00(qQO+^RP1P=~21Z;OYX#fBM(n&-? zRCt{2ob7RgFbsxGuX`{7d-QvTj>ZgKr4w|K(jSdmSM_U4vQ3Q9bJq(YDLBewVT8%# zDzMD!OO5T+;{D_Gt#lhVH5xJ^Q|ShJv&BrjF=LyiOE@WlnP$epm2bJ335vboDUH*BNhnGm`6m)nmy_jzC!cC=T|SS{=R+Do z@m5dCMlXR09FBN zG;26hTFn@MWCHXM)^I04n=t@Uk^AV@NN%z)V*ujIB1g4GdLx$^15jN^JDN3`n?=nS zK+_u)dO&+ax)}o~x>(=4H6=fKVa5QO-`;X9?1yz4QDs6 chat_messages_; + //if we're transitioning from one time of day to the next, + //then we will use these two masks on top of all hexes when we blit + shared_sdl_surface tod_hex_mask1, tod_hex_mask2; + //for debug mode static std::map debugHighlights_; }; diff --git a/src/gamestatus.cpp b/src/gamestatus.cpp index 3b0fdd04785..49d30204ca7 100644 --- a/src/gamestatus.cpp +++ b/src/gamestatus.cpp @@ -131,10 +131,10 @@ void gamestatus::write(config& cfg) const } } -const time_of_day& gamestatus::get_time_of_day() const +const time_of_day& gamestatus::get_time_of_day_turn(int nturn) const { if(times_.empty() == false) { - return times_[(turn()-1)%times_.size()]; + return times_[(nturn-1)%times_.size()]; } else { config dummy_cfg; const static time_of_day default_time(dummy_cfg); @@ -142,6 +142,16 @@ const time_of_day& gamestatus::get_time_of_day() const } } +const time_of_day& gamestatus::get_time_of_day() const +{ + return get_time_of_day_turn(turn()); +} + +const time_of_day& gamestatus::get_previous_time_of_day() const +{ + return get_time_of_day_turn(turn()-1); +} + const time_of_day& gamestatus::get_time_of_day(bool illuminated, const gamemap::location& loc) const { for(std::vector::const_iterator i = areas_.begin(); i != areas_.end(); ++i) { diff --git a/src/gamestatus.hpp b/src/gamestatus.hpp index d8639325925..6e4afd5d7ec 100644 --- a/src/gamestatus.hpp +++ b/src/gamestatus.hpp @@ -54,6 +54,7 @@ public: void write(config& cfg) const; const time_of_day& get_time_of_day() const; + const time_of_day& get_previous_time_of_day() const; const time_of_day& get_time_of_day(bool illuminated, const gamemap::location& loc) const; size_t turn() const; size_t number_of_turns() const; @@ -86,6 +87,8 @@ public: }; private: + const time_of_day& get_time_of_day_turn(int nturn) const; + std::vector times_, illuminatedTimes_; struct area_time_of_day { diff --git a/src/multiplayer_lobby.cpp b/src/multiplayer_lobby.cpp index 35a3bbfb227..13ebab65383 100644 --- a/src/multiplayer_lobby.cpp +++ b/src/multiplayer_lobby.cpp @@ -50,6 +50,8 @@ RESULT enter(display& disp, config& game_data, const config& terrain_data) bool last_escape = true; + int game_selection = 0, user_selection = 0; + for(;;) { SDL_BlitSurface(background, NULL, disp.video().getSurface(), NULL); @@ -81,6 +83,11 @@ RESULT enter(display& disp, config& game_data, const config& terrain_data) std::stringstream str; + //if this is the item that should be selected, make it selected by default + if(game_selection-- == 0) { + str << "*"; + } + std::string map_data = (**i.first)["map_data"]; if(map_data == "") { map_data = read_file("data/maps/" + (**i.first)["map"]); @@ -145,6 +152,11 @@ RESULT enter(display& disp, config& game_data, const config& terrain_data) name.insert(name.begin(),'#'); } + //if this user should be selected + if(user_selection-- == 0) { + name.insert(name.begin(),'*'); + } + users.push_back(name); } @@ -228,6 +240,9 @@ RESULT enter(display& disp, config& game_data, const config& terrain_data) events::raise_process_event(); events::raise_draw_event(); + user_selection = users_menu.selection(); + game_selection = games_menu.selection(); + config data; //if the list is refreshed, we want to redraw the entire screen diff --git a/src/network.cpp b/src/network.cpp index 87bcff7ba11..b6bf5f10380 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -564,7 +564,7 @@ void process_send_queue(connection connection_num, size_t max_size) std::cerr << "sending " << bytes_to_send << " from send queue\n"; const int res = SDLNet_TCP_Send(sock,&buf[upto],bytes_to_send); - if(res < int(bytes_to_send)) { + if(res != int(bytes_to_send)) { std::cerr << "sending data failed: " << res << "/" << bytes_to_send << "\n"; throw error("Sending queued data failed",connection_num); } @@ -575,6 +575,8 @@ void process_send_queue(connection connection_num, size_t max_size) if(upto == buf.size()) { std::cerr << "erasing item from the send queue\n"; send_queue.erase(itor.first); + } else if(upto > buf.size()) { + std::cerr << "ERROR: buffer overrun sending data\n"; } //if we haven't sent 'max_size' bytes yet, try to go onto the next item in diff --git a/src/reports.cpp b/src/reports.cpp index 01af3d799e5..1312c3f4972 100644 --- a/src/reports.cpp +++ b/src/reports.cpp @@ -299,7 +299,9 @@ report generate_report(TYPE type, const gamemap& map, const unit_map& units, case SIDE_PLAYING: { char buf[50]; sprintf(buf,"terrain/flag-team%d.png",playing_side); - return report("",buf,""); + + u = find_leader(units,playing_side); + return report("",buf,u != units.end() ? u->second.description() : ""); } case OBSERVERS: { @@ -307,6 +309,8 @@ report generate_report(TYPE type, const gamemap& map, const unit_map& units, return report(); } + str << translate_string("observers") << ":\n"; + for(std::set::const_iterator i = observers.begin(); i != observers.end(); ++i) { str << *i << "\n"; }