Permalink
Browse files

New action type: TIC. Created to log the time it takes a tic to run

  • Loading branch information...
1 parent 5495826 commit 65be0d7d273c4deeedc285e6cb88cb257eec2166 Abstrct committed Jun 3, 2012
Showing with 8 additions and 1 deletion.
  1. +5 −1 create_schemaverse.sql
  2. +3 −0 tic.pl
View
@@ -1134,6 +1134,7 @@ CREATE TABLE action
);
INSERT INTO action VALUES
+ ('TIC','A new Tic has begun at %toc%'::TEXT),
('BUY_SHIP','(#%player_id_1%)%player_name_1% has purchased a new ship (#%ship_id_1%)%ship_name_1% and sent it to location %location%'::TEXT),
('UPGRADE_FLEET','(#%player_id_1%)%player_name_1%''s new fleet (#%referencing_id%)%descriptor_string% has been upgraded'::TEXT),
('UPGRADE_SHIP','(#%player_id_1%)%player_name_1% has upgraded the %descriptor_string% on ship (#%ship_id_1%)%ship_name_1% +%descriptor_numeric%'::TEXT),
@@ -1283,7 +1284,9 @@ BEGIN
replace(
replace(
replace(
- replace(action.string,
+ replace(
+ replace(action.string,
+ '%toc', toc::TEXT),
'%player_id_1%', player_id_1::TEXT),
'%player_name_1%', GET_PLAYER_USERNAME(player_id_1)),
'%player_id_2%', COALESCE(player_id_2::TEXT,'Unknown')),
@@ -1307,6 +1310,7 @@ $read_event$ LANGUAGE plpgsql;
+
CREATE OR REPLACE FUNCTION fleet_success_event(fleet integer, took interval)
RETURNS boolean AS
$BODY$
View
3 tic.pl
@@ -142,6 +142,9 @@
#Update some stats now and then
$master_connection->do("insert into stat_log select * from current_stats WHERE mod(current_tic,60)=0;");
+
+$master_connection->do("INSERT INTO event(player_id_1, action, tic, public) VALUES(0,'TIC',(SELECT last_value FROM tic_seq)",'t');
+
#Tic is increased to NEXTVAL
$master_connection->do("SELECT nextval('tic_seq')");

0 comments on commit 65be0d7

Please sign in to comment.